diff options
| author | 2009-09-20 19:18:15 +0200 | |
|---|---|---|
| committer | 2009-10-03 17:16:24 +0200 | |
| commit | 8ea6dc804457d3ad02b5bc2017007f965359d8c5 (patch) | |
| tree | fb08beb66949691bc6fddb56c2de1a0d0d377f74 /contrib/libusb-New-flag-LIBUSB_TRANSFER_ZERO_PACKET.patch | |
| parent | e619fc9e4d90c9e86d1e05fe37ad6fbf284d6de8 (diff) | |
| download | usbmuxd-8ea6dc804457d3ad02b5bc2017007f965359d8c5.tar.gz usbmuxd-8ea6dc804457d3ad02b5bc2017007f965359d8c5.tar.bz2 | |
Require libusb-1.0.3 and hardcode explicit ZLP logic
1.0.3 has the 0-byte transaction fix. The saga
continues on the libusb trac. Whenever they add the
ZLP flag we can get rid of the 0-byte logic and just
set it.
Diffstat (limited to 'contrib/libusb-New-flag-LIBUSB_TRANSFER_ZERO_PACKET.patch')
| -rw-r--r-- | contrib/libusb-New-flag-LIBUSB_TRANSFER_ZERO_PACKET.patch | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/contrib/libusb-New-flag-LIBUSB_TRANSFER_ZERO_PACKET.patch b/contrib/libusb-New-flag-LIBUSB_TRANSFER_ZERO_PACKET.patch deleted file mode 100644 index 84d8a0a..0000000 --- a/contrib/libusb-New-flag-LIBUSB_TRANSFER_ZERO_PACKET.patch +++ /dev/null | |||
| @@ -1,72 +0,0 @@ | |||
| 1 | From 13123672fc1edb1e8ce52f60eef045e3c901e5d6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nikias Bassen <nikias@gmx.li> | ||
| 3 | Date: Sat, 5 Sep 2009 15:42:01 +0200 | ||
| 4 | Subject: [PATCH] New flag LIBUSB_TRANSFER_ZERO_PACKET for bulk/interrupt transfers. | ||
| 5 | |||
| 6 | This flag will let the kernel append an additional zero-length packet | ||
| 7 | to a tansfer. This is required for certain devices when sending packets | ||
| 8 | with a size that is a multiple of wMaxPacketSize. | ||
| 9 | --- | ||
| 10 | libusb/libusb.h | 18 +++++++++++++++++- | ||
| 11 | libusb/os/linux_usbfs.c | 3 +++ | ||
| 12 | libusb/os/linux_usbfs.h | 1 + | ||
| 13 | 3 files changed, 21 insertions(+), 1 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/libusb/libusb.h b/libusb/libusb.h | ||
| 16 | index 1126380..bf7f02d 100644 | ||
| 17 | --- a/libusb/libusb.h | ||
| 18 | +++ b/libusb/libusb.h | ||
| 19 | @@ -672,7 +672,23 @@ enum libusb_transfer_flags { | ||
| 20 | * If this flag is set, it is illegal to call libusb_free_transfer() | ||
| 21 | * from your transfer callback, as this will result in a double-free | ||
| 22 | * when this flag is acted upon. */ | ||
| 23 | - LIBUSB_TRANSFER_FREE_TRANSFER = 1<<2 | ||
| 24 | + LIBUSB_TRANSFER_FREE_TRANSFER = 1<<2, | ||
| 25 | + | ||
| 26 | + /** If this flag is set, a zero-length packet will be appended to | ||
| 27 | + * the transfer indicating that the transfer is complete. | ||
| 28 | + * Some devices require to be notified when a transfer is complete. | ||
| 29 | + * Usually a device knows about the end of the transfer if the last | ||
| 30 | + * packet's size is less than wMaxPacketSize. | ||
| 31 | + * But if the last packet of a transfer has _exactly_ the size of | ||
| 32 | + * wMaxPacketSize, the device does not know that it is the last | ||
| 33 | + * packet. This is where a zero-length packet is required, which | ||
| 34 | + * will let the device know that the transfer is complete. | ||
| 35 | + * | ||
| 36 | + * This flag is valid for the following transfer types: | ||
| 37 | + * LIBUSB_TRANSFER_TYPE_BULK | ||
| 38 | + * LIBUSB_TRANSFER_TYPE_INTERRUPT | ||
| 39 | + */ | ||
| 40 | + LIBUSB_TRANSFER_ZERO_PACKET = 1<<3 | ||
| 41 | }; | ||
| 42 | |||
| 43 | /** \ingroup asyncio | ||
| 44 | diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c | ||
| 45 | index 1280188..816bcbf 100644 | ||
| 46 | --- a/libusb/os/linux_usbfs.c | ||
| 47 | +++ b/libusb/os/linux_usbfs.c | ||
| 48 | @@ -1307,6 +1307,9 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer, | ||
| 49 | else | ||
| 50 | urb->buffer_length = MAX_BULK_BUFFER_LENGTH; | ||
| 51 | |||
| 52 | + if (i == num_urbs -1 && (transfer->flags & LIBUSB_TRANSFER_ZERO_PACKET)) | ||
| 53 | + urb->flags |= USBFS_URB_ZERO_PACKET; | ||
| 54 | + | ||
| 55 | r = ioctl(dpriv->fd, IOCTL_USBFS_SUBMITURB, urb); | ||
| 56 | if (r < 0) { | ||
| 57 | int j; | ||
| 58 | diff --git a/libusb/os/linux_usbfs.h b/libusb/os/linux_usbfs.h | ||
| 59 | index fdf5e9b..9ed0b4f 100644 | ||
| 60 | --- a/libusb/os/linux_usbfs.h | ||
| 61 | +++ b/libusb/os/linux_usbfs.h | ||
| 62 | @@ -63,6 +63,7 @@ struct usbfs_getdriver { | ||
| 63 | #define USBFS_URB_DISABLE_SPD 1 | ||
| 64 | #define USBFS_URB_ISO_ASAP 2 | ||
| 65 | #define USBFS_URB_QUEUE_BULK 0x10 | ||
| 66 | +#define USBFS_URB_ZERO_PACKET 0x40 | ||
| 67 | |||
| 68 | enum usbfs_urb_type { | ||
| 69 | USBFS_URB_TYPE_ISO = 0, | ||
| 70 | -- | ||
| 71 | 1.6.0.4 | ||
| 72 | |||
