vserver 1.9.5.x5
[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 (*, **)         a) CRC mismatch
87                         b) no response packet received within the
88                            prescribed bus turn-around time
89                         c) unknown USB error 
90
91                         In cases b) and c) either -EPROTO or -EILSEQ
92                         may be returned.  Note that often the controller
93                         hardware does not distinguish among cases a),
94                         b), and c), so a driver cannot tell whether
95                         there was a protocol error, a failure to respond
96                         (often caused by device disconnect), or some
97                         other fault.
98
99 -EPIPE (**)             Endpoint stalled.  For non-control endpoints,
100                         reset this status with usb_clear_halt().
101
102 -ECOMM                  During an IN transfer, the host controller
103                         received data from an endpoint faster than it
104                         could be written to system memory
105
106 -ENOSR                  During an OUT transfer, the host controller
107                         could not retrieve data from system memory fast
108                         enough to keep up with the USB data rate
109
110 -EOVERFLOW (*)          The amount of data returned by the endpoint was
111                         greater than either the max packet size of the
112                         endpoint or the remaining buffer size.  "Babble".
113
114 -EREMOTEIO              The data read from the endpoint did not fill the
115                         specified buffer, and URB_SHORT_NOT_OK was set in
116                         urb->transfer_flags.
117
118 -ENODEV                 Device was removed.  Often preceded by a burst of
119                         other errors, since the hub driver does't detect
120                         device removal events immediately.
121
122 -EXDEV                  ISO transfer only partially completed
123                         look at individual frame status for details
124
125 -EINVAL                 ISO madness, if this happens: Log off and go home
126
127 -ECONNRESET             URB was asynchronously unlinked by usb_unlink_urb
128
129 -ESHUTDOWN              The device or host controller has been disabled due
130                         to some problem that could not be worked around,
131                         such as a physical disconnect.
132
133
134 (*) Error codes like -EPROTO, -EILSEQ and -EOVERFLOW normally indicate
135 hardware problems such as bad devices (including firmware) or cables.
136
137 (**) This is also one of several codes that different kinds of host
138 controller use to to indicate a transfer has failed because of device
139 disconnect.  In the interval before the hub driver starts disconnect
140 processing, devices may receive such fault reports for every request.
141
142
143
144 **************************************************************************
145 *              Error codes returned by usbcore-functions                 *
146 *           (expect also other submit and transfer status codes)         *
147 **************************************************************************
148
149 usb_register():
150 -EINVAL                 error during registering new driver
151
152 usb_get_*/usb_set_*():
153 usb_control_msg():
154 usb_bulk_msg():
155 -ETIMEDOUT              timeout expired before the transfer completed