| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | -ENOENT		specified interface or endpoint does not exist or | 
|  | 27 | is not enabled | 
|  | 28 |  | 
|  | 29 | -ENXIO		host controller driver does not support queuing of this type | 
|  | 30 | of urb.  (treat as a host controller bug.) | 
|  | 31 |  | 
|  | 32 | -EINVAL		a) Invalid transfer type specified (or not supported) | 
|  | 33 | b) Invalid or unsupported periodic transfer interval | 
|  | 34 | c) ISO: attempted to change transfer interval | 
|  | 35 | d) ISO: number_of_packets is < 0 | 
|  | 36 | e) various other cases | 
|  | 37 |  | 
|  | 38 | -EAGAIN		a) specified ISO start frame too early | 
|  | 39 | b) (using ISO-ASAP) too much scheduled for the future | 
|  | 40 | wait some time and try again. | 
|  | 41 |  | 
|  | 42 | -EFBIG		Host controller driver can't schedule that many ISO frames. | 
|  | 43 |  | 
| Alan Stern | f661c6f | 2009-12-11 16:20:20 -0500 | [diff] [blame] | 44 | -EPIPE		The pipe type specified in the URB doesn't match the | 
|  | 45 | endpoint's actual type. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 |  | 
|  | 47 | -EMSGSIZE	(a) endpoint maxpacket size is zero; it is not usable | 
|  | 48 | in the current interface altsetting. | 
| Alan Stern | 620948a | 2005-11-28 15:22:55 -0500 | [diff] [blame] | 49 | (b) ISO packet is larger than the endpoint maxpacket. | 
|  | 50 | (c) requested data transfer length is invalid: negative | 
|  | 51 | or too large for the host controller. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 |  | 
|  | 53 | -ENOSPC		This request would overcommit the usb bandwidth reserved | 
|  | 54 | for periodic transfers (interrupt, isochronous). | 
|  | 55 |  | 
|  | 56 | -ESHUTDOWN	The device or host controller has been disabled due to some | 
|  | 57 | problem that could not be worked around. | 
|  | 58 |  | 
|  | 59 | -EPERM		Submission failed because urb->reject was set. | 
|  | 60 |  | 
|  | 61 | -EHOSTUNREACH	URB was rejected because the device is suspended. | 
|  | 62 |  | 
| Alan Stern | f661c6f | 2009-12-11 16:20:20 -0500 | [diff] [blame] | 63 | -ENOEXEC	A control URB doesn't contain a Setup packet. | 
|  | 64 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 |  | 
|  | 66 | ************************************************************************** | 
|  | 67 | *                   Error codes returned by in urb->status               * | 
|  | 68 | *                   or in iso_frame_desc[n].status (for ISO)             * | 
|  | 69 | ************************************************************************** | 
|  | 70 |  | 
|  | 71 | USB device drivers may only test urb status values in completion handlers. | 
|  | 72 | This is because otherwise there would be a race between HCDs updating | 
|  | 73 | these values on one CPU, and device drivers testing them on another CPU. | 
|  | 74 |  | 
|  | 75 | A transfer's actual_length may be positive even when an error has been | 
|  | 76 | reported.  That's because transfers often involve several packets, so that | 
|  | 77 | one or more packets could finish before an error stops further endpoint I/O. | 
|  | 78 |  | 
| Sarah Sharp | a9e7586 | 2011-06-16 13:06:04 -0700 | [diff] [blame] | 79 | For isochronous URBs, the urb status value is non-zero only if the URB is | 
|  | 80 | unlinked, the device is removed, the host controller is disabled, or the total | 
|  | 81 | transferred length is less than the requested length and the URB_SHORT_NOT_OK | 
|  | 82 | flag is set.  Completion handlers for isochronous URBs should only see | 
|  | 83 | urb->status set to zero, -ENOENT, -ECONNRESET, -ESHUTDOWN, or -EREMOTEIO. | 
|  | 84 | Individual frame descriptor status fields may report more status codes. | 
|  | 85 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 |  | 
|  | 87 | 0			Transfer completed successfully | 
|  | 88 |  | 
|  | 89 | -ENOENT			URB was synchronously unlinked by usb_unlink_urb | 
|  | 90 |  | 
|  | 91 | -EINPROGRESS		URB still pending, no results yet | 
|  | 92 | (That is, if drivers see this it's a bug.) | 
|  | 93 |  | 
|  | 94 | -EPROTO (*, **)		a) bitstuff error | 
|  | 95 | b) no response packet received within the | 
|  | 96 | prescribed bus turn-around time | 
|  | 97 | c) unknown USB error | 
|  | 98 |  | 
|  | 99 | -EILSEQ (*, **)		a) CRC mismatch | 
|  | 100 | b) no response packet received within the | 
|  | 101 | prescribed bus turn-around time | 
|  | 102 | c) unknown USB error | 
|  | 103 |  | 
|  | 104 | Note that often the controller hardware does not | 
|  | 105 | distinguish among cases a), b), and c), so a | 
|  | 106 | driver cannot tell whether there was a protocol | 
|  | 107 | error, a failure to respond (often caused by | 
|  | 108 | device disconnect), or some other fault. | 
|  | 109 |  | 
| Pete Zaitcev | 38e2bfc | 2006-09-18 22:49:02 -0700 | [diff] [blame] | 110 | -ETIME (**)		No response packet received within the prescribed | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | bus turn-around time.  This error may instead be | 
|  | 112 | reported as -EPROTO or -EILSEQ. | 
|  | 113 |  | 
| Pete Zaitcev | 38e2bfc | 2006-09-18 22:49:02 -0700 | [diff] [blame] | 114 | -ETIMEDOUT		Synchronous USB message functions use this code | 
|  | 115 | to indicate timeout expired before the transfer | 
|  | 116 | completed, and no other error was reported by HC. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 |  | 
|  | 118 | -EPIPE (**)		Endpoint stalled.  For non-control endpoints, | 
|  | 119 | reset this status with usb_clear_halt(). | 
|  | 120 |  | 
|  | 121 | -ECOMM			During an IN transfer, the host controller | 
|  | 122 | received data from an endpoint faster than it | 
|  | 123 | could be written to system memory | 
|  | 124 |  | 
|  | 125 | -ENOSR			During an OUT transfer, the host controller | 
|  | 126 | could not retrieve data from system memory fast | 
|  | 127 | enough to keep up with the USB data rate | 
|  | 128 |  | 
|  | 129 | -EOVERFLOW (*)		The amount of data returned by the endpoint was | 
|  | 130 | greater than either the max packet size of the | 
|  | 131 | endpoint or the remaining buffer size.  "Babble". | 
|  | 132 |  | 
|  | 133 | -EREMOTEIO		The data read from the endpoint did not fill the | 
|  | 134 | specified buffer, and URB_SHORT_NOT_OK was set in | 
|  | 135 | urb->transfer_flags. | 
|  | 136 |  | 
|  | 137 | -ENODEV			Device was removed.  Often preceded by a burst of | 
| Matt LaPlante | fff9289 | 2006-10-03 22:47:42 +0200 | [diff] [blame] | 138 | other errors, since the hub driver doesn't detect | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | device removal events immediately. | 
|  | 140 |  | 
|  | 141 | -EXDEV			ISO transfer only partially completed | 
| Sarah Sharp | a9e7586 | 2011-06-16 13:06:04 -0700 | [diff] [blame] | 142 | (only set in iso_frame_desc[n].status, not urb->status) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 |  | 
|  | 144 | -EINVAL			ISO madness, if this happens: Log off and go home | 
|  | 145 |  | 
|  | 146 | -ECONNRESET		URB was asynchronously unlinked by usb_unlink_urb | 
|  | 147 |  | 
|  | 148 | -ESHUTDOWN		The device or host controller has been disabled due | 
|  | 149 | to some problem that could not be worked around, | 
|  | 150 | such as a physical disconnect. | 
|  | 151 |  | 
|  | 152 |  | 
|  | 153 | (*) Error codes like -EPROTO, -EILSEQ and -EOVERFLOW normally indicate | 
|  | 154 | hardware problems such as bad devices (including firmware) or cables. | 
|  | 155 |  | 
|  | 156 | (**) This is also one of several codes that different kinds of host | 
| Paolo Ornati | 670e9f3 | 2006-10-03 22:57:56 +0200 | [diff] [blame] | 157 | controller use to indicate a transfer has failed because of device | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | disconnect.  In the interval before the hub driver starts disconnect | 
|  | 159 | processing, devices may receive such fault reports for every request. | 
|  | 160 |  | 
|  | 161 |  | 
|  | 162 |  | 
|  | 163 | ************************************************************************** | 
|  | 164 | *              Error codes returned by usbcore-functions                 * | 
|  | 165 | *           (expect also other submit and transfer status codes)         * | 
|  | 166 | ************************************************************************** | 
|  | 167 |  | 
|  | 168 | usb_register(): | 
|  | 169 | -EINVAL			error during registering new driver | 
|  | 170 |  | 
|  | 171 | usb_get_*/usb_set_*(): | 
|  | 172 | usb_control_msg(): | 
|  | 173 | usb_bulk_msg(): | 
|  | 174 | -ETIMEDOUT		Timeout expired before the transfer completed. |