[Spice-devel] [spice-gtk 4/9] usb-redir: device description for emulated devices
Yuri Benditovich
yuri.benditovich at daynix.com
Wed Jul 24 10:53:46 UTC 2019
Ability to retrieve device description for emulated USB
device, defined by implementation. For example, for shared
CD the implementation may use basename of ISO file.
Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
---
src/usb-device-manager.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index b11bb15..1660905 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -1483,11 +1483,18 @@ gchar *spice_usb_device_get_description(SpiceUsbDevice *device, const gchar *for
return g_strdup(_("USB redirection"));
}
+ if (!format)
+ format = _("%s %s %s at %d-%d");
+
bus = spice_usb_device_get_busnum(device);
address = spice_usb_device_get_devaddr(device);
vid = spice_usb_device_get_vid(device);
pid = spice_usb_device_get_pid(device);
+ if (bus == BUS_NUMBER_FOR_EMULATED_USB) {
+ return spice_usb_backend_device_description(device->bdev, format);
+ }
+
if ((vid > 0) && (pid > 0)) {
descriptor = g_strdup_printf("[%04x:%04x]", vid, pid);
} else {
@@ -1497,9 +1504,6 @@ gchar *spice_usb_device_get_description(SpiceUsbDevice *device, const gchar *for
spice_usb_util_get_device_strings(bus, address, vid, pid,
&manufacturer, &product);
- if (!format)
- format = _("%s %s %s at %d-%d");
-
description = g_strdup_printf(format, manufacturer, product, descriptor, bus, address);
g_free(manufacturer);
--
2.17.1
More information about the Spice-devel
mailing list