<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 4 Feb 2016, at 23:51 PM, Jonathon Jongsma <<a href="mailto:jjongsma@redhat.com" class="">jjongsma@redhat.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On Thu, 2015-10-29 at 17:26 +0200, Dmitry Fleytman wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">In other cases match devices by BUS:ADDR.<br class=""><br class="">Signed-off-by: Dmitry Fleytman <<a href="mailto:dmitry@daynix.com" class="">dmitry@daynix.com</a>><br class="">---<br class="">src/usb-device-manager.c | 78 +++++++++++++++++++++++++----------------------<br class="">-<br class="">1 file changed, 40 insertions(+), 38 deletions(-)<br class=""><br class="">diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c<br class="">index 55533f9..dd55276 100644<br class="">--- a/src/usb-device-manager.c<br class="">+++ b/src/usb-device-manager.c<br class="">@@ -653,13 +653,15 @@ static gboolean<br class="">spice_usb_device_manager_get_udev_bus_n_address(<br class=""><br class=""> *bus = *address = 0;<br class=""><br class="">-#ifndef G_OS_WIN32<br class="">- bus_str = g_udev_device_get_property(udev, "BUSNUM");<br class="">- address_str = g_udev_device_get_property(udev, "DEVNUM");<br class="">-#else /* Windows -- request vid:pid instead */<br class="">- bus_str = g_udev_device_get_property(udev, "VID");<br class="">- address_str = g_udev_device_get_property(udev, "PID");<br class="">-#endif<br class="">+ if (manager->priv->use_usbclerk) {<br class="">+ /* Windows WinUsb/UsbClerk -- request vid:pid instead */<br class="">+ bus_str = g_udev_device_get_property(udev, "VID");<br class="">+ address_str = g_udev_device_get_property(udev, "PID");<br class="">+ } else {<br class="">+ /* Linux or UsbDk backend on Windows*/<br class="">+ bus_str = g_udev_device_get_property(udev, "BUSNUM");<br class="">+ address_str = g_udev_device_get_property(udev, "DEVNUM");<br class="">+ }<br class=""> if (bus_str)<br class=""> *bus = atoi(bus_str);<br class=""> if (address_str)<br class="">@@ -798,13 +800,17 @@ static void<br class="">spice_usb_device_manager_auto_connect_cb(GObject *gobject,<br class=""> spice_usb_device_unref(device);<br class="">}<br class=""><br class="">-#ifndef G_OS_WIN32 /* match functions for Linux -- match by bus.addr */<br class="">static gboolean<br class="">spice_usb_device_manager_device_match(SpiceUsbDeviceManager *self,<br class="">SpiceUsbDevice *device,<br class=""> const int bus, const int address)<br class="">{<br class="">- return (spice_usb_device_get_busnum(device) == bus &&<br class="">- spice_usb_device_get_devaddr(device) == address);<br class="">+ if (self->priv->use_usbclerk) {<br class="">+ return (spice_usb_device_get_vid(device) == bus &&<br class="">+ spice_usb_device_get_pid(device) == address);<br class="">+ } else {<br class="">+ return (spice_usb_device_get_busnum(device) == bus &&<br class="">+ spice_usb_device_get_devaddr(device) == address);<br class="">+ }<br class="">}<br class=""><br class="">#ifdef USE_GUDEV<br class="">@@ -812,32 +818,21 @@ static gboolean<br class="">spice_usb_device_manager_libdev_match(SpiceUsbDeviceManager *self,<br class="">libusb_device *libdev,<br class=""> const int bus, const int address)<br class="">{<br class="">- return (libusb_get_bus_number(libdev) == bus &&<br class="">- libusb_get_device_address(libdev) == address);<br class="">-}<br class="">-#endif<br class="">-<br class="">-#else /* Win32 -- match functions for Windows -- match by vid:pid */<br class="">-static gboolean<br class="">-spice_usb_device_manager_device_match(SpiceUsbDeviceManager *self,<br class="">SpiceUsbDevice *device,<br class="">- const int vid, const int pid)<br class="">-{<br class="">- return (spice_usb_device_get_vid(device) == vid &&<br class="">- spice_usb_device_get_pid(device) == pid);<br class="">-}<br class="">+ if (self->priv->use_usbclerk) {<br class="">+ /* WinUSB -- match functions for Windows -- match by vid:pid */<br class="">+ int vid, pid;<br class=""><br class="">-static gboolean<br class="">-spice_usb_device_manager_libdev_match(SpiceUsbDeviceManager *self,<br class="">libusb_device *libdev,<br class="">- const int vid, const int pid)<br class="">-{<br class="">- int vid2, pid2;<br class="">-<br class="">- if (!spice_usb_device_manager_get_libdev_vid_pid(libdev, &vid2, &pid2)) {<br class="">- return FALSE;<br class="">+ if (!spice_usb_device_manager_get_libdev_vid_pid(libdev, &vid, &pid))<br class="">{<br class="">+ return FALSE;<br class="">+ }<br class="">+ return (bus == vid && address == pid);<br class="">+ } else {<br class="">+ /* match functions for Linux/UsbDk -- match by bus.addr */<br class="">+ return (libusb_get_bus_number(libdev) == bus &&<br class="">+ libusb_get_device_address(libdev) == address);<br class=""> }<br class="">- return (vid == vid2 && pid == pid2);<br class="">}<br class="">-#endif /* of Win32 -- match functions */<br class="">+#endif<br class=""><br class="">static SpiceUsbDevice*<br class="">spice_usb_device_manager_find_device(SpiceUsbDeviceManager *self,<br class="">@@ -1908,14 +1903,21 @@<br class="">spice_usb_manager_device_equal_libdev(SpiceUsbDeviceManager *manager,<br class=""> SpiceUsbDevice *device,<br class=""> libusb_device *libdev)<br class="">{<br class="">- int vid, pid;<br class="">+ int busnum, devaddr;<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">indentation change</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>Thanks, fixed.</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""> if ((device == NULL) || (libdev == NULL))<br class="">- return FALSE;<br class="">+ return FALSE;<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">indentation change</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div>Thanks, fixed.</div><div><br class=""><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">+<br class="">+ if (manager->priv->use_usbclerk) {<br class="">+ busnum = spice_usb_device_get_vid(device);<br class="">+ devaddr = spice_usb_device_get_pid(device);<br class="">+ } else {<br class="">+ busnum = spice_usb_device_get_busnum(device);<br class="">+ devaddr = spice_usb_device_get_devaddr(device);<br class="">+ }<br class=""><br class="">- vid = spice_usb_device_get_vid(device);<br class="">- pid = spice_usb_device_get_pid(device);<br class="">- return spice_usb_device_manager_libdev_match(manager, libdev, vid, pid);<br class="">+ return spice_usb_device_manager_libdev_match(manager, libdev,<br class="">+ busnum, devaddr);<br class="">}<br class="">#endif<br class=""><br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">ACK without indentation changes above</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Acked-by: Jonathon Jongsma <</span><a href="mailto:jjongsma@redhat.com" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">jjongsma@redhat.com</a><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">></span></div></blockquote></div><br class=""></body></html>