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