[Spice-devel] [PATCH spice-gtk 07/34] build-sys: drop support for libusb < 1.0.16

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Mon Jan 7 08:00:36 UTC 2019


From: Marc-André Lureau <marcandre.lureau at redhat.com>

libusb 1.0.16 was released on 11 Jul 2013, that should be long enough.

>From the distro we care about, according to repology, CentOS 6 and
Ubuntu 12.04 have too old libusb (1.0.9rc).

Fwiw, libusb 1.0.23 should hopefully see Windows hotplug
support (https://github.com/libusb/libusb/issues/409).

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 .gitlab-ci.yml           |  2 +-
 configure.ac             | 27 +--------------------------
 meson.build              | 11 +----------
 src/usb-device-manager.c |  8 ++------
 4 files changed, 5 insertions(+), 43 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8a3fdea..260d55d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,7 +6,7 @@ variables:
         intltool gtk3-devel gtk-doc gobject-introspection-devel
         cyrus-sasl-devel pulseaudio-libs-devel libjpeg-turbo-devel
         libacl-devel gstreamer1-devel gstreamer1-plugins-base-devel
-        polkit-devel vala lz4-devel opus-devel libgudev-devel
+        polkit-devel vala lz4-devel opus-devel
         pixman-devel libcacard-devel celt051-devel libphodav-devel
         usbutils usbredir-devel libusbx-devel libsoup-devel
         json-glib-devel
diff --git a/configure.ac b/configure.ac
index be172d5..a17af9c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -275,38 +275,13 @@ if test "x$enable_usbredir" = "xno"; then
   have_usbredir="no"
 else
   PKG_CHECK_MODULES([USBREDIR],
-                    [libusb-1.0 >= 1.0.9 libusbredirhost libusbredirparser-0.5],
+                    [libusb-1.0 >= 1.0.16 libusbredirhost libusbredirparser-0.5],
                     [have_usbredir=yes],
                     [have_usbredir=no])
   if test "x$have_usbredir" = "xno" && test "x$enable_usbredir" = "xyes"; then
     AC_MSG_ERROR([usbredir support explicitly requested, but some required packages are not available])
   fi
 
-  # On non windows we need either libusb hotplug support or gudev
-  if test "x$have_usbredir" = "xyes" && test "x$os_win32" = "xno"; then
-    PKG_CHECK_MODULES([LIBUSB_HOTPLUG], [libusb-1.0 >= 1.0.16],
-                      [have_libusb_hotplug=yes], [have_libusb_hotplug=no])
-    if test "x$have_libusb_hotplug" = "xyes"; then
-      AC_DEFINE([USE_LIBUSB_HOTPLUG], [1], [Define if libusb has hotplug support])
-      with_usbredir_hotplug="with libusb hotplug"
-    else
-      PKG_CHECK_MODULES([GUDEV],
-                        [gudev-1.0],
-                        [have_gudev=yes],
-                        [have_gudev=no])
-
-      if test "x$have_gudev" = "xno" && test "x$enable_usbredir" = "xyes"; then
-        AC_MSG_ERROR([usbredir requested but required gudev is not available])
-      fi
-      if test "x$have_gudev" = "xyes"; then
-        AC_DEFINE([USE_GUDEV], [1], [Define if supporting gudev])
-        with_usbredir_hotplug="with gudev hotplug"
-      else
-        have_usbredir=no
-      fi
-    fi
-  fi
-
   if test "x$have_usbredir" = "xyes"; then
     AC_DEFINE([USE_USBREDIR], [1], [Define if supporting usbredir proxying])
   fi
diff --git a/meson.build b/meson.build
index 4a00b1c..13c1756 100644
--- a/meson.build
+++ b/meson.build
@@ -174,22 +174,13 @@ spice_gtk_has_usbredir = false
 if get_option('usbredir')
   deps = {'libusbredirparser-0.5': '>= 0.5',
           'libusbredirhost' : '>= 0.4.2',
-          'libusb-1.0' : '>= 1.0.9'}
+          'libusb-1.0' : '>= 1.0.16'}
 
   foreach dep, version : deps
     usb_dep = dependency(dep, version : version)
     spice_glib_deps += usb_dep
   endforeach
 
-  if spice_gtk_host_system != 'windows'
-    if usb_dep.version().version_compare('>= 1.0.16')
-      spice_gtk_config_data.set('USE_LIBUSB_HOTPLUG', '1')
-    else
-      spice_glib_deps += dependency('gudev-1.0')
-      spice_gtk_config_data.set('USE_GUDEV', '1')
-    endif
-  endif
-
   spice_gtk_config_data.set('USE_USBREDIR', '1')
   spice_gtk_has_usbredir = true
 endif
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 354038a..55b672b 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -31,13 +31,9 @@
 #include "usbdk_api.h"
 #endif
 
-#if defined(USE_GUDEV)
-#include <gudev/gudev.h>
-#elif defined(G_OS_WIN32)
+#if defined(G_OS_WIN32)
 #include "win-usb-dev.h"
 #define USE_GUDEV /* win-usb-dev.h provides a fake gudev interface */
-#elif !defined USE_LIBUSB_HOTPLUG
-#error "Expecting one of USE_GUDEV or USE_LIBUSB_HOTPLUG to be defined"
 #endif
 
 #include "channel-usbredir-priv.h"
@@ -370,7 +366,7 @@ static void spice_usb_device_manager_dispose(GObject *gobject)
     SpiceUsbDeviceManager *self = SPICE_USB_DEVICE_MANAGER(gobject);
     SpiceUsbDeviceManagerPrivate *priv = self->priv;
 
-#ifdef USE_LIBUSB_HOTPLUG
+#ifndef USE_GUDEV
     if (priv->hp_handle) {
         spice_usb_device_manager_stop_event_listening(self);
         if (g_atomic_int_get(&priv->event_thread_run)) {
-- 
2.20.1.2.gb21ebb671b



More information about the Spice-devel mailing list