On 2013年12月12日 20:36, Daniel P. Berrange wrote:
On Thu, Dec 12, 2013 at 03:17:40PM +0800, Li Zhang wrote:
> From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
>
> There is no keyboard for non-x86 platforms when graphics are enabled.
> It's preferred to add one USB keyboard.
>
> This patch is to add keyboard input device type.
>
> Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
> ---
> docs/schemas/domaincommon.rng | 1 +
> src/conf/domain_conf.c | 3 ++-
> src/conf/domain_conf.h | 1 +
> 3 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 38c6801..964350d 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -3167,6 +3167,7 @@
> <choice>
> <value>tablet</value>
> <value>mouse</value>
> + <value>kbd</value>
> </choice>
> </attribute>
> <optional>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index e0ab4b1..3dee9a8 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -504,7 +504,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
>
> VIR_ENUM_IMPL(virDomainInput, VIR_DOMAIN_INPUT_TYPE_LAST,
> "mouse",
> - "tablet")
> + "tablet",
> + "kbd")
>
> VIR_ENUM_IMPL(virDomainInputBus, VIR_DOMAIN_INPUT_BUS_LAST,
> "ps2",
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 4934911..8aa5f50 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -1223,6 +1223,7 @@ struct _virDomainTPMDef {
> enum virDomainInputType {
> VIR_DOMAIN_INPUT_TYPE_MOUSE,
> VIR_DOMAIN_INPUT_TYPE_TABLET,
> + VIR_DOMAIN_INPUT_TYPE_KBD,
>
> VIR_DOMAIN_INPUT_TYPE_LAST
> };
As before this is seriously incomplete. There is alot of logic
throughout this file that specialcases handling of the input
devices which must be updated at the same time.
eg in virDomainInputDefParseXML you must allow a keyboard device
on PS2 bus, and on Xen bus. You must also set the default bus if
none is specified.
OK, I will add that.
In virDomainDefParseXML we delete any user specified mouse on
the PS/2 bus since it is implicit. We must do the same with kbd
on PS/2 bus. We also auto-add an implicit PS/2 mouse and must
do the same with PS/2 kbd
I am a little confused about that, PS/2 mouse is auto-added by QEMU.
Is it necessary to add the device configuration in libvirt?
I can't find any place to add PS/2 kbd in QEMU.
Thanks.
Daniel