Discussion:
[libusb] synchronous bulk_transfer IO error with status -62
David Levy
2017-03-17 14:18:34 UTC
Permalink
Hello,
New user of libusb so I might be missing something important in the usage, but I have an error when trying to use libusb_bulk_transfer to read data from the device.
It gives me LIBUSB_ERROR_IO.
I enabled debug to level 4, and I think the issue is on this line : libusb: debug [reap_for_handle] urb type=3 status=-62 transferred=0
But I cant find any information about what that -62 means.

The code works on win7 64 bits and I have the issue on debian 64 bits.

Here is the usb functions I use before the crash :
libusb_init(&mContext)
libusb_set_debug(mContext, 4);
libusb_get_device_list(mContext,lList)
libusb_get_bus_number( lList[ i ] )
libusb_open( lList[ i ], &mHandle )
libusb_claim_interface( mHandle, 0 )
libusb_free_device_list( lList, true );
libusb_control_transfer( mHandle, aRequestType, aRequest, 0, 0, lBuffer, 500, aTimeout )
libusb_bulk_transfer( mHandle, aEndPoint, ( unsigned char * )aData, aSize, &lLen, mWriteTimeout )
libusb_bulk_transfer(mHandle, aEndPoint | LIBUSB_ENDPOINT_IN, aData, aSize, &lLen, mReadTimeout)

and the debug output :
[ 0.335281] [00000948] libusb: debug [libusb_get_device_list]
[ 0.335299] [00000948] libusb: debug [libusb_open] open 1.3
[ 0.335309] [00000948] libusb: debug [usbi_add_pollfd] add fd 15 events 4
[ 0.335314] [00000948] libusb: debug [libusb_claim_interface] interface 0
[ 0.335327] [00000948] libusb: debug [add_to_flying_list] arm timerfd for timeout in 1000ms (first in line)
[ 0.335357] [00000948] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.335359] [00000948] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[ 0.335437] [0000094d] libusb: debug [linux_udev_event_thread_main] udev event thread entering.
[ 0.346785] [00000948] libusb: debug [handle_events] poll() returned 1
[ 0.346803] [00000948] libusb: debug [reap_for_handle] urb type=2 status=0 transferred=232
[ 0.346806] [00000948] libusb: debug [handle_control_completion] handling completion status 0
[ 0.346808] [00000948] libusb: debug [disarm_timerfd]
[ 0.346810] [00000948] libusb: debug [usbi_handle_transfer_completion] transfer 0x6627f0 has callback 0x7ffff7bce1d0
[ 0.346812] [00000948] libusb: debug [sync_transfer_cb] actual_length=232
[ 0.346907] [00000948] libusb: debug [add_to_flying_list] arm timerfd for timeout in 1000ms (first in line)
[ 0.346929] [00000948] libusb: debug [submit_bulk_transfer] need 1 urbs for new transfer with length 8
[ 0.347013] [00000948] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.347016] [00000948] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[ 0.348967] [00000948] libusb: debug [handle_events] poll() returned 1
[ 0.348992] [00000948] libusb: debug [reap_for_handle] urb type=3 status=0 transferred=8
[ 0.348995] [00000948] libusb: debug [handle_bulk_completion] handling completion status 0 of bulk urb 1/1
[ 0.348997] [00000948] libusb: debug [handle_bulk_completion] last URB in transfer --> complete!
[ 0.348999] [00000948] libusb: debug [disarm_timerfd]
[ 0.349002] [00000948] libusb: debug [usbi_handle_transfer_completion] transfer 0x668fc0 has callback 0x7ffff7bce1d0
[ 0.349003] [00000948] libusb: debug [sync_transfer_cb] actual_length=8

Here I call the libusb_bulk_transfer that crash
[10.693017] [00000948] libusb: debug [add_to_flying_list] arm timerfd for timeout in 1000ms (first in line)
[10.693045] [00000948] libusb: debug [submit_bulk_transfer] need 1 urbs for new transfer with length 16
[10.693109] [00000948] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[10.693115] [00000948] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[10.695124] [00000948] libusb: debug [handle_events] poll() returned 1
[10.695153] [00000948] libusb: debug [reap_for_handle] urb type=3 status=-62 transferred=0
[10.695159] [00000948] libusb: debug [handle_bulk_completion] handling completion status -62 of bulk urb 1/1
[10.695164] [00000948] libusb: debug [handle_bulk_completion] low level error -62
[10.695168] [00000948] libusb: debug [disarm_timerfd]
[10.695174] [00000948] libusb: debug [usbi_handle_transfer_completion] transfer 0x668fc0 has callback 0x7ffff7bce1d0
[10.695179] [00000948] libusb: debug [sync_transfer_cb] actual_length=0


Thanks,
David
Alan Stern
2017-03-17 16:11:25 UTC
Permalink
Post by David Levy
Hello,
New user of libusb so I might be missing something important in the usage, but I have an error when trying to use libusb_bulk_transfer to read data from the device.
It gives me LIBUSB_ERROR_IO.
I enabled debug to level 4, and I think the issue is on this line : libusb: debug [reap_for_handle] urb type=3 status=-62 transferred=0
But I cant find any information about what that -62 means.
-62 is -ETIME (see /usr/include/asm-generic/errno.h). It means that
your transfer timed out -- the timer expired before the transfer was
complete.

Alan Stern
Post by David Levy
The code works on win7 64 bits and I have the issue on debian 64 bits.
libusb_init(&mContext)
libusb_set_debug(mContext, 4);
libusb_get_device_list(mContext,lList)
libusb_get_bus_number( lList[ i ] )
libusb_open( lList[ i ], &mHandle )
libusb_claim_interface( mHandle, 0 )
libusb_free_device_list( lList, true );
libusb_control_transfer( mHandle, aRequestType, aRequest, 0, 0, lBuffer, 500, aTimeout )
libusb_bulk_transfer( mHandle, aEndPoint, ( unsigned char * )aData, aSize, &lLen, mWriteTimeout )
libusb_bulk_transfer(mHandle, aEndPoint | LIBUSB_ENDPOINT_IN, aData, aSize, &lLen, mReadTimeout)
[ 0.335281] [00000948] libusb: debug [libusb_get_device_list]
[ 0.335299] [00000948] libusb: debug [libusb_open] open 1.3
[ 0.335309] [00000948] libusb: debug [usbi_add_pollfd] add fd 15 events 4
[ 0.335314] [00000948] libusb: debug [libusb_claim_interface] interface 0
[ 0.335327] [00000948] libusb: debug [add_to_flying_list] arm timerfd for timeout in 1000ms (first in line)
[ 0.335357] [00000948] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.335359] [00000948] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[ 0.335437] [0000094d] libusb: debug [linux_udev_event_thread_main] udev event thread entering.
[ 0.346785] [00000948] libusb: debug [handle_events] poll() returned 1
[ 0.346803] [00000948] libusb: debug [reap_for_handle] urb type=2 status=0 transferred=232
[ 0.346806] [00000948] libusb: debug [handle_control_completion] handling completion status 0
[ 0.346808] [00000948] libusb: debug [disarm_timerfd]
[ 0.346810] [00000948] libusb: debug [usbi_handle_transfer_completion] transfer 0x6627f0 has callback 0x7ffff7bce1d0
[ 0.346812] [00000948] libusb: debug [sync_transfer_cb] actual_length=232
[ 0.346907] [00000948] libusb: debug [add_to_flying_list] arm timerfd for timeout in 1000ms (first in line)
[ 0.346929] [00000948] libusb: debug [submit_bulk_transfer] need 1 urbs for new transfer with length 8
[ 0.347013] [00000948] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.347016] [00000948] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[ 0.348967] [00000948] libusb: debug [handle_events] poll() returned 1
[ 0.348992] [00000948] libusb: debug [reap_for_handle] urb type=3 status=0 transferred=8
[ 0.348995] [00000948] libusb: debug [handle_bulk_completion] handling completion status 0 of bulk urb 1/1
[ 0.348997] [00000948] libusb: debug [handle_bulk_completion] last URB in transfer --> complete!
[ 0.348999] [00000948] libusb: debug [disarm_timerfd]
[ 0.349002] [00000948] libusb: debug [usbi_handle_transfer_completion] transfer 0x668fc0 has callback 0x7ffff7bce1d0
[ 0.349003] [00000948] libusb: debug [sync_transfer_cb] actual_length=8
Here I call the libusb_bulk_transfer that crash
[10.693017] [00000948] libusb: debug [add_to_flying_list] arm timerfd for timeout in 1000ms (first in line)
[10.693045] [00000948] libusb: debug [submit_bulk_transfer] need 1 urbs for new transfer with length 16
[10.693109] [00000948] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[10.693115] [00000948] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[10.695124] [00000948] libusb: debug [handle_events] poll() returned 1
[10.695153] [00000948] libusb: debug [reap_for_handle] urb type=3 status=-62 transferred=0
[10.695159] [00000948] libusb: debug [handle_bulk_completion] handling completion status -62 of bulk urb 1/1
[10.695164] [00000948] libusb: debug [handle_bulk_completion] low level error -62
[10.695168] [00000948] libusb: debug [disarm_timerfd]
[10.695174] [00000948] libusb: debug [usbi_handle_transfer_completion] transfer 0x668fc0 has callback 0x7ffff7bce1d0
[10.695179] [00000948] libusb: debug [sync_transfer_cb] actual_length=0
Thanks,
David
Chris Dickens
2017-03-17 16:22:05 UTC
Permalink
Post by Alan Stern
-62 is -ETIME (see /usr/include/asm-generic/errno.h). It means that
your transfer timed out -- the timer expired before the transfer was
complete.
But in libusb we are submitting URBs to the kernel, which don't have
timeouts. That's why we use timerfd.

This error must be coming from the host controller, possibly because the
device did not respond to some transaction in a timely manner?

Chris

Alan Stern
2017-03-17 16:21:08 UTC
Permalink
Post by Alan Stern
Post by David Levy
Hello,
New user of libusb so I might be missing something important in the usage, but I have an error when trying to use libusb_bulk_transfer to read data from the device.
It gives me LIBUSB_ERROR_IO.
I enabled debug to level 4, and I think the issue is on this line : libusb: debug [reap_for_handle] urb type=3 status=-62 transferred=0
But I cant find any information about what that -62 means.
-62 is -ETIME (see /usr/include/asm-generic/errno.h). It means that
your transfer timed out -- the timer expired before the transfer was
complete.
Oops, sorry, my mistake. I spoke too quickly; a transfer timing out
is reported with -ETIMEDOUT. Instead, -ETIME means that the device
failed to respond to a packet within the prescribed USB bus turn-around
time. (For example, the device doesn't respond with a handshake packet
within a few microseconds of receiving a data packet from the host
controller.)

This is generally a hardware or firmware error.

Alan Stern
Post by Alan Stern
Alan Stern
Post by David Levy
The code works on win7 64 bits and I have the issue on debian 64 bits.
libusb_init(&mContext)
libusb_set_debug(mContext, 4);
libusb_get_device_list(mContext,lList)
libusb_get_bus_number( lList[ i ] )
libusb_open( lList[ i ], &mHandle )
libusb_claim_interface( mHandle, 0 )
libusb_free_device_list( lList, true );
libusb_control_transfer( mHandle, aRequestType, aRequest, 0, 0, lBuffer, 500, aTimeout )
libusb_bulk_transfer( mHandle, aEndPoint, ( unsigned char * )aData, aSize, &lLen, mWriteTimeout )
libusb_bulk_transfer(mHandle, aEndPoint | LIBUSB_ENDPOINT_IN, aData, aSize, &lLen, mReadTimeout)
[ 0.335281] [00000948] libusb: debug [libusb_get_device_list]
[ 0.335299] [00000948] libusb: debug [libusb_open] open 1.3
[ 0.335309] [00000948] libusb: debug [usbi_add_pollfd] add fd 15 events 4
[ 0.335314] [00000948] libusb: debug [libusb_claim_interface] interface 0
[ 0.335327] [00000948] libusb: debug [add_to_flying_list] arm timerfd for timeout in 1000ms (first in line)
[ 0.335357] [00000948] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.335359] [00000948] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[ 0.335437] [0000094d] libusb: debug [linux_udev_event_thread_main] udev event thread entering.
[ 0.346785] [00000948] libusb: debug [handle_events] poll() returned 1
[ 0.346803] [00000948] libusb: debug [reap_for_handle] urb type=2 status=0 transferred=232
[ 0.346806] [00000948] libusb: debug [handle_control_completion] handling completion status 0
[ 0.346808] [00000948] libusb: debug [disarm_timerfd]
[ 0.346810] [00000948] libusb: debug [usbi_handle_transfer_completion] transfer 0x6627f0 has callback 0x7ffff7bce1d0
[ 0.346812] [00000948] libusb: debug [sync_transfer_cb] actual_length=232
[ 0.346907] [00000948] libusb: debug [add_to_flying_list] arm timerfd for timeout in 1000ms (first in line)
[ 0.346929] [00000948] libusb: debug [submit_bulk_transfer] need 1 urbs for new transfer with length 8
[ 0.347013] [00000948] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.347016] [00000948] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[ 0.348967] [00000948] libusb: debug [handle_events] poll() returned 1
[ 0.348992] [00000948] libusb: debug [reap_for_handle] urb type=3 status=0 transferred=8
[ 0.348995] [00000948] libusb: debug [handle_bulk_completion] handling completion status 0 of bulk urb 1/1
[ 0.348997] [00000948] libusb: debug [handle_bulk_completion] last URB in transfer --> complete!
[ 0.348999] [00000948] libusb: debug [disarm_timerfd]
[ 0.349002] [00000948] libusb: debug [usbi_handle_transfer_completion] transfer 0x668fc0 has callback 0x7ffff7bce1d0
[ 0.349003] [00000948] libusb: debug [sync_transfer_cb] actual_length=8
Here I call the libusb_bulk_transfer that crash
[10.693017] [00000948] libusb: debug [add_to_flying_list] arm timerfd for timeout in 1000ms (first in line)
[10.693045] [00000948] libusb: debug [submit_bulk_transfer] need 1 urbs for new transfer with length 16
[10.693109] [00000948] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[10.693115] [00000948] libusb: debug [handle_events] poll() 4 fds with timeout in 60000ms
[10.695124] [00000948] libusb: debug [handle_events] poll() returned 1
[10.695153] [00000948] libusb: debug [reap_for_handle] urb type=3 status=-62 transferred=0
[10.695159] [00000948] libusb: debug [handle_bulk_completion] handling completion status -62 of bulk urb 1/1
[10.695164] [00000948] libusb: debug [handle_bulk_completion] low level error -62
[10.695168] [00000948] libusb: debug [disarm_timerfd]
[10.695174] [00000948] libusb: debug [usbi_handle_transfer_completion] transfer 0x668fc0 has callback 0x7ffff7bce1d0
[10.695179] [00000948] libusb: debug [sync_transfer_cb] actual_length=0
Thanks,
David
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
libusb-devel mailing list
https://lists.sourceforge.net/lists/listinfo/libusb-devel
Continue reading on narkive:
Search results for '[libusb] synchronous bulk_transfer IO error with status -62' (Questions and Answers)
11
replies
Pl.give me details of Moon?
started 2006-12-30 07:28:13 UTC
astronomy & space
Loading...