usbmouse not work again insert

Submitted by wangfan on Aug. 29, 2018, 8:55 a.m.

Details

Message ID 4c0edfb4.1d2.16584e55edd.Coremail.wangfan1987.good@163.com
State New
Headers show
Series "usbmouse not work again insert" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

wangfan Aug. 29, 2018, 8:55 a.m.
Developers,
         You are good。
         When the virtual machine is connected through the spice protocol and turns on the automatic mapping USB device, 
unplug the USB type mouse or keyboard, insert the USB mouse or keyboard again, windows will first load the USBDK mapping
driver locally, spice-gtk does not filter out the mouse or keyboard does not allow loading USBDK Driver, resulting in the mouse 
or keyboard can not be used, must restart the local windows system.
          The attachment is patch


         diff -uNr a/usb-device-manager.c b/usb-device-manager.c

Patch hide | download patch | download mbox

--- a/usb-device-manager.c 2018-08-29 12:00:42.525130625 +0800
+++ b/usb-device-manager.c 2018-08-29 16:54:48.730963431 +0800
@@ -935,6 +935,7 @@ 
     SpiceUsbDeviceManagerPrivate *priv = self->priv;
     struct libusb_device_descriptor desc;
     SpiceUsbDevice *device;
+    gchar *descusb=NULL;
 
     if (!spice_usb_device_manager_get_device_descriptor(libdev, &desc))
         return;
@@ -946,6 +947,16 @@ 
     device = (SpiceUsbDevice*)spice_usb_device_new(libdev);
     if (!device)
         return;
+  
+#ifndef G_OS_WIN32 
+    descusb = spice_usb_device_get_description(device, NULL);     
+    if(g_strrstr(descusb, "Mouse") || g_strrstr(descusb, "Keyboard")){
+        g_free(descusb);
+        return;       
+    }
+ if(descusb!=NULL)
+  g_free(descusb);
+#endif
 
     g_ptr_array_add(priv->devices, device);