guest: If graphics enabled, add usb tablet/keyboard for machvirt

This commit is contained in:
Cole Robinson 2017-06-28 16:22:23 -04:00
parent 2cabc2e386
commit a07a874497
2 changed files with 18 additions and 3 deletions

View File

@ -14,6 +14,8 @@
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
<controller type="usb" index="0" model="nec-xhci" ports="8"/>
<input type="tablet" bus="usb"/>
<input type="keyboard" bus="usb"/>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
<image compression="off"/>
</graphics>

View File

@ -621,18 +621,31 @@ class Guest(XMLBuilder):
def add_default_input_device(self):
if self.os.is_container():
return
if not self.os.is_x86():
return
if self.get_devices("input"):
return
if not self.get_devices("graphics"):
return
if self._usb_disabled():
return
if self._os_object.supports_usbtablet() and not self._usb_disabled():
usb_tablet = False
usb_keyboard = False
if self.os.is_x86():
usb_tablet = self._os_object.supports_usbtablet()
if self.os.is_arm_machvirt():
usb_tablet = True
usb_keyboard = True
if usb_tablet:
dev = VirtualInputDevice(self.conn)
dev.type = "tablet"
dev.bus = "usb"
self.add_device(dev)
if usb_keyboard:
dev = VirtualInputDevice(self.conn)
dev.type = "keyboard"
dev.bus = "usb"
self.add_device(dev)
def add_default_sound_device(self):
if not self.os.is_hvm():