blob: 9c11a0fd16cb744801e6e21d85a3f00582145811 [file] [log] [blame]
Mauro Carvalho Chehab360a7b52017-04-05 10:23:07 -03001USB Error codes
2~~~~~~~~~~~~~~~
3
4:Revised: 2004-Oct-21
5
6This is the documentation of (hopefully) all possible error codes (and
7their interpretation) that can be returned from usbcore.
8
9Some of them are returned by the Host Controller Drivers (HCDs), which
10device drivers only see through usbcore. As a rule, all the HCDs should
11behave the same except for transfer speed dependent behaviors and the
12way certain faults are reported.
13
14
15Error codes returned by :c:func:`usb_submit_urb`
16================================================
17
18Non-USB-specific:
19
20
21=============== ===============================================
220 URB submission went fine
23
24``-ENOMEM`` no memory for allocation of internal structures
25=============== ===============================================
26
27USB-specific:
28
29======================= =======================================================
30``-EBUSY`` The URB is already active.
31
32``-ENODEV`` specified USB-device or bus doesn't exist
33
34``-ENOENT`` specified interface or endpoint does not exist or
35 is not enabled
36
37``-ENXIO`` host controller driver does not support queuing of
38 this type of urb. (treat as a host controller bug.)
39
40``-EINVAL`` a) Invalid transfer type specified (or not supported)
41 b) Invalid or unsupported periodic transfer interval
42 c) ISO: attempted to change transfer interval
43 d) ISO: ``number_of_packets`` is < 0
44 e) various other cases
45
46``-EXDEV`` ISO: ``URB_ISO_ASAP`` wasn't specified and all the
47 frames the URB would be scheduled in have already
48 expired.
49
50``-EFBIG`` Host controller driver can't schedule that many ISO
51 frames.
52
53``-EPIPE`` The pipe type specified in the URB doesn't match the
54 endpoint's actual type.
55
56``-EMSGSIZE`` (a) endpoint maxpacket size is zero; it is not usable
57 in the current interface altsetting.
58 (b) ISO packet is larger than the endpoint maxpacket.
59 (c) requested data transfer length is invalid: negative
60 or too large for the host controller.
61
62``-ENOSPC`` This request would overcommit the usb bandwidth reserved
63 for periodic transfers (interrupt, isochronous).
64
65``-ESHUTDOWN`` The device or host controller has been disabled due to
66 some problem that could not be worked around.
67
68``-EPERM`` Submission failed because ``urb->reject`` was set.
69
70``-EHOSTUNREACH`` URB was rejected because the device is suspended.
71
72``-ENOEXEC`` A control URB doesn't contain a Setup packet.
73======================= =======================================================
74
75Error codes returned by ``in urb->status`` or in ``iso_frame_desc[n].status`` (for ISO)
76=======================================================================================
77
78USB device drivers may only test urb status values in completion handlers.
79This is because otherwise there would be a race between HCDs updating
80these values on one CPU, and device drivers testing them on another CPU.
81
82A transfer's actual_length may be positive even when an error has been
83reported. That's because transfers often involve several packets, so that
84one or more packets could finish before an error stops further endpoint I/O.
85
86For isochronous URBs, the urb status value is non-zero only if the URB is
87unlinked, the device is removed, the host controller is disabled, or the total
88transferred length is less than the requested length and the
89``URB_SHORT_NOT_OK`` flag is set. Completion handlers for isochronous URBs
90should only see ``urb->status`` set to zero, ``-ENOENT``, ``-ECONNRESET``,
91``-ESHUTDOWN``, or ``-EREMOTEIO``. Individual frame descriptor status fields
92may report more status codes.
93
94
95=============================== ===============================================
960 Transfer completed successfully
97
98``-ENOENT`` URB was synchronously unlinked by
99 :c:func:`usb_unlink_urb`
100
101``-EINPROGRESS`` URB still pending, no results yet
102 (That is, if drivers see this it's a bug.)
103
104``-EPROTO`` [#f1]_, [#f2]_ a) bitstuff error
105 b) no response packet received within the
106 prescribed bus turn-around time
107 c) unknown USB error
108
109``-EILSEQ`` [#f1]_, [#f2]_ a) CRC mismatch
110 b) no response packet received within the
111 prescribed bus turn-around time
112 c) unknown USB error
113
114 Note that often the controller hardware does
115 not distinguish among cases a), b), and c), so
116 a driver cannot tell whether there was a
117 protocol error, a failure to respond (often
118 caused by device disconnect), or some other
119 fault.
120
121``-ETIME`` [#f2]_ No response packet received within the
122 prescribed bus turn-around time. This error
123 may instead be reported as
124 ``-EPROTO`` or ``-EILSEQ``.
125
126``-ETIMEDOUT`` Synchronous USB message functions use this code
127 to indicate timeout expired before the transfer
128 completed, and no other error was reported
129 by HC.
130
131``-EPIPE`` [#f2]_ Endpoint stalled. For non-control endpoints,
132 reset this status with
133 :c:func:`usb_clear_halt`.
134
135``-ECOMM`` During an IN transfer, the host controller
136 received data from an endpoint faster than it
137 could be written to system memory
138
139``-ENOSR`` During an OUT transfer, the host controller
140 could not retrieve data from system memory fast
141 enough to keep up with the USB data rate
142
143``-EOVERFLOW`` [#f1]_ The amount of data returned by the endpoint was
144 greater than either the max packet size of the
145 endpoint or the remaining buffer size.
146 "Babble".
147
148``-EREMOTEIO`` The data read from the endpoint did not fill
149 the specified buffer, and ``URB_SHORT_NOT_OK``
150 was set in ``urb->transfer_flags``.
151
152``-ENODEV`` Device was removed. Often preceded by a burst
153 of other errors, since the hub driver doesn't
154 detect device removal events immediately.
155
156``-EXDEV`` ISO transfer only partially completed
157 (only set in ``iso_frame_desc[n].status``,
158 not ``urb->status``)
159
160``-EINVAL`` ISO madness, if this happens: Log off and
161 go home
162
163``-ECONNRESET`` URB was asynchronously unlinked by
164 :c:func:`usb_unlink_urb`
165
166``-ESHUTDOWN`` The device or host controller has been
167 disabled due to some problem that could not
168 be worked around, such as a physical
169 disconnect.
170=============================== ===============================================
171
172
173.. [#f1]
174
175 Error codes like ``-EPROTO``, ``-EILSEQ`` and ``-EOVERFLOW`` normally
176 indicate hardware problems such as bad devices (including firmware)
177 or cables.
178
179.. [#f2]
180
181 This is also one of several codes that different kinds of host
182 controller use to indicate a transfer has failed because of device
183 disconnect. In the interval before the hub driver starts disconnect
184 processing, devices may receive such fault reports for every request.
185
186
187
188Error codes returned by usbcore-functions
189=========================================
190
191.. note:: expect also other submit and transfer status codes
192
193:c:func:`usb_register`:
194
195======================= ===================================
196``-EINVAL`` error during registering new driver
197======================= ===================================
198
199``usb_get_*/usb_set_*()``,
200:c:func:`usb_control_msg`,
201:c:func:`usb_bulk_msg()`:
202
203======================= ==============================================
204``-ETIMEDOUT`` Timeout expired before the transfer completed.
205======================= ==============================================