[Spice-devel] [spice-gtk 4/9] usb-redir: device description for emulated devices

Victor Toso victortoso at redhat.com
Thu Jul 25 10:47:02 UTC 2019


Hi,

On Wed, Jul 24, 2019 at 01:53:46PM +0300, Yuri Benditovich wrote:
> 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");
> +

We should add {} here as well, but patch is fine
Acked-by: Victor Toso <victortoso at redhat.com>

>      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
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190725/736a9fa4/attachment-0001.sig>


More information about the Spice-devel mailing list