I'm experimenting with a single direction, USB bulk transfer link between a TI Stellaris Launchpad and a (linux) PC. Below is the relevant code on the PC and on the Launchpad. The sender (Launchpad) sends 10 (ten) 64-byte packets to the PC.
The problem: There is only a data transfer during the first cycle. The following cycles, libusb (on the PC side) reports error -7 ("Other error")
On the PC side (using synchronous transfer, libusb-1.0):
for (r = 0; r < 10; r++) {
res = libusb_bulk_transfer(dev_handle, EP_IN, bff, 64, &recd, 1200);
total += recd;
if (res == 0)
printf("Received: %d\n", recd);
else
printf("Receive error (%d: %s)\n", res, libusb_strerror(r));
}
On the Launchpad:
USBDBulkPacketWrite(pDevice, USBTxBuffer_A, 64, true);
// USBBufferDataWritten(&g_sTxBuffer, ulCount);
I've tried both `USBDBulkPacketWrite` (where the data is written by the function call) and `USBBufferDataWritten` (where data is written directly into the TxBuffers, as in the `usb-dev-bulk` demo.
The receiver confirms reception of 64 bytes only once.
As far as I know, no 'ending' packets are needed, as the transfer length is exactly the size of the packet. Running the `libusb` receiver with debug level 5, does print an error, which I can't really identify the cause of. This is the debug output of the first of the ten tries:
libusb: debug [libusb_alloc_transfer] transfer 0xc4c9f8
libusb: debug [libusb_submit_transfer] transfer 0xc4c9f8
libusb: debug [add_to_flying_list] arm timerfd for timeout in 1200ms (first in line)
libusb: debug [submit_bulk_transfer] need 1 urbs for new transfer with length 62
libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: debug [handle_events] poll fds modified, reallocating
libusb: debug [handle_events] poll() 3 fds with timeout in 60000ms
libusb: debug [handle_events] poll() returned 1
libusb: debug [handle_events] timerfd triggered
libusb: debug [libusb_cancel_transfer] transfer 0xc4c9f8
libusb: debug [disarm_timerfd]
libusb: debug [handle_events] poll() 3 fds with timeout in 0ms
libusb: debug [handle_events] poll() returned 1
libusb: debug [reap_for_handle] urb type=3 status=-2 transferred=0
libusb: debug [handle_bulk_completion] handling completion status -2 of bulk urb 1/1
libusb: debug [handle_bulk_completion] abnormal reap: urb status -2
libusb: debug [handle_bulk_completion] abnormal reap: last URB handled, reporting
libusb: debug [usbi_handle_transfer_cancellation] detected timeout cancellation
libusb: debug [disarm_timerfd]
libusb: debug [usbi_handle_transfer_completion] transfer 0xc4c9f8 has callback 0x7f7ea23ac6d0
libusb: debug [sync_transfer_cb] actual_length=0
libusb: debug [libusb_free_transfer] transfer 0xc4c9f8
The only difference with the following output is the reallocation of the fds.