USB Error codes¶
- Revised
2004-Oct-21
This is the documentation of (hopefully) all possible error codes (and their interpretation) that can be returned from usbcore.
Some of them are returned by the Host Controller Drivers (HCDs), which device drivers only see through usbcore. As a rule, all the HCDs should behave the same except for transfer speed dependent behaviors and the way certain faults are reported.
Error codes returned by usb_submit_urb()
¶
Non-USB-specific:
0 |
URB submission went fine |
|
no memory for allocation of internal structures |
USB-specific:
|
The URB is already active. |
|
specified USB-device or bus doesn't exist |
|
specified interface or endpoint does not exist or is not enabled |
|
host controller driver does not support queuing of this type of urb. (treat as a host controller bug.) |
|
|
|
ISO: |
|
Host controller driver can't schedule that many ISO frames. |
|
The pipe type specified in the URB doesn't match the endpoint's actual type. |
|
|
|
The wLength value in a control URB's setup packet does not match the URB's transfer_buffer_length. |
|
This request would overcommit the usb bandwidth reserved for periodic transfers (interrupt, isochronous). |
|
The device or host controller has been disabled due to some problem that could not be worked around. |
|
Submission failed because |
|
URB was rejected because the device is suspended. |
|
A control URB doesn't contain a Setup packet. |
Error codes returned by in urb->status
or in iso_frame_desc[n].status
(for ISO)¶
USB device drivers may only test urb status values in completion handlers. This is because otherwise there would be a race between HCDs updating these values on one CPU, and device drivers testing them on another CPU.
A transfer's actual_length may be positive even when an error has been reported. That's because transfers often involve several packets, so that one or more packets could finish before an error stops further endpoint I/O.
For isochronous URBs, the urb status value is non-zero only if the URB is
unlinked, the device is removed, the host controller is disabled, or the total
transferred length is less than the requested length and the
URB_SHORT_NOT_OK
flag is set. Completion handlers for isochronous URBs
should only see urb->status
set to zero, -ENOENT
, -ECONNRESET
,
-ESHUTDOWN
, or -EREMOTEIO
. Individual frame descriptor status fields
may report more status codes.
0 |
Transfer completed successfully |
|
URB was synchronously unlinked by
|
|
URB still pending, no results yet (That is, if drivers see this it's a bug.) |
|
|
Note that often the controller hardware does not distinguish among cases a), b), and c), so a driver cannot tell whether there was a protocol error, a failure to respond (often caused by device disconnect), or some other fault. |
|
|
No response packet received within the
prescribed bus turn-around time. This error
may instead be reported as
|
|
Synchronous USB message functions use this code to indicate timeout expired before the transfer completed, and no other error was reported by HC. |
|
Endpoint stalled. For non-control endpoints,
reset this status with
|
|
During an IN transfer, the host controller received data from an endpoint faster than it could be written to system memory |
|
During an OUT transfer, the host controller could not retrieve data from system memory fast enough to keep up with the USB data rate |
|
The amount of data returned by the endpoint was greater than either the max packet size of the endpoint or the remaining buffer size. "Babble". |
|
The data read from the endpoint did not fill
the specified buffer, and |
|
Device was removed. Often preceded by a burst of other errors, since the hub driver doesn't detect device removal events immediately. |
|
ISO transfer only partially completed
(only set in |
|
ISO madness, if this happens: Log off and go home |
|
URB was asynchronously unlinked by
|
|
The device or host controller has been disabled due to some problem that could not be worked around, such as a physical disconnect. |
- 1(1,2,3)
Error codes like
-EPROTO
,-EILSEQ
and-EOVERFLOW
normally indicate hardware problems such as bad devices (including firmware) or cables.- 2(1,2,3,4)
This is also one of several codes that different kinds of host controller use to indicate a transfer has failed because of device disconnect. In the interval before the hub driver starts disconnect processing, devices may receive such fault reports for every request.
Error codes returned by usbcore-functions¶
Note
expect also other submit and transfer status codes
usb_register()
:
|
error during registering new driver |
usb_get_*/usb_set_*()
,
usb_control_msg()
,
usb_bulk_msg()
:
|
Timeout expired before the transfer completed. |