54c03ce
From c197d163ccbd2997d400942e14442257dd9d2285 Mon Sep 17 00:00:00 2001
54c03ce
From: Peter Robinson <pbrobinson@gmail.com>
54c03ce
Date: Wed, 27 Feb 2019 11:08:25 +0000
54c03ce
Subject: [PATCH 05/13] Fix input devices for ARMv7 and aarch64
54c03ce
54c03ce
The Arm architectures don't work well with the legacy ps2 bits causing
54c03ce
issues with graphical output. Qemu also doesn't, due to a historical
54c03ce
oversight, automatically setup input so we need to do it here else
54c03ce
graphical out and hence screenshots don't work.
54c03ce
54c03ce
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
54c03ce
---
54c03ce
 oz/Guest.py | 10 +++++++++-
54c03ce
 1 file changed, 9 insertions(+), 1 deletion(-)
54c03ce
54c03ce
diff --git a/oz/Guest.py b/oz/Guest.py
54c03ce
index 4e74fe1..418b888 100644
54c03ce
--- a/oz/Guest.py
54c03ce
+++ b/oz/Guest.py
54c03ce
@@ -255,7 +255,10 @@ class Guest(object):
54c03ce
             self.clockoffset = "utc"
54c03ce
         self.mousetype = mousetype
54c03ce
         if self.mousetype is None:
54c03ce
-            self.mousetype = "ps2"
54c03ce
+            if self.tdl.arch in ["aarch64", "armv7l"]:
54c03ce
+                self.mousetype = "usb"
54c03ce
+            else:
54c03ce
+                self.mousetype = "ps2"
54c03ce
         if diskbus is None or diskbus == "ide":
54c03ce
             self.disk_bus = "ide"
54c03ce
             self.disk_dev = "hda"
54c03ce
@@ -512,6 +515,11 @@ class Guest(object):
54c03ce
         elif self.mousetype == "usb":
54c03ce
             mousedict['type'] = 'tablet'
54c03ce
         oz.ozutil.lxml_subelement(devices, "input", None, mousedict)
54c03ce
+        if self.tdl.arch in ["aarch64", "armv7l"] and self.libvirt_type == "kvm":
54c03ce
+            # Other arches add a keyboard by default, for historical reasons ARM doesn't
54c03ce
+            # so we add it here so graphical works and hence we can get debug screenshots RHBZ 1538637
54c03ce
+            oz.ozutil.lxml_subelement(devices, 'controller', None, {'type': 'usb', 'index': '0'})
54c03ce
+            oz.ozutil.lxml_subelement(devices, 'input', None, {'type': 'keyboard', 'bus': 'usb'})
54c03ce
         # serial console pseudo TTY
54c03ce
         console = oz.ozutil.lxml_subelement(devices, "serial", None, {'type': 'pty'})
54c03ce
         oz.ozutil.lxml_subelement(console, "target", None, {'port': '0'})
54c03ce
-- 
54c03ce
2.20.1
54c03ce