[libvirt] [PATCH v6 1/6] conf: Add a keyboard input device type

Li Zhang zhlcindy at gmail.com
Fri Feb 14 02:50:14 UTC 2014


On 2014年02月14日 00:39, Daniel P. Berrange wrote:
> On Thu, Feb 13, 2014 at 04:48:21PM +0800, Li Zhang wrote:
>
>> @@ -12422,10 +12426,12 @@ virDomainDefParseXML(xmlDocPtr xml,
>>            * XXX will this be true for other virt types ? */
>>           if ((STREQ(def->os.type, "hvm") &&
>>                input->bus == VIR_DOMAIN_INPUT_BUS_PS2 &&
>> -             input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE) ||
>> +             (input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
>> +              input->type == VIR_DOMAIN_INPUT_TYPE_KBD)) ||
>>               (STRNEQ(def->os.type, "hvm") &&
>>                input->bus == VIR_DOMAIN_INPUT_BUS_XEN &&
>> -             input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE)) {
>> +             (input->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ||
>> +              input->type == VIR_DOMAIN_INPUT_TYPE_KBD))) {
>>               virDomainInputDefFree(input);
>>               continue;
> Later on in this function there is
>
>      /* If graphics are enabled, there's an implicit PS2 mouse */
>      if (def->ngraphics > 0) {
>          virDomainInputDefPtr input;
>
>          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 (VIR_REALLOC_N(def->inputs, def->ninputs + 1) < 0) {
>              virDomainInputDefFree(input);
>              goto error;
>          }
>          def->inputs[def->ninputs] = input;
>          def->ninputs++;
>      }
>
>
> which needs to take care of keyboards too now.
>
> And some more similar logic in virDomainDefFormatInternal
> which needs updating

ok, I will do it in next version soon. :)

>
> Daniel




More information about the libvir-list mailing list