/**
* SpiceUsbDeviceManager::device-removed:
@@ -414,7 +415,7 @@ static void spice_usb_device_manager_class_init(SpiceUsbDeviceManagerClass *klas
g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE,
1,
- SPICE_TYPE_USB_DEVICE);
+ G_TYPE_POINTER);
/**
* SpiceUsbDeviceManager::auto-connect-failed:
@@ -435,7 +436,7 @@ static void spice_usb_device_manager_class_init(SpiceUsbDeviceManagerClass *klas
g_cclosure_user_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE,
2,
- SPICE_TYPE_USB_DEVICE,
+ G_TYPE_POINTER,
G_TYPE_ERROR);
/**
@@ -457,7 +458,7 @@ static void spice_usb_device_manager_class_init(SpiceUsbDeviceManagerClass *klas
g_cclosure_user_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE,
2,
- SPICE_TYPE_USB_DEVICE,
+ G_TYPE_POINTER,
G_TYPE_ERROR);
g_type_class_add_private(klass, sizeof(SpiceUsbDeviceManagerPrivate));
@@ -1009,34 +1019,32 @@ spice_usb_device_manager_can_redirect_device(SpiceUsbDeviceManager *self,
*
* Returns: a newly-allocated string holding the description, or %NULL if failed
*/
-gchar *spice_usb_device_get_description(SpiceUsbDevice *_device, const gchar *format)
+gchar *spice_usb_device_get_description(SpiceUsbDevice *device, const gchar *format)
{
#ifdef USE_USBREDIR
- libusb_device *device = (libusb_device *)_device;
- struct libusb_device_descriptor desc;
- int bus, address;
+ int bus, addr, vid, pid;
gchar *description, *descriptor, *manufacturer = NULL, *product = NULL;
- g_return_val_if_fail(device != NULL, NULL);
+ g_return_val_if_fail(SPICE_IS_USB_DEVICE(device), NULL);
- bus = libusb_get_bus_number(device);
- address = libusb_get_device_address(device);
+ bus = spice_usb_device_get_busnum(device);
+ addr = spice_usb_device_get_devaddr(device);
+ vid = spice_usb_device_get_vid(device);
+ pid = spice_usb_device_get_pid(device);
- if (libusb_get_device_descriptor(device,&desc) == LIBUSB_SUCCESS) {
- spice_usb_util_get_device_strings(bus, address,
- desc.idVendor, desc.idProduct,
-&manufacturer,&product);
- descriptor = g_strdup_printf("[%04x:%04x]", desc.idVendor, desc.idProduct);
+ if ((vid> 0)&& (pid> 0)) {
+ descriptor = g_strdup_printf("[%04x:%04x]", vid, pid);