summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Sakoman <steve@sakoman.com>2010-03-02 21:47:05 -0800
committerKoen Kooi <koen@openembedded.org>2010-03-05 10:05:08 +0100
commitd9a1554931647437ea79d0e212c59cf2158f0db8 (patch)
treea2985fc11a9f40fed256ba444316f3336b94bd16
parent34c20e2d530c68d47123e554e1e634885e0ae99e (diff)
libusb: add patch to fix "BOGUS urb flags" issue
issue occurs when using gphoto2 to download photos from digital cameras
-rw-r--r--recipes/libusb/files/libusb-shortok.patch32
-rw-r--r--recipes/libusb/libusb1_1.0.4.bb7
2 files changed, 38 insertions, 1 deletions
diff --git a/recipes/libusb/files/libusb-shortok.patch b/recipes/libusb/files/libusb-shortok.patch
new file mode 100644
index 0000000000..4e7831af36
--- /dev/null
+++ b/recipes/libusb/files/libusb-shortok.patch
@@ -0,0 +1,32 @@
+The USBFS_URB_SHORT_NOT_OK flag is valid for IN urbs only. When USB
+debugging is enabled in the linux kernel its usb_submit_urb() function
+will validate and reject OUT urbs where this flag is set.
+
+E.g. you will see something like
+
+ usb 1-1.4: BOGUS urb flags, 1 --> 0
+
+when sending bulk urbs.
+
+This patch sets USBFS_URB_SHORT_NOT_OK only for IN urbs.
+
+
+Index: libusb-1.0.6/libusb/os/linux_usbfs.c
+===================================================================
+--- libusb-1.0.6.orig/libusb/os/linux_usbfs.c
++++ libusb-1.0.6/libusb/os/linux_usbfs.c
+@@ -1360,11 +1360,13 @@ static int submit_bulk_transfer(struct u
+
+ for (i = 0; i < num_urbs; i++) {
+ struct usbfs_urb *urb = &urbs[i];
++ int is_out = ((transfer->endpoint & LIBUSB_ENDPOINT_DIR_MASK)
++ == LIBUSB_ENDPOINT_OUT);
+ urb->usercontext = itransfer;
+ urb->type = urb_type;
+ urb->endpoint = transfer->endpoint;
+ urb->buffer = transfer->buffer + (i * MAX_BULK_BUFFER_LENGTH);
+- if (supports_flag_bulk_continuation)
++ if (supports_flag_bulk_continuation && !is_out)
+ urb->flags = USBFS_URB_SHORT_NOT_OK;
+ if (i == num_urbs - 1 && last_urb_partial)
+ urb->buffer_length = transfer->length % MAX_BULK_BUFFER_LENGTH;
diff --git a/recipes/libusb/libusb1_1.0.4.bb b/recipes/libusb/libusb1_1.0.4.bb
index d2d4937f2c..1e56006ef1 100644
--- a/recipes/libusb/libusb1_1.0.4.bb
+++ b/recipes/libusb/libusb1_1.0.4.bb
@@ -3,7 +3,12 @@ HOMEPAGE = "http://libusb.sf.net"
SECTION = "libs"
LICENSE = "LGPL"
-SRC_URI = "${SOURCEFORGE_MIRROR}/libusb/libusb-${PV}.tar.bz2"
+PR = "r1"
+
+SRC_URI = " \
+ ${SOURCEFORGE_MIRROR}/libusb/libusb-${PV}.tar.bz2 \
+ file://libusb-shortok.patch;patch=1 \
+ "
S = "${WORKDIR}/libusb-${PV}"
inherit autotools