[Spice-devel] [spice-gtk PATCH 0/9] Windows: identify USB devices by vid:pid instead of bus.address

Hans de Goede hdegoede at redhat.com
Mon Mar 25 03:17:36 PDT 2013


Hi,

On 03/25/2013 11:01 AM, Uri Lublin wrote:
> rhbz#842816
>
> It seems that sometimes a USB device's bus.address is changing after
> installation of WinUSB driver for that device.
> So instead use vid:pid which are consistent across driver installation.
>
> The switch to using vid:pid is done in patch 8/9.
>
> Some code reuses variables named "bus" and "address" to hold vid and pid
> values. If people think this should be changed to new variables names (ifdefed)
> and/or new function instead of spice_usb_device_manager_get_udev_bus_n_address
> let me know.
>
> Using two devices with the same vid:pid on the same Windows client is already
> not supported, since Windows installs USB drivers for specific devices
> based on their vid:pid

Hmm, I'm not very happy with the approach you've chosen here. Just because
usbclerck / our driver swapping magic currently does not support having devices
with identical vid:pid is not a good reason to add the same problem to other
parts of the code. The contrary is true really, this is something which we
should try to fix, not make worse.

Have you tried using libusb_get_port_path? I know that is sensitive to
device swap races on the same port, so how about using a combination of
libusb_get_port_path + vid & pid to identify a device?

Regards,

Hans


More information about the Spice-devel mailing list