|
From: <dus...@em...> - 2019-04-04 12:20:00
|
> When you get that timeout, do you resubmit the read request? Yes. There is an infinite loop in my app that calls (for interrupt IN endpoint): libusb_interrupt_transfer(dev_handle, 0x81, data, 64, &actual, 1); > If some endpoints are working, I'm not sure why it wouldn't show the device. Do you see error just at the point where the read times out? What you describe could be caused by an endpoint stall, but that would be a device problem. I just noticed that my device is not visible in Device Monitoring Stuido, not 100 % sure the if this is related to the problem...I will see. I don't monitor my device using Device Monitoring Studio when the reading starts to timeout (I have only 10min free version). I have my USB device connected to debugger and I can see state of the device's endpoints. When the problem happens, the interrupt IN endpoint is in transferring state (data prepared for transfer waiting for host to read it), no stall condition. When libusb_interrupt_transfer for interrupt IN endpoint is called on the host side I receive no USB interrupt on the device side (the device is NXP Kinetis MCU with their USB stack v2.1). What can cause libusb read to timeout without submitting any transfer on the USB bus (because if there was any transfer I would see it on the device's side - in USB interrupt routine)? This is debug log of libusb_bulk_transfer that timeouts without any data even though USB device has some data available to be sent: [ 4.234535] [000024bc] libusb: debug [libusb_alloc_transfer] transfer 0128148C [ 4.234535] [000024bc] libusb: debug [libusb_submit_transfer] transfer 0128148C [ 4.235536] [000024bc] libusb: debug [winusbx_submit_bulk_transfer] matched endpoint 81 with interface 0 [ 4.236535] [000024bc] libusb: debug [winusbx_submit_bulk_transfer] reading 64 bytes [ 4.236535] [000024bc] libusb: debug [usbi_add_pollfd] add fd 1 events 1 [ 4.237538] [000024bc] libusb: debug [libusb_get_next_timeout] next timeout in 0.997948s [ 4.237538] [000024bc] libusb: debug [libusb_handle_events_timeout_ completed] doing our own event handling [ 4.238535] [000024bc] libusb: debug [handle_events] poll fds modified, reallocating [ 4.238535] [000024bc] libusb: debug [handle_events] poll() 2 fds with timeout in 998ms [ 5.237977] [000024bc] libusb: debug [handle_events] poll() returned 0 [ 5.237977] [000024bc] libusb: debug [libusb_cancel_transfer] transfer 0128148C [ 5.239967] [000024bc] libusb: debug [winusbx_abort_transfers] will use interface 0 [ 5.240954] [000024bc] libusb: debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout! [ 5.241966] [000024bc] libusb: debug [libusb_handle_events_timeout_ completed] doing our own event handling [ 5.242965] [000024bc] libusb: debug [handle_events] poll() 2 fds with timeout in 60000ms [ 5.243954] [000024bc] libusb: debug [handle_events] poll() returned 1 [ 5.243954] [000024bc] libusb: debug [windows_handle_events] checking fd 1 with revents = 0001 [ 5.245953] [000024bc] libusb: debug [usbi_remove_pollfd] remove fd 1 [ 5.249952] [000024bc] libusb: debug [windows_transfer_callback] handling I/ O completion with errcode 995, size 0 [ 5.250966] [000024bc] libusb: debug [windows_transfer_callback] detected operation aborted [ 5.251965] [000024bc] libusb: debug [usbi_handle_transfer_cancellation] detected timeout cancellation [ 5.252952] [000024bc] libusb: debug [usbi_handle_transfer_completion] transfer 0128148C has callback 01384005 [ 5.252952] [000024bc] libusb: debug [sync_transfer_cb] actual_length=0 [ 5.253964] [000024bc] libusb: debug [libusb_free_transfer] transfer 0128148 C ---------- Původní e-mail ---------- Od: Tim Roberts <ti...@pr...> Komu: lib...@li... Datum: 3. 4. 2019 23:52:10 Předmět: Re: [libusb] Transfer timeout "dus...@em... wrote: > > my host app (libusb on Win 10) reads some data from interrupt IN and > bulk IN endpoint from my USB device. Sometimes the app stops reading > the data from e.g. interrupt IN endpoint, libusb_interrupt_transfer on > that endpoint always returns -7 (timeout) with zero data transfered. > The USB device has some data prepared to be transfered but there is no > incoming request from the host (no usb interrupt routine is called at > the device side for libusb_interrupt_transfer call). When you get that timeout, do you resubmit the read request? > I also noticed that in this state, my device is not detected by Device > Monitoring Studio (usb analyzer software). It is visible in Windows > Device Manager. If some endpoints are working, I'm not sure why it wouldn't show the device. Do you see error just at the point where the read times out? What you describe could be caused by an endpoint stall, but that would be a device problem. -- Tim Roberts, ti...@pr... Providenza & Boekelheide, Inc. _______________________________________________ libusb-devel mailing list lib...@li... https://lists.sourceforge.net/lists/listinfo/libusb-devel " |