| Index: third_party/libusb/windows-build.patch
|
| diff --git a/third_party/libusb/windows-build.patch b/third_party/libusb/windows-build.patch
|
| index d2a478cd7361521f786d38c93d2cb728b43222fd..ef2dc04a0ab1ad79cd615e8aafd1e484fa08c870 100644
|
| --- a/third_party/libusb/windows-build.patch
|
| +++ b/third_party/libusb/windows-build.patch
|
| @@ -1,41 +1,54 @@
|
| diff --git a/libusb/libusb.h b/libusb/libusb.h
|
| -index 58b406f..1d0dd7d 100644
|
| +index e8e1201..15bd0d5 100644
|
| --- a/libusb/libusb.h
|
| +++ b/libusb/libusb.h
|
| -@@ -881,6 +881,12 @@ typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transf
|
| - * completed, the library populates the transfer with the results and passes
|
| - * it back to the user.
|
| - */
|
| -+
|
| -+#if defined(OS_WIN)
|
| +@@ -25,6 +25,12 @@
|
| + #define LIBUSB_H
|
| +
|
| + #ifdef _MSC_VER
|
| ++// Disable warning 4200 for [0].
|
| +#pragma warning(push)
|
| -+#pragma warning(disable:4200)
|
| -+#endif // defined(OS_WIN)
|
| ++#pragma warning(disable: 4200)
|
| ++#endif
|
| +
|
| - struct libusb_transfer {
|
| - /** Handle of the device that this transfer will be submitted to */
|
| - libusb_device_handle *dev_handle;
|
| -@@ -939,6 +945,10 @@ struct libusb_transfer {
|
| - ;
|
| - };
|
| ++#ifdef _MSC_VER
|
| + /* on MS environments, the inline keyword is available in C++ only */
|
| + #if !defined(__cplusplus)
|
| + #define inline __inline
|
| +@@ -1938,4 +1944,8 @@ void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx,
|
| + }
|
| + #endif
|
|
|
| -+#if defined(OS_WIN)
|
| ++#ifdef _MSC_VER
|
| +#pragma warning(pop)
|
| -+#endif // defined(OS_WIN)
|
| ++#endif
|
| +
|
| - /** \ingroup misc
|
| - * Capabilities supported by this instance of libusb. Test if the loaded
|
| - * library supports a given capability by calling
|
| -diff --git a/libusb/os/windows_usb.h b/libusb/os/windows_usb.h
|
| -index ddbd680..7c2fae5 100644
|
| ---- a/libusb/os/windows_usb.h
|
| -+++ b/libusb/os/windows_usb.h
|
| -@@ -101,7 +101,7 @@ const GUID GUID_DEVINTERFACE_USB_DEVICE = { 0xA5DCBF10, 0x6530, 0x11D2, {0x90, 0
|
| - #if !defined(GUID_DEVINTERFACE_USB_HUB)
|
| - const GUID GUID_DEVINTERFACE_USB_HUB = { 0xF18A0E88, 0xC30C, 0x11D0, {0x88, 0x15, 0x00, 0xA0, 0xC9, 0x06, 0xBE, 0xD8} };
|
| #endif
|
| --const GUID GUID_NULL = { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
|
| -+static const GUID GUID_NULL = { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
|
| -
|
| +diff --git a/libusb/os/threads_posix.c b/libusb/os/threads_posix.c
|
| +index 9769f58..46f6db7 100644
|
| +--- a/libusb/os/threads_posix.c
|
| ++++ b/libusb/os/threads_posix.c
|
| +@@ -20,11 +20,6 @@
|
| + */
|
|
|
| - /*
|
| + #if defined(__linux__) || defined(__OpenBSD__)
|
| +-# if defined(__linux__)
|
| +-# define _GNU_SOURCE
|
| +-# else
|
| +-# define _BSD_SOURCE
|
| +-# endif
|
| + # include <unistd.h>
|
| + # include <sys/syscall.h>
|
| + #elif defined(__APPLE__)
|
| +diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
|
| +index 63357b1..51ce55d 100644
|
| +--- a/libusb/os/windows_usb.c
|
| ++++ b/libusb/os/windows_usb.c
|
| +@@ -2142,6 +2142,7 @@ static int windows_handle_events(struct libusb_context *ctx, struct pollfd *fds,
|
| + windows_handle_callback(transfer, io_result, io_size);
|
| + } else {
|
| + usbi_err(ctx, "could not find a matching transfer for fd %x", fds[i]);
|
| ++ usbi_mutex_unlock(&ctx->open_devs_lock);
|
| + return LIBUSB_ERROR_NOT_FOUND;
|
| + }
|
| + }
|
|
|