Browse Source

build: update USB dependencies

pull/3855/head
osy 3 years ago
parent
commit
3a13d2f5c9
  1. 1016
      patches/libusb-1.0.24.patch
  2. 68
      patches/libusb-1.0.25.patch
  3. 4
      patches/sources
  4. 35
      patches/usbredir-0.8.0.patch
  5. 2
      scripts/build_dependencies.sh

1016
patches/libusb-1.0.24.patch
File diff suppressed because it is too large
View File

68
patches/libusb-1.0.25.patch

@ -0,0 +1,68 @@
From b5a7dca8cba163ca15b873c3ac9c81ec5622e827 Mon Sep 17 00:00:00 2001
From: osy <50960678+osy@users.noreply.github.com>
Date: Sat, 15 May 2021 23:29:54 -0700
Subject: [PATCH] darwin: reset by re-enumerate on non-macOS platforms
On non-macOS platforms, ResetDevice() does nothing so we use the "old" way of
calling re-enumerate. If the device is captured, we have to re-enumerate, then
re-capture, re-authorize, and finally restore the state.
---
libusb/os/darwin_usb.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
index 903422c..c2a4813 100644
--- a/libusb/os/darwin_usb.c
+++ b/libusb/os/darwin_usb.c
@@ -95,6 +95,8 @@ static enum libusb_error process_new_device (struct libusb_context *ctx, struct
static enum libusb_error darwin_get_cached_device(struct libusb_context *ctx, io_service_t service, struct darwin_cached_device **cached_out,
UInt64 *old_session_id);
+static int darwin_detach_kernel_driver (struct libusb_device_handle *dev_handle, uint8_t interface);
+
#if defined(ENABLE_LOGGING)
static const char *darwin_error_str (IOReturn result) {
static char string_buffer[50];
@@ -1842,15 +1844,37 @@ static int darwin_reenumerate_device (struct libusb_device_handle *dev_handle, b
static int darwin_reset_device (struct libusb_device_handle *dev_handle) {
struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
+ unsigned long claimed_interfaces = dev_handle->claimed_interfaces;
+ int8_t active_config = dpriv->active_config;
+ int capture_count;
IOReturn kresult;
+ enum libusb_error ret;
+#if TARGET_OS_OSX
+ /* ResetDevice() is missing on non-macOS platforms */
if (dpriv->capture_count > 0) {
/* we have to use ResetDevice as USBDeviceReEnumerate() loses the authorization for capture */
kresult = (*(dpriv->device))->ResetDevice (dpriv->device);
return darwin_to_libusb (kresult);
- } else {
- return darwin_reenumerate_device (dev_handle, false);
}
+#endif
+ ret = darwin_reenumerate_device (dev_handle, false);
+ if ((ret == LIBUSB_SUCCESS || ret == LIBUSB_ERROR_NOT_FOUND) && dpriv->capture_count > 0) {
+ /* save old capture_count */
+ capture_count = dpriv->capture_count;
+ /* reset capture count */
+ dpriv->capture_count = 0;
+ /* attempt to detach kernel driver again as it is now re-attached */
+ ret = darwin_detach_kernel_driver (dev_handle, 0);
+ if (ret != LIBUSB_SUCCESS) {
+ return ret;
+ }
+ /* restore capture_count */
+ dpriv->capture_count = capture_count;
+ /* restore configuration */
+ ret = darwin_restore_state (dev_handle, active_config, claimed_interfaces);
+ }
+ return ret;
}
static io_service_t usb_find_interface_matching_location (const io_name_t class_name, UInt8 interface_number, UInt32 location) {
--
2.32.0 (Apple Git-132)

4
patches/sources

@ -17,8 +17,8 @@ OPENSSL_SRC="https://www.openssl.org/source/old/1.1.1/openssl-1.1.1b.tar.gz"
OPUS_SRC="https://archive.mozilla.org/pub/opus/opus-1.3.tar.gz"
SPICE_PROTOCOL_SRC="https://www.spice-space.org/download/releases/spice-protocol-0.14.4.tar.xz"
SPICE_SERVER_SRC="https://www.spice-space.org/download/releases/spice-server/spice-0.14.3.tar.bz2"
USB_SRC="https://github.com/libusb/libusb/releases/download/v1.0.24/libusb-1.0.24.tar.bz2"
USBREDIR_SRC="https://www.spice-space.org/download/usbredir/usbredir-0.8.0.tar.bz2"
USB_SRC="https://github.com/libusb/libusb/releases/download/v1.0.25/libusb-1.0.25.tar.bz2"
USBREDIR_SRC="https://www.spice-space.org/download/usbredir/usbredir-0.12.0.tar.xz"
QEMU_SRC="https://github.com/utmapp/qemu/releases/download/v6.2.0-utm/qemu-6.2.0-utm.tar.bz2"
# Source files for spice-client

35
patches/usbredir-0.8.0.patch

@ -1,35 +0,0 @@
From 985e79d5f98d5586d87204317462549332c1dd46 Mon Sep 17 00:00:00 2001
From: Frediano Ziglio <fziglio@redhat.com>
Date: Wed, 23 Jan 2019 10:08:49 +0000
Subject: [PATCH] usbredirserver: Make compile under MacOS
This fixes Gitlab issue #9
(cfr https://gitlab.freedesktop.org/spice/usbredir/issues/9).
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
---
usbredirserver/usbredirserver.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/usbredirserver/usbredirserver.c b/usbredirserver/usbredirserver.c
index 6aa2740..badb7bc 100644
--- a/usbredirserver/usbredirserver.c
+++ b/usbredirserver/usbredirserver.c
@@ -43,6 +43,13 @@
#define SERVER_VERSION "usbredirserver " PACKAGE_VERSION
+#if !defined(SOL_TCP) && defined(IPPROTO_TCP)
+#define SOL_TCP IPPROTO_TCP
+#endif
+#if !defined(TCP_KEEPIDLE) && defined(TCP_KEEPALIVE) && defined(__APPLE__)
+#define TCP_KEEPIDLE TCP_KEEPALIVE
+#endif
+
static int verbose = usbredirparser_info;
static int client_fd, running = 1;
static libusb_context *ctx;
--
GitLab

2
scripts/build_dependencies.sh

@ -457,7 +457,7 @@ build_qemu_dependencies () {
# USB support
if [ -z "$SKIP_USB_BUILD" ]; then
build $USB_SRC
build $USBREDIR_SRC
meson_build $USBREDIR_SRC
fi
# GPU support
build_angle

Loading…
Cancel
Save