09754b7d262ae4d9ef79fa5721697e05bf2272c2
[linux-2.6.git] / Documentation / usb / error-codes.txt
1 Revised: 2004-Oct-21
2
3 This is the documentation of (hopefully) all possible error codes (and
4 their interpretation) that can be returned from usbcore.
5
6 Some of them are returned by the Host Controller Drivers (HCDs), which
7 device drivers only see through usbcore.  As a rule, all the HCDs should
8 behave the same except for transfer speed dependent behaviors and the
9 way certain faults are reported.
10
11
12 **************************************************************************
13 *                   Error codes returned by usb_submit_urb               *
14 **************************************************************************
15
16 Non-USB-specific:
17
18 0               URB submission went fine
19
20 -ENOMEM         no memory for allocation of internal structures 
21
22 USB-specific:
23
24 -ENODEV         specified USB-device or bus doesn't exist
25
26 -ENXIO          host controller driver does not support queuing of this type
27                 of urb.  (treat as a host controller bug.)
28
29 -EINVAL         a) Invalid transfer type specified (or not supported)
30                 b) Invalid or unsupported periodic transfer interval
31                 c) ISO: attempted to change transfer interval
32                 d) ISO: number_of_packets is < 0
33                 e) various other cases
34
35 -EAGAIN         a) specified ISO start frame too early
36                 b) (using ISO-ASAP) too much scheduled for the future
37                    wait some time and try again.
38
39 -EFBIG          Host controller driver can't schedule that many ISO frames.
40
41 -EPIPE          Specified endpoint is stalled.  For non-control endpoints,
42                 reset this status with usb_clear_halt().
43
44 -EMSGSIZE       (a) endpoint maxpacket size is zero; it is not usable
45                     in the current interface altsetting.
46                 (b) ISO packet is biger than endpoint maxpacket
47                 (c) requested data transfer size is invalid (negative)
48
49 -ENOSPC         This request would overcommit the usb bandwidth reserved
50                 for periodic transfers (interrupt, isochronous).
51
52 -ESHUTDOWN      The device or host controller has been disabled due to some
53                 problem that could not be worked around.
54
55 -EPERM          Submission failed because urb->reject was set.
56
57 -EHOSTUNREACH   URB was rejected because the device is suspended.
58
59
60 **************************************************************************
61 *                   Error codes returned by in urb->status               *
62 *                   or in iso_frame_desc[n].status (for ISO)             *
63 **************************************************************************
64
65 USB device drivers may only test urb status values in completion handlers.
66 This is because otherwise there would be a race between HCDs updating
67 these values on one CPU, and device drivers testing them on another CPU.
68
69 A transfer's actual_length may be positive even when an error has been
70 reported.  That's because transfers often involve several packets, so that
71 one or more packets could finish before an error stops further endpoint I/O.
72
73
74 0                       Transfer completed successfully
75
76 -ENOENT                 URB was synchronously unlinked by usb_unlink_urb
77
78 -EINPROGRESS            URB still pending, no results yet
79                         (That is, if drivers see this it's a bug.)
80
81 -EPROTO (*, **)         a) bitstuff error
82                         b) no response packet received within the
83                            prescribed bus turn-around time
84                         c) unknown USB error 
85
86 -EILSEQ (*, **)         CRC mismatch
87
88 -EPIPE (**)             Endpoint stalled.  For non-control endpoints,
89                         reset this status with usb_clear_halt().
90
91 -ECOMM                  During an IN transfer, the host controller
92                         received data from an endpoint faster than it
93                         could be written to system memory
94
95 -ENOSR                  During an OUT transfer, the host controller
96                         could not retrieve data from system memory fast
97                         enough to keep up with the USB data rate
98
99 -EOVERFLOW (*)          The amount of data returned by the endpoint was
100                         greater than either the max packet size of the
101                         endpoint or the remaining buffer size.  "Babble".
102
103 -EREMOTEIO              The data read from the endpoint did not fill the
104                         specified buffer, and URB_SHORT_NOT_OK was set in
105                         urb->transfer_flags.
106
107 -ETIMEDOUT (**)         transfer timed out, NAK
108
109 -ENODEV                 Device was removed.  Often preceded by a burst of
110                         other errors, since the hub driver does't detect
111                         device removal events immediately.
112
113 -EXDEV                  ISO transfer only partially completed
114                         look at individual frame status for details
115
116 -EINVAL                 ISO madness, if this happens: Log off and go home
117
118 -ECONNRESET             URB was asynchronously unlinked by usb_unlink_urb
119
120 -ESHUTDOWN              The device or host controller has been disabled due
121                         to some problem that could not be worked around,
122                         such as a physical disconnect.
123
124
125 (*) Error codes like -EPROTO, -EILSEQ and -EOVERFLOW normally indicate
126 hardware problems such as bad devices (including firmware) or cables.
127
128 (**) This is also one of several codes that different kinds of host
129 controller use to to indicate a transfer has failed because of device
130 disconnect.  In the interval before the hub driver starts disconnect
131 processing, devices may receive such fault reports for every request.
132
133
134
135 **************************************************************************
136 *              Error codes returned by usbcore-functions                 *
137 *           (expect also other submit and transfer status codes)         *
138 **************************************************************************
139
140 usb_register():
141 -EINVAL                 error during registering new driver
142
143 usb_get_*/usb_set_*():
144 usb_control_msg():
145 usb_bulk_msg():
146                         All USB errors (submit/status) can occur