[PATCH v2 5/5] Add a default USB keyboard for PPC64

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

 



From: Li Zhang <zhlcindy@xxxxxxxxxxxxxxxxxx>

There is no keyboard working on PPC64 when graphic is enabled.
It needs to add a USB keyboard for it.

This patch is to add a USB keyboard when graphic is enabled.

Signed-off-by: Li Zhang <zhlcindy@xxxxxxxxxxxxxxxxxx>
---
 src/qemu/qemu_domain.c                               | 14 +++++++++++++-
 tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml |  1 +
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 346fec3..0b910f9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -691,6 +691,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
     bool addPCIRoot = false;
     bool addPCIeRoot = false;
     bool addDefaultMemballoon = true;
+    bool addDefaultUSBKBD = false;
 
     /* check for emulator and create a default one if needed */
     if (!def->emulator &&
@@ -728,9 +729,13 @@ qemuDomainDefPostParse(virDomainDefPtr def,
        addDefaultMemballoon = false;
        break;
 
+    case VIR_ARCH_PPC64:
+       addPCIRoot = true;
+       addDefaultUSBKBD = true;
+       break;
+
     case VIR_ARCH_ALPHA:
     case VIR_ARCH_PPC:
-    case VIR_ARCH_PPC64:
     case VIR_ARCH_PPCEMB:
     case VIR_ARCH_SH4:
     case VIR_ARCH_SH4EB:
@@ -783,6 +788,13 @@ qemuDomainDefPostParse(virDomainDefPtr def,
         def->memballoon = memballoon;
     }
 
+    if (addDefaultUSBKBD &&
+        def->ngraphics > 0 &&
+        virDomainDefMaybeAddInput(def,
+                                  VIR_DOMAIN_INPUT_TYPE_KBD,
+                                  VIR_DOMAIN_INPUT_BUS_USB) < 0)
+        return -1;
+
     return 0;
 }
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml
index dbbd6aa..4a2be91 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-disk.xml
@@ -30,6 +30,7 @@
     <controller type='usb' index='0'/>
     <controller type='scsi' index='0'/>
     <controller type='pci' index='0' model='pci-root'/>
+    <input type='kbd' bus='usb'/>
     <input type='mouse' bus='ps2'/>
     <graphics type='sdl'/>
     <video>
-- 
1.8.2.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]