[gnome-boxes] vm-configurator: Only add USB kbd/mouse if supported



commit 4296699a750ca42096264587e309f291e84dd813
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Mar 31 22:58:15 2015 +0100

    vm-configurator: Only add USB kbd/mouse if supported
    
    Turns out that we broke Windows XP installer by unconditionally adding
    USB mouse and keyboard to all new VMs. Let's only add them if they are
    supported out of the box by the guest OS.
    
    Since support of these devices by Windows 7 and its inheriting OSes
    (including Windows 8.1) was not known to libosinfo until recently, this
    patch would imply that the following bug is still valid unless you use
    the upcoming version of libosinfo (0.2.12):
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735768

 src/vm-configurator.vala |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index a73eb4d..2b42a6c 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -344,10 +344,20 @@ private class Boxes.VMConfigurator {
     }
 
     private static void set_mouse_config (Domain domain, InstallerMedia install_media) {
+        var device = find_usb_device_by_prop (install_media.supported_devices, DEVICE_PROP_NAME, "mouse");
+        if (device == null)
+            // USB mouse not supported, let libvirt add default PS/2 mouse
+            return;
+
         set_input_config (domain, DomainInputDeviceType.MOUSE);
     }
 
     private static void set_keyboard_config (Domain domain, InstallerMedia install_media) {
+        var device = find_usb_device_by_prop (install_media.supported_devices, DEVICE_PROP_NAME, "keyboard");
+        if (device == null)
+            // USB keyboard not supported, let libvirt add default PS/2 keyboard
+            return;
+
         set_input_config (domain, DomainInputDeviceType.KEYBOARD);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]