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