Home | History | Annotate | Download | only in os

Lines Matching refs:urb

84 /* Linux 2.6.32 adds support for a bulk continuation URB flag. this basically
101 /* Linux 2.6.31 fixes support for the zero length packet URB flag. This
154 /* submission failed after the first URB, so await cancellation/completion
161 /* completed multi-URB transfer in non-final URB */
391 /* bulk continuation URB flag available from Linux 2.6.32 */
403 /* zero length packet URB flag fixed since Linux 2.6.31 */
1753 struct usbfs_urb *urb;
1757 urb = tpriv->iso_urbs[i];
1759 urb = &tpriv->urbs[i];
1761 if (0 == ioctl(dpriv->fd, IOCTL_USBFS_DISCARDURB, urb))
1765 usbi_dbg("URB not found --> assuming ready to be reaped");
1769 usbi_dbg("Device not found for URB --> assuming ready to be reaped");
1784 struct usbfs_urb *urb = tpriv->iso_urbs[i];
1785 if (!urb)
1787 free(urb);
1815 * submit all urbs at once. it would be simpler to submit one urb at
1847 which end before the last urb will not work reliable! */
1875 struct usbfs_urb *urb = &urbs[i];
1876 urb->usercontext = itransfer;
1879 urb->type = USBFS_URB_TYPE_BULK;
1880 urb->stream_id = 0;
1883 urb->type = USBFS_URB_TYPE_BULK;
1884 urb->stream_id = itransfer->stream_id;
1887 urb->type = USBFS_URB_TYPE_INTERRUPT;
1890 urb->endpoint = transfer->endpoint;
1891 urb->buffer = transfer->buffer + (i * bulk_buffer_len);
1892 /* don't set the short not ok flag for the last URB */
1894 urb->flags = USBFS_URB_SHORT_NOT_OK;
1896 urb->buffer_length = transfer->length % bulk_buffer_len;
1898 urb->buffer_length = 0;
1900 urb->buffer_length = bulk_buffer_len;
1903 urb->flags |= USBFS_URB_BULK_CONTINUATION;
1908 urb->flags |= USBFS_URB_ZERO_PACKET;
1910 r = ioctl(dpriv->fd, IOCTL_USBFS_SUBMITURB, urb);
1920 /* if the first URB submission fails, we can simply free up and
1923 usbi_dbg("first URB failed, easy peasy");
1929 /* if it's not the first URB that failed, the situation is a bit
1938 * - this URB failing may be no error; EREMOTEIO means that
1943 * or success if an earlier URB was completed successfully.
2017 /* allocate + initialize each URB with the correct number of packets */
2019 struct usbfs_urb *urb;
2026 /* swallow up all the packets we can fit into this URB */
2036 /* it can't fit, save it for the next URB */
2041 alloc_size = sizeof(*urb)
2043 urb = calloc(1, alloc_size);
2044 if (!urb) {
2048 urbs[i] = urb;
2054 urb->iso_frame_desc[j].length = packet_len;
2057 urb->usercontext = itransfer;
2058 urb->type = USBFS_URB_TYPE_ISO;
2060 urb->flags = USBFS_URB_ISO_ASAP;
2061 urb->endpoint = transfer->endpoint;
2062 urb->number_of_packets = urb_packet_offset;
2063 urb->buffer = urb_buffer_orig;
2082 /* if the first URB submission fails, we can simply free up and
2085 usbi_dbg("first URB failed, easy peasy");
2090 /* if it's not the first URB that failed, the situation is a bit
2126 struct usbfs_urb *urb;
2132 urb = calloc(1, sizeof(struct usbfs_urb));
2133 if (!urb)
2135 tpriv->urbs = urb;
2139 urb->usercontext = itransfer;
2140 urb->type = USBFS_URB_TYPE_CONTROL;
2141 urb->endpoint = transfer->endpoint;
2142 urb->buffer = transfer->buffer;
2143 urb->buffer_length = transfer->length;
2145 r = ioctl(dpriv->fd, IOCTL_USBFS_SUBMITURB, urb);
2147 free(urb);
2238 struct usbfs_urb *urb)
2242 int urb_idx = urb - tpriv->urbs;
2245 usbi_dbg("handling completion status %d of bulk urb %d/%d", urb->status,
2252 usbi_dbg("abnormal reap: urb status %d", urb->status);
2258 * URB, a few of them might complete. so we get back a successful
2260 * 2. we receive a short URB which marks the early completion condition,
2262 * slow and another URB completes (or at least completes partially).
2270 if (urb->actual_length > 0) {
2272 usbi_dbg("received %d bytes of surplus data", urb->actual_length);
2273 if (urb->buffer != target) {
2275 (unsigned char *) urb->buffer - transfer->buffer,
2277 memmove(target, urb->buffer, urb->actual_length);
2279 itransfer->transferred += urb->actual_length;
2283 usbi_dbg("abnormal reap: last URB handled, reporting");
2292 itransfer->transferred += urb->actual_length;
2294 /* Many of these errors can occur on *any* urb of a multi-urb
2297 switch (urb->status) {
2316 /* overflow can only ever occur in the last urb */
2317 usbi_dbg("overflow, actual_length=%d", urb->actual_length);
2326 usbi_dbg("low level error %d", urb->status);
2331 "unrecognised urb status %d", urb->status);
2336 /* if we're the last urb or we got less data than requested then we're
2339 usbi_dbg("last URB in transfer --> complete!");
2341 } else if (urb->actual_length < urb->buffer_length) {
2343 urb->actual_length, urb->buffer_length);
2374 struct usbfs_urb *urb)
2386 if (urb == tpriv->iso_urbs[i]) {
2392 usbi_err(TRANSFER_CTX(transfer), "could not locate urb!");
2397 usbi_dbg("handling completion status %d of iso urb %d/%d", urb->status,
2402 for (i = 0; i < urb->number_of_packets; i++) {
2403 struct usbfs_iso_packet_desc *urb_desc = &urb->iso_frame_desc[i];
2437 "unrecognised urb status %d", urb_desc->status);
2447 usbi_dbg("CANCEL: urb status %d", urb->status);
2450 usbi_dbg("CANCEL: last URB handled, reporting");
2464 switch (urb->status) {
2476 "unrecognised urb status %d", urb->status);
2481 /* if we're the last urb then we're done */
2483 usbi_dbg("last URB in transfer --> complete!");
2495 struct usbfs_urb *urb)
2501 usbi_dbg("handling completion status %d", urb->status);
2503 itransfer->transferred += urb->actual_length;
2506 if (urb->status != 0 && urb->status != -ENOENT)
2508 "cancel: unrecognised urb status %d", urb->status);
2515 switch (urb->status) {
2545 "unrecognised urb status %d", urb->status);
2560 struct usbfs_urb *urb;
2564 r = ioctl(hpriv->fd, IOCTL_USBFS_REAPURBNDELAY, &urb);
2576 itransfer = urb->usercontext;
2579 usbi_dbg("urb type=%d status=%d transferred=%d", urb->type, urb->status,
2580 urb->actual_length);
2584 return handle_iso_completion(itransfer, urb);
2588 return handle_bulk_completion(itransfer, urb);
2590 return handle_control_completion(itransfer, urb);