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

Re: [libvirt] [PATCH v8 3/7] conf: Remove the implicit PS2 mouse for non-X86 platforms and add an implicit PS2 keyboard device for X86 platforms.



On 02/17/2014 10:04 AM, Li Zhang wrote:
> On 2014年02月17日 16:48, Ján Tomko wrote:
>> On 02/17/2014 08:33 AM, Li Zhang wrote:
>>> From: Li Zhang <zhlcindy linux vnet ibm com>
>>>
>>> PS2 device only works for X86 platform, other platforms may need
>>> USB mouse. Athough it doesn't influence the QEMU command line, but
>>> it's not right to add one PS2 mouse for non-X86 platform.
>>>
>>> What's more, PS2 keyboard can be supported for X86.
>>>
>>> So, this patch is to remove PS2 mouse for non-x86 platforms and also add
>>> an implicit PS2 keyboard device for X86.
>>>
>>> Signed-off-by: Li Zhang <zhlcindy linux vnet ibm com>
>>> ---
>>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>>> index 3301398..10c753c 100644
>>> --- a/src/conf/domain_conf.c
>>> +++ b/src/conf/domain_conf.c
>>> @@ -12495,29 +12496,27 @@ virDomainDefParseXML(xmlDocPtr xml,
>>>       VIR_FREE(nodes);
>>>         /* If graphics are enabled, there's an implicit PS2 mouse */
>>> -    if (def->ngraphics > 0) {
>>> -        virDomainInputDefPtr input;
>>> +    if (def->ngraphics > 0 &&
>>> +        ARCH_IS_X86(def->os.arch)) {
>>> +        int input_bus = VIR_DOMAIN_INPUT_BUS_XEN;
>>>   -        if (VIR_ALLOC(input) < 0) {
>>> -            goto error;
>>> -        }
>>> -        if (STREQ(def->os.type, "hvm")) {
>>> -            input->type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
>>> -            input->bus = VIR_DOMAIN_INPUT_BUS_PS2;
>>> -        } else {
>>> -            input->type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
>>> -            input->bus = VIR_DOMAIN_INPUT_BUS_XEN;
>>> -        }
>>> +        if (STREQ(def->os.type, "hvm"))
>>> +            input_bus = VIR_DOMAIN_INPUT_BUS_PS2;
>>>   -        if (VIR_REALLOC_N(def->inputs, def->ninputs + 1) < 0) {
>>> -            virDomainInputDefFree(input);
>>> +        if (virDomainDefMaybeAddInput(def,
>>> +                                      VIR_DOMAIN_INPUT_TYPE_MOUSE,
>>> +                                      input_bus) < 0)
>>>               goto error;
>>> +
>>> +        /*Ignore keyboard for XEN, only add a PS2 keyboard device for hvm*/
>>> +        if (STREQ(def->os.type, "hvm")) {
>>> +            if (virDomainDefMaybeAddInput(def,
>>> +                                          VIR_DOMAIN_INPUT_TYPE_KBD,
>>> +                                          input_bus) < 0)
>>> +                goto error;
>>>           }
>> Adding the default keyboard should be in the patch that adds it to the parser
>> according to
>> https://www.redhat.com/archives/libvir-list/2014-February/msg00889.html
> 
> Do you mean merge this patch to the first patch?
> 

I mean merging the part dealing with keyboards with the first patch and only
touch the implicit mouse in this patch.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature


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