Add a default USB keyboard and USB mouse for PPC64

There is no keyboard working on PPC64 and PS2 mouse is only for X86
when graphics are enabled.

Add a USB keyboard and USB mouse for PPC64 when graphics are enabled.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Li Zhang 2014-02-17 18:17:58 +08:00 committed by Ján Tomko
parent 2a81430c85
commit cffa51b81d
2 changed files with 24 additions and 1 deletions

View File

@ -691,6 +691,8 @@ qemuDomainDefPostParse(virDomainDefPtr def,
bool addPCIRoot = false;
bool addPCIeRoot = false;
bool addDefaultMemballoon = true;
bool addDefaultUSBKBD = false;
bool addDefaultUSBMouse = false;
/* check for emulator and create a default one if needed */
if (!def->emulator &&
@ -732,9 +734,14 @@ qemuDomainDefPostParse(virDomainDefPtr def,
addDefaultMemballoon = false;
break;
case VIR_ARCH_PPC64:
addPCIRoot = true;
addDefaultUSBKBD = true;
addDefaultUSBMouse = 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:
@ -787,6 +794,20 @@ 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;
if (addDefaultUSBMouse &&
def->ngraphics > 0 &&
virDomainDefMaybeAddInput(def,
VIR_DOMAIN_INPUT_TYPE_MOUSE,
VIR_DOMAIN_INPUT_BUS_USB) < 0)
return -1;
return 0;
}

View File

@ -30,6 +30,8 @@
<controller type='usb' index='0'/>
<controller type='scsi' index='0'/>
<controller type='pci' index='0' model='pci-root'/>
<input type='keyboard' bus='usb'/>
<input type='mouse' bus='usb'/>
<graphics type='sdl'/>
<video>
<model type='cirrus' vram='9216' heads='1'/>