]> sigrok.org Git - sigrok-util.git/blame - cross-compile/mingw/libusb1_upgrade.patch
sigrok-cross-mingw: move libusb1 manipulation out of "MXE fixes"
[sigrok-util.git] / cross-compile / mingw / libusb1_upgrade.patch
CommitLineData
ca121a83
GS
1The sigrok build references an older libusb1 library version, which
2addresses two specific aspects:
3
4 - Presence of an "event abstraction" is desired. Which once was
5 available as a branch on top of 1.0.20-rc3, but has gone away
6 in the meantime and got archived locally. -- Library versions
7 1.0.24 and above may provide that feature under the common API
8 but are yet to get verified.
9
10 - For performance reasons the RAW_IO feature is enabled. libusb1
11 mainline may provide such an approach later (automatically, after
12 checking more conditions for improved reliability), but does not
13 in versions up to and including 1.0.25 yet.
14
15Manipulation of the libusb1 configuration in the MXE setup avoids the
16necessity for a custom libusb1 build as a step in the sigrok procedure.
17
18Ideally the sigrok build would use libusb1 version 1.0.25+ to benefit
19from the many portability and robustness and feature set improvements.
20Regardless of which libusb1 version ships with mainline MXE. That is
21why this file is called "libusb1_upgrade.patch". Until then it patches
22the local archive of the older library version.
23
24diff --git a/src/libusb1.mk b/src/libusb1.mk
25index ab01bf69..53aed36e 100644
26--- a/src/libusb1.mk
27+++ b/src/libusb1.mk
28@@ -4,11 +4,11 @@ PKG := libusb1
29 $(PKG)_WEBSITE := https://libusb.info/
30 $(PKG)_DESCR := LibUsb-1.0
31 $(PKG)_IGNORE :=
32-$(PKG)_VERSION := 1.0.24
33-$(PKG)_CHECKSUM := 7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a
34-$(PKG)_SUBDIR := libusb-$($(PKG)_VERSION)
35-$(PKG)_FILE := libusb-$($(PKG)_VERSION).tar.bz2
36-$(PKG)_URL := https://$(SOURCEFORGE_MIRROR)/project/libusb/libusb-1.0/libusb-$($(PKG)_VERSION)/$($(PKG)_FILE)
37+$(PKG)_VERSION := 1.0.20-rc3-event-abstraction-v4
38+$(PKG)_CHECKSUM := 58fee7f3f05fda209d14c55763df36ab86028bd9ab82c9bb74f1d5ab3208bcfd
39+$(PKG)_SUBDIR := libusb-event-abstraction-v4
40+$(PKG)_FILE := libusb-event-abstraction-v4.zip
41+$(PKG)_URL := https://github.com/uwehermann/libusb/archive/event-abstraction-v4.zip
42 $(PKG)_DEPS := cc
43
44 define $(PKG)_UPDATE
45@@ -19,7 +19,7 @@ define $(PKG)_UPDATE
46 endef
47
48 define $(PKG)_BUILD
49- cd '$(1)' && ./configure \
50+ cd '$(1)' && autoreconf -i && ./configure \
51 $(MXE_CONFIGURE_OPTS) \
52 CFLAGS=-D_WIN32_WINNT=0x0500
53 $(MAKE) -C '$(1)' -j '$(JOBS)' install
54diff --git a/src/libusb1-1-fixes.patch b/src/libusb1-1-fixes.patch
55new file mode 100644
56index 00000000..6cdeb0c4
57--- /dev/null
58+++ b/src/libusb1-1-fixes.patch
59@@ -0,0 +1,31 @@
60+From d4f7a49d77bd8f4ac871a999fc9ec898cb22b8c3 Mon Sep 17 00:00:00 2001
61+From: Vlad Ivanov <vlad-mbx@ya.ru>
62+Date: Tue, 9 Feb 2016 10:35:23 +0300
63+Subject: [PATCH] windows_usb: enable RAW_IO policy by default
64+
65+libusb should set RAW_IO policy unconditionally because it
66+implements the buffer management itself.
67+
68+Signed-off-by: Vlad Ivanov <vlad-mbx@ya.ru>
69+---
70+ libusb/os/windows_usb.c | 4 ++++
71+ 1 file changed, 4 insertions(+)
72+
73+diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
74+index 6640ad5..12fdab0 100644
75+--- a/libusb/os/windows_usb.c
76++++ b/libusb/os/windows_usb.c
77+@@ -2890,6 +2890,10 @@ static int winusbx_configure_endpoints(int sub_api, struct libusb_device_handle
78+ AUTO_CLEAR_STALL, sizeof(UCHAR), &policy)) {
79+ usbi_dbg("failed to enable AUTO_CLEAR_STALL for endpoint %02X", endpoint_address);
80+ }
81++ if (!WinUSBX[sub_api].SetPipePolicy(winusb_handle, endpoint_address,
82++ RAW_IO, sizeof(UCHAR), &policy)) {
83++ usbi_dbg("failed to enable RAW_IO for endpoint %02X", endpoint_address);
84++ }
85+ }
86+
87+ return LIBUSB_SUCCESS;
88+--
89+2.5.0
90+