[Spice-devel] [spice-gtk Win32 v5 08/22] spice_usb_device_manager_device_error: replace SpiceUsbDevice with libusb_device

Uri Lublin uril at redhat.com
Mon Jul 9 05:14:51 PDT 2012


Its only user is channel-usbredir, which needs the libusb_device.

In preparations for a different SpiceUsbDevice.
---
 gtk/channel-usbredir.c        |    2 +-
 gtk/usb-device-manager-priv.h |    5 ++++-
 gtk/usb-device-manager.c      |    3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gtk/channel-usbredir.c b/gtk/channel-usbredir.c
index 3d57152..354d2e1 100644
--- a/gtk/channel-usbredir.c
+++ b/gtk/channel-usbredir.c
@@ -569,7 +569,7 @@ static void do_emit_main_context(GObject *object, int event, gpointer params)
             spice_usb_device_manager_device_error(
                 spice_usb_device_manager_get(
                     spice_channel_get_session(SPICE_CHANNEL(channel)), NULL),
-                (SpiceUsbDevice *)p->device, p->error);
+                p->device, p->error);
         }
         break;
     }
diff --git a/gtk/usb-device-manager-priv.h b/gtk/usb-device-manager-priv.h
index 912e3bf..079f638 100644
--- a/gtk/usb-device-manager-priv.h
+++ b/gtk/usb-device-manager-priv.h
@@ -31,8 +31,11 @@ gboolean spice_usb_device_manager_start_event_listening(
 void spice_usb_device_manager_stop_event_listening(
     SpiceUsbDeviceManager *manager);
 
+#ifdef USE_USBREDIR
+#include <libusb.h>
 void spice_usb_device_manager_device_error(
-    SpiceUsbDeviceManager *manager, SpiceUsbDevice *device, GError *err);
+    SpiceUsbDeviceManager *manager, libusb_device *libdev, GError *err);
+#endif
 
 G_END_DECLS
 
diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index dbf3493..9f29c76 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -736,8 +736,9 @@ void spice_usb_device_manager_stop_event_listening(
 }
 
 void spice_usb_device_manager_device_error(
-    SpiceUsbDeviceManager *self, SpiceUsbDevice *device, GError *err)
+    SpiceUsbDeviceManager *self, libusb_device *libdev, GError *err)
 {
+    SpiceUsbDevice *device = (SpiceUsbDevice *)libdev;
     g_signal_emit(self, signals[DEVICE_ERROR], 0, device, err);
 }
 #endif
-- 
1.7.1



More information about the Spice-devel mailing list