diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2011-06-24 17:36:11 +0100 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2011-07-17 01:54:25 +0200 |
commit | 37cdfcf194825d03334542297bee3a3a4723e6e3 (patch) | |
tree | 95a61f09170e10dfcd4485936a2eee9c4ea2782d | |
parent | 5e6b701aba8689a336297dda047bf760ffc05291 (diff) |
xen: add vkbd support for PV on HVM guests
Register the vkbd backend even when running as device emulator for HVM
guests: it is useful because it doesn't need a frequent timer like usb.
Check whether the XenInput DisplayState has been set in the initialise
state, rather than the input state.
In case the DisplayState hasn't been set and there is no vfb for this
domain, then set the XenInput DisplayState to the default one.
Changed in v2:
- use qemu_free instead of free;
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r-- | hw/xenfb.c | 19 | ||||
-rw-r--r-- | xen-all.c | 1 |
2 files changed, 13 insertions, 7 deletions
diff --git a/hw/xenfb.c b/hw/xenfb.c index 1db75fbe49..0a01ae30cc 100644 --- a/hw/xenfb.c +++ b/hw/xenfb.c @@ -347,13 +347,6 @@ static void xenfb_mouse_event(void *opaque, static int input_init(struct XenDevice *xendev) { - struct XenInput *in = container_of(xendev, struct XenInput, c.xendev); - - if (!in->c.ds) { - xen_be_printf(xendev, 1, "ds not set (yet)\n"); - return -1; - } - xenstore_write_be_int(xendev, "feature-abs-pointer", 1); return 0; } @@ -367,6 +360,18 @@ static int input_connect(struct XenDevice *xendev) &in->abs_pointer_wanted) == -1) in->abs_pointer_wanted = 0; + if (!in->c.ds) { + char *vfb = xenstore_read_str(NULL, "device/vfb"); + if (vfb == NULL) { + /* there is no vfb, run vkbd on its own */ + in->c.ds = get_displaystate(); + } else { + qemu_free(vfb); + xen_be_printf(xendev, 1, "ds not set (yet)\n"); + return -1; + } + } + rc = common_bind(&in->c); if (rc != 0) return rc; @@ -868,6 +868,7 @@ int xen_hvm_init(void) exit(1); } xen_be_register("console", &xen_console_ops); + xen_be_register("vkbd", &xen_kbdmouse_ops); xen_be_register("qdisk", &xen_blkdev_ops); return 0; |