Error Codes Returned By Usb_submit_urb
Contents |
1 Revised: 2000-Dec-05. 2 3 This is the documentation of (hopefully) all possible error codes (and 4 their interpretation) that can be returned from the host controller drivers 5 and from usbcore. 6 7 NOTE: 8 The USB_ST_* codes are deprecated and are only listed for usb_submit_urb error codes compatibility; 9 new software should use only -E* instead! 10 11 12 13
Usb_fill_bulk_urb
************************************************************************** 14 * Error codes returned by usb_submit_urb * 15 ************************************************************************** 16 17 Non-USB-specific: 18 19 USB_ST_NOERROR 20 0 URB usb_submit_urb failed with result submission went fine 21 22 -ENOMEM no memory for allocation of internal structures 23 24 USB-specific: 25 26 -ENODEV specified USB-device or bus doesn't exist 27 28 USB_ST_REQUEST_ERROR 29 -ENXIO a control struct urb or interrupt URB is already queued to this endpoint; or 30 a bulk URB is already queued to this endpoint and 31 USB_QUEUE_BULK wasn't used (UHCI HCDs only) 32 33 USB_ST_URB_INVALID_ERROR 34 -EINVAL a) Invalid transfer type specified (or not supported) 35 b) Invalid interrupt interval (0<=n<256) 36 c) more than one interrupt packet requested 37 d) ISO: number_of_packets is < 0 38 39 -EAGAIN a)
Urb Interrupt In
specified ISO start frame too early 40 b) (using ISO-ASAP) too much scheduled for the future 41 wait some time and try again. 42 43 -EFBIG too much ISO frames requested (currently uhci>900) 44 45 USB_ST_STALL 46 -EPIPE specified pipe-handle is already stalled 47 48 -EMSGSIZE endpoint message size is zero, do interface/alternate setting 49 50 USB_ST_BANDWIDTH_ERROR 51 -ENOSPC The host controller's bandwidth is already consumed and 52 this request would push it past its allowed limit. 53 54 -ESHUTDOWN The host controller has been disabled due to some 55 problem that could not be worked around. 56 57 58 ************************************************************************** 59 * Error codes returned by in urb->status * 60 * or in iso_frame_desc[n].status (for ISO) * 61 ************************************************************************** 62 63 USB_ST_NOERROR 64 0 Transfer completed successfully 65 66 USB_ST_URB_KILLED 67 -ENOENT URB was canceled by usb_unlink_urb 68 69 USB_ST_URB_PENDING 70 -EINPROGRESS URB still pending, no results yet 71 (actually no error until now;-) 72 73 USB_ST_BITSTUFF 74 USB_ST_INTERNALERROR 75 -EPROTO a) bitstuff error 76 b) unknown USB error 77 78 USB_ST_CRC 79 -EILSEQ CRC mismatch 80 81 USB_ST_STALL 82 -EPIPE endpoint stalled 83 84 USB_ST_BUFFEROVERRUN 85 -ECOMM During an IN transfer, t
describing the request mem_flags the type of memory to allocate, see kmalloc for a list of valid options for this. Description This submits a transfer request, and transfers control of the URB describing that request to the USB subsystem. Request completion will be indicated later, asynchronously, by calling the usb urb completion handler. The three types of completion are success, error, and unlink (a software-induced fault, also called "request cancellation"). URBs may be submitted in interrupt context. The caller must have correctly initialized the URB before submitting it. Functions such as usb_fill_bulk_urb and usb_fill_control_urb are available to ensure that most fields are correctly initialized, for the particular kind of transfer, although they will not initialize any transfer http://lxr.free-electrons.com/source/Documentation/usb/error-codes.txt?v=2.4.37 flags. If the submission is successful, the complete callback from the URB will be called exactly once, when the USB core and Host Controller Driver (HCD) are finished with the URB. When the completion function is called, control of the URB is returned to the device driver which issued the request. The completion handler may then immediately free or reuse that URB. With few exceptions, USB device drivers should never access URB fields https://www.kernel.org/doc/htmldocs/usb/API-usb-submit-urb.html provided by usbcore or the HCD until its complete is called. The exceptions relate to periodic transfer scheduling. For both interrupt and isochronous urbs, as part of successful URB submission urb->interval is modified to reflect the actual transfer period used (normally some power of two units). And for isochronous urbs, urb->start_frame is modified to reflect when the URB's transfers were scheduled to start. Not all isochronous transfer scheduling policies will work, but most host controller drivers should easily handle ISO queues going from now until 10-200 msec into the future. Drivers should try to keep at least one or two msec of data in the queue; many controllers require that new transfers start at least 1 msec in the future when they are added. If the driver is unable to keep up and the queue empties out, the behavior for new submissions is governed by the URB_ISO_ASAP flag. If the flag is set, or if the queue is idle, then the URB is always assigned to the first available (and not yet expired) slot in the endpoint's schedule. If the flag is not set and the queue is active then the URB is always assigned to the next slot in the schedule following the end of the endpoint's previous URB, even if that slot is
Orig file: v2.2.17/Documentation/usb/error-codes.txt Orig date: Thu Jan 1 01:00:00 1970 diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/Documentation/usb/error-codes.txt linux/Documentation/usb/error-codes.txt @@ -0,0 +1,108 @@ +$Id: http://ftp.riken.jp/Linux/kernel/v2.2/patch-html/patch-2.2.18/linux_Documentation_usb_error-codes.txt.html README.error-codes,v 1.1 1999/12/14 14:03:02 fliegl Exp $ + +This is the documentation of (hopefully) all possible error codes (and +their interpretation) that can be http://stackoverflow.com/questions/14312988/why-is-my-kernel-module-throwing-broken-pipe-errors-when-i-try-to-write-to-a-d returned from the hostcontroller driver +and from usbcore. + +NOTE: +The USB_ST_* codes are deferred and are only listed for compatibility, new +software error codes should use only -E* instead! + + + +************************************************************************** +* Error codes returned by usb_submit_urb * +************************************************************************** + +Non-USB-specific: + +USB_ST_NOERROR +0 URB submission went fine + +-ENOMEM no memory for allocation of internal structures + +USB-specific: + +-ENODEV specified USB-device or bus doesn't exist + +-ENXIO specified error codes returned endpoint doesn't exist on the device + +USB_ST_URB_INVALID_ERROR +-EINVAL a) Invalid transfer type specified (or not supported) + b) Invalid interrupt interval (0<=n<256) + c) more than one interrupt packet requested + +-EAGAIN a) specified ISO start frame too early + b) (using ISO-ASAP) too much scheduled for the future + wait some time and try again. + +-EFBIG too much ISO frames requested (currently uhci>900) + +-EPIPE specified pipe-handle is already stalled + +-EMSGSIZE endpoint message size is zero, do interface/alternate setting + + +************************************************************************** +* Error codes returned by in urb->status * +* or in iso_frame_desc[n].status (for ISO) * +************************************************************************** + +USB_ST_NOERROR +0 Transfer completed successfully + +USB_ST_URB_KILLED +-ENOENT URB was canceled by unlink_urb + +USB_ST_URB_PENDING +-EINPROGRESS URB still pending, no results yet + (actually no error until now;-) + +USB_ST_BITSTUFF +USB_ST_INTERNALERROR +-EPROTO a) bitstuff error + b) unknown U
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why is my kernel module throwing “broken pipe” errors when I try to write to a device? up vote 3 down vote favorite I am currently in the process of writing a Linux kernel module in C. The module provides an extremely basic driver for a USB light (the device consists of three colored LEDs). I have managed to get the driver to load and unload without problems and also create the device (/dev/wn0, /dev/wn1, etc.). However, I keep getting errors when attempting to write to the device: $ echo "1" >/dev/wn0 bash: echo: write error: Broken pipe The entire code for the module is here. However, the interesting part is the wn_set_color() function: /* Create the data buffer to be sent to the device. */ u8 buf[8] = { red, green, blue, 0, 0, 0, 0x1F, 0x05 }; /* Send the data to the device. */ return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0, 0, 0, 0, buf, 8, 0); For some reason, it returns -32 instead of sending the data to the device. I am completely new to Linux kernel programming so I'm likely doing something silly. If you can shed some light on this at all, it would be greatly appreciated. Edit: here is some further information: lsusb -v output is here the bDescriptorType member of the usb_endpoint_descriptor class contains '5' for the single endpoint exposed by the device (bEndpointAddress is 129 - or 0x81 in hex) here is a screengrab of one of the control URBs sent to the device linux-kernel usb kernel-module share|improve this question edited Jan 15 '13 at 6:33 asked Jan 14 '13 at 3:26 Nathan Osman 23.3k39170281 add a comment| 2 Answers 2 active oldest votes up vote 3 down vote usb_control_msg() eventually calls down to usb_submit_urb(). The Documentation/usb/error-codes.txt file describes the errors that this function can return: -EPIPE The pipe type specified in the URB doesn't match the endpoint's actual type. If usb_submit_urb() succeeded, then usb_control_msg() returns an urb->status value. This lists under EPIPE: -EPIPE (**) Endpoint stalled. For non-control endpoints, reset this status with usb_clear_halt(). (**) This is also one of several co