sigrok-cross-mingw: add libusb RAW_IO patch
authorVlad Ivanov <vlad-mbx@ya.ru>
Tue, 9 Feb 2016 08:11:31 +0000 (11:11 +0300)
committerUwe Hermann <uwe@hermann-uwe.de>
Wed, 17 Feb 2016 09:53:52 +0000 (10:53 +0100)
On Windows, RAW_IO WinUsb pipe policy should be enabled by default:

  https://sourceforge.net/p/libusb/mailman/message/34810484/

This fixes bug #573.

Signed-off-by: Vlad Ivanov <vlad-mbx@ya.ru>
cross-compile/mingw/libusb_raw_io.patch [new file with mode: 0644]
cross-compile/mingw/sigrok-cross-mingw

diff --git a/cross-compile/mingw/libusb_raw_io.patch b/cross-compile/mingw/libusb_raw_io.patch
new file mode 100644 (file)
index 0000000..6cdeb0c
--- /dev/null
@@ -0,0 +1,31 @@
+From d4f7a49d77bd8f4ac871a999fc9ec898cb22b8c3 Mon Sep 17 00:00:00 2001
+From: Vlad Ivanov <vlad-mbx@ya.ru>
+Date: Tue, 9 Feb 2016 10:35:23 +0300
+Subject: [PATCH] windows_usb: enable RAW_IO policy by default
+
+libusb should set RAW_IO policy unconditionally because it
+implements the buffer management itself.
+
+Signed-off-by: Vlad Ivanov <vlad-mbx@ya.ru>
+---
+ libusb/os/windows_usb.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
+index 6640ad5..12fdab0 100644
+--- a/libusb/os/windows_usb.c
++++ b/libusb/os/windows_usb.c
+@@ -2890,6 +2890,10 @@ static int winusbx_configure_endpoints(int sub_api, struct libusb_device_handle
+                       AUTO_CLEAR_STALL, sizeof(UCHAR), &policy)) {
+                       usbi_dbg("failed to enable AUTO_CLEAR_STALL for endpoint %02X", endpoint_address);
+               }
++              if (!WinUSBX[sub_api].SetPipePolicy(winusb_handle, endpoint_address,
++                      RAW_IO, sizeof(UCHAR), &policy)) {
++                      usbi_dbg("failed to enable RAW_IO for endpoint %02X", endpoint_address);
++              }
+       }
+       return LIBUSB_SUCCESS;
+-- 
+2.5.0
+
index 8b30158cf38baa612349e969e850ea6c041f10f0..b324429aa2deb50278c7776495944c8b17899f2b 100755 (executable)
@@ -117,6 +117,7 @@ $WGET http://zadig.akeo.ie/downloads/zadig_xp.exe -O $PREFIX/zadig_xp.exe
 # libusb
 $GIT_CLONE git://github.com/dickens/libusb -b event-abstraction-v4
 cd libusb
+patch -p1 < ../../libusb_raw_io.patch
 ./bootstrap.sh
 ./configure $C $L
 make -j1 $V