aboutsummaryrefslogtreecommitdiff
path: root/include/hw/virtio/virtio-input.h
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2014-04-01 10:06:29 +0200
committerGerd Hoffmann <kraxel@redhat.com>2015-05-29 10:30:40 +0200
commit55a1d80a41032d6133adec041c0096820beaa1b7 (patch)
treed4eb032b9ad7fbb54c6b2766493b752da00f3490 /include/hw/virtio/virtio-input.h
parentf73ddbad397f98c1d476ffbf93d65af1cfa796e6 (diff)
virtio-input: emulated devices [device]
This patch adds the virtio-input-hid base class and virtio-{keyboard,mouse,tablet} subclasses building on the base class. They are hooked up to the qemu input core and deliver input events to the guest like all other hid devices (ps/2 kbd, usb tablet, ...). Using them is as simple as adding "-device virtio-tablet-device" to your command line, for use all transports except pci. virtio-pci support comes as separate patch, once virtio-pci got virtio 1.0 support. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'include/hw/virtio/virtio-input.h')
-rw-r--r--include/hw/virtio/virtio-input.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h
index ad915cc7c1..a265519e1e 100644
--- a/include/hw/virtio/virtio-input.h
+++ b/include/hw/virtio/virtio-input.h
@@ -34,9 +34,23 @@ typedef struct virtio_input_event virtio_input_event;
#define VIRTIO_INPUT_CLASS(klass) \
OBJECT_CLASS_CHECK(VirtIOInputClass, klass, TYPE_VIRTIO_INPUT)
+#define TYPE_VIRTIO_INPUT_HID "virtio-input-hid"
+#define TYPE_VIRTIO_KEYBOARD "virtio-keyboard"
+#define TYPE_VIRTIO_MOUSE "virtio-mouse"
+#define TYPE_VIRTIO_TABLET "virtio-tablet"
+
+#define VIRTIO_INPUT_HID(obj) \
+ OBJECT_CHECK(VirtIOInputHID, (obj), TYPE_VIRTIO_INPUT_HID)
+#define VIRTIO_INPUT_HID_GET_PARENT_CLASS(obj) \
+ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HID)
+
+#define DEFINE_VIRTIO_INPUT_PROPERTIES(_state, _field) \
+ DEFINE_PROP_STRING("serial", _state, _field.serial)
+
typedef struct VirtIOInput VirtIOInput;
typedef struct VirtIOInputClass VirtIOInputClass;
typedef struct VirtIOInputConfig VirtIOInputConfig;
+typedef struct VirtIOInputHID VirtIOInputHID;
struct virtio_input_conf {
char *serial;
@@ -73,6 +87,13 @@ struct VirtIOInputClass {
void (*handle_status)(VirtIOInput *vinput, virtio_input_event *event);
};
+struct VirtIOInputHID {
+ VirtIOInput parent_obj;
+ QemuInputHandler *handler;
+ QemuInputHandlerState *hs;
+ int ledstate;
+};
+
void virtio_input_send(VirtIOInput *vinput, virtio_input_event *event);
void virtio_input_init_config(VirtIOInput *vinput,
virtio_input_config *config);