Hi, First of all again what MArc-André said, and also: <snip>
diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c index 14b60c9..2b6ce28 100644 --- a/gtk/usb-device-manager.c +++ b/gtk/usb-device-manager.c @@ -28,7 +28,14 @@ #ifdef USE_USBREDIR #include<errno.h> #include<libusb.h> +#if defined(USE_GUDEV) #include<gudev/gudev.h> +#elif defined(G_OS_WIN32) +#include "win-usb-dev.h" +#else +#warning "Expecting one of G_OS_WIN32 and USE_GUDEV to be defined" +#endif + #include "channel-usbredir-priv.h" #include "usbredirhost.h" #include "usbutil.h"
I believe the #warning should be an #error here.
diff --git a/gtk/win-usb-dev.c b/gtk/win-usb-dev.c new file mode 100644 index 0000000..7503c41 --- /dev/null +++ b/gtk/win-usb-dev.c
<snip>
+ + self = G_UDEV_CLIENT(initable); + priv = self->priv; + + /* FIXME: Using context != NULL results in a crash on spice_usb_device_manager_add_dev(). + * The same happens also when using SpiceUsbDeviceManagerPrivate->context and + * removing the calls to libusb_init& libusb_exit. + */ + rc = libusb_init(NULL); + g_return_val_if_fail(rc>= 0, FALSE);
Ugh using a global libusb context is BAD, remember spice-gtk is a library, so in the long run it could get linked into a program which is also using libusb in some other way. This is acceptable for now, but it really should be high on the TODO list of things to fix. OTOH we might get hotplug support in libusbx first :) Regards, Hans _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel