]>
Commit | Line | Data |
---|---|---|
c6f2b1ae GS |
1 | The sigrok project build references a libusb feature which is not yet |
2 | available in mainline libusb1, enabling the RAW_IO policy by default | |
3 | to improve performance on Windows. And applies an autotools fix to the | |
4 | mainline MXE build rules. | |
ca121a83 | 5 | |
c6f2b1ae GS |
6 | See the libusb pull request https://github.com/libusb/libusb/pull/1069 |
7 | for a discussion of the RAW_IO policy tweak. | |
ca121a83 GS |
8 | |
9 | Manipulation of the libusb1 configuration in the MXE setup avoids the | |
10 | necessity for a custom libusb1 build as a step in the sigrok procedure. | |
c6f2b1ae GS |
11 | When the MXE modification is considered undesirable, then the sigrok |
12 | build script or the manual sequence of building needs to get adjusted | |
13 | to include a local libusb1 build which then gets referenced in the | |
14 | configure step. | |
ca121a83 | 15 | |
6056da9c GS |
16 | |
17 | diff --git a/src/libusb1.mk b/src/libusb1.mk | |
18 | index ab01bf69..53aed36e 100644 | |
19 | --- a/src/libusb1.mk | |
20 | +++ b/src/libusb1.mk | |
21 | @@ -19,7 +19,7 @@ define $(PKG)_UPDATE | |
22 | endef | |
23 | ||
24 | define $(PKG)_BUILD | |
25 | - cd '$(1)' && ./configure \ | |
26 | + cd '$(1)' && autoreconf -i && ./configure \ | |
177ed39a | 27 | $(MXE_CONFIGURE_OPTS) |
6056da9c | 28 | $(MAKE) -C '$(1)' -j '$(JOBS)' install |
177ed39a | 29 | |
6056da9c | 30 | |
ca121a83 GS |
31 | diff --git a/src/libusb1-1-fixes.patch b/src/libusb1-1-fixes.patch |
32 | new file mode 100644 | |
33 | index 00000000..6cdeb0c4 | |
34 | --- /dev/null | |
35 | +++ b/src/libusb1-1-fixes.patch | |
36 | @@ -0,0 +1,31 @@ | |
93d3af66 GS |
37 | +commit f341e4a086edd4f45c2db4df892a52ebfd52ac5b |
38 | +Author: Petteri Aimonen <jpa@git.mail.kapsi.fi> | |
39 | +AuthorDate: 2022-02-11 12:08:01 +0200 | |
40 | +Commit: Petteri Aimonen <jpa@git.mail.kapsi.fi> | |
41 | +CommitDate: 2022-02-11 12:08:01 +0200 | |
ca121a83 | 42 | + |
93d3af66 | 43 | + WinUSB: Use RAW_IO when transfer size is divisible by 512 bytes |
ca121a83 | 44 | +--- |
93d3af66 GS |
45 | + libusb/os/windows_winusb.c | 9 +++++++++ |
46 | + 1 file changed, 9 insertions(+) | |
ca121a83 | 47 | + |
93d3af66 GS |
48 | +diff --git a/libusb/os/windows_winusb.c b/libusb/os/windows_winusb.c |
49 | +index a03d6a51216a..a0ac0c609e99 100644 | |
50 | +--- a/libusb/os/windows_winusb.c | |
51 | ++++ b/libusb/os/windows_winusb.c | |
52 | +@@ -3086,6 +3086,15 @@ static int winusbx_submit_bulk_transfer(int sub_api, struct usbi_transfer *itran | |
53 | + set_transfer_priv_handle(itransfer, handle_priv->interface_handle[current_interface].dev_handle); | |
54 | + overlapped = get_transfer_priv_overlapped(itransfer); | |
ca121a83 | 55 | + |
93d3af66 GS |
56 | ++ if (sub_api == SUB_API_WINUSB) |
57 | ++ { | |
58 | ++ // Use RAW_IO when transfer size is divisible by 512 bytes. | |
59 | ++ UCHAR policy = (transfer->length % 512 == 0); | |
60 | ++ if (!WinUSBX[sub_api].SetPipePolicy(winusb_handle, transfer->endpoint, RAW_IO, sizeof(UCHAR), &policy)) { | |
61 | ++ usbi_err(TRANSFER_CTX(transfer), "failed to set RAW_IO for endpoint %02X", transfer->endpoint); | |
62 | ++ } | |
63 | ++ } | |
64 | ++ | |
65 | + if (IS_XFERIN(transfer)) { | |
66 | + usbi_dbg(TRANSFER_CTX(transfer), "reading %d bytes", transfer->length); | |
67 | + ret = WinUSBX[sub_api].ReadPipe(winusb_handle, transfer->endpoint, transfer->buffer, transfer->length, NULL, overlapped); |