How to transfer data in batches between linux and USB equipment
1. Bulk OUT transfer (host host to usb device)
The host host sends the out flag packet to the device, followed by the packet
The device receives the data correctly and responds to an ACK. If the device breakpoint is not ready to receive data, it will discard the data sent by the host and respond to a NAK to show that it is not ready.
Counter register OUTnBC: first, it is just how many bytes of data the device has just received in a batch transmission; second, it indicates that the next batch of out data transfer can be carried out.
Status register OUTnCS: indicates whether the endpoint is currently busy.
two。 Bulk IN transfer (usb device to host device)
The host host sends an IN flag packet to request an IN transmission.
When the device is ready, the data is transmitted to the host host. Write a byte counter to show that the device is ready. If the device is not ready, respond to the NAK package to indicate that it is not ready.