MAINTAINERS: Make status spellings consistent
[qemu/ar7.git] / include / hw / virtio / virtio-input.h
blobf2da63d309ae1cbac400bda482bba2a2dc2e8560
1 #ifndef QEMU_VIRTIO_INPUT_H
2 #define QEMU_VIRTIO_INPUT_H
4 #include "ui/input.h"
5 #include "sysemu/vhost-user-backend.h"
7 /* ----------------------------------------------------------------- */
8 /* virtio input protocol */
10 #include "standard-headers/linux/virtio_ids.h"
11 #include "standard-headers/linux/virtio_input.h"
12 #include "qom/object.h"
14 typedef struct virtio_input_absinfo virtio_input_absinfo;
15 typedef struct virtio_input_config virtio_input_config;
16 typedef struct virtio_input_event virtio_input_event;
18 /* ----------------------------------------------------------------- */
19 /* qemu internals */
21 #define TYPE_VIRTIO_INPUT "virtio-input-device"
22 OBJECT_DECLARE_TYPE(VirtIOInput, VirtIOInputClass,
23 VIRTIO_INPUT)
24 #define VIRTIO_INPUT_GET_PARENT_CLASS(obj) \
25 OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT)
27 #define TYPE_VIRTIO_INPUT_HID "virtio-input-hid-device"
28 #define TYPE_VIRTIO_KEYBOARD "virtio-keyboard-device"
29 #define TYPE_VIRTIO_MOUSE "virtio-mouse-device"
30 #define TYPE_VIRTIO_TABLET "virtio-tablet-device"
32 OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHID, VIRTIO_INPUT_HID)
33 #define VIRTIO_INPUT_HID_GET_PARENT_CLASS(obj) \
34 OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HID)
36 #define TYPE_VIRTIO_INPUT_HOST "virtio-input-host-device"
37 OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHost, VIRTIO_INPUT_HOST)
38 #define VIRTIO_INPUT_HOST_GET_PARENT_CLASS(obj) \
39 OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HOST)
41 #define TYPE_VHOST_USER_INPUT "vhost-user-input"
42 OBJECT_DECLARE_SIMPLE_TYPE(VHostUserInput, VHOST_USER_INPUT)
43 #define VHOST_USER_INPUT_GET_PARENT_CLASS(obj) \
44 OBJECT_GET_PARENT_CLASS(obj, TYPE_VHOST_USER_INPUT)
46 typedef struct VirtIOInputConfig VirtIOInputConfig;
48 struct VirtIOInputConfig {
49 virtio_input_config config;
50 QTAILQ_ENTRY(VirtIOInputConfig) node;
53 struct VirtIOInput {
54 VirtIODevice parent_obj;
55 uint8_t cfg_select;
56 uint8_t cfg_subsel;
57 uint32_t cfg_size;
58 QTAILQ_HEAD(, VirtIOInputConfig) cfg_list;
59 VirtQueue *evt, *sts;
60 char *serial;
62 struct {
63 virtio_input_event event;
64 VirtQueueElement *elem;
65 } *queue;
66 uint32_t qindex, qsize;
68 bool active;
71 struct VirtIOInputClass {
72 /*< private >*/
73 VirtioDeviceClass parent;
74 /*< public >*/
76 DeviceRealize realize;
77 DeviceUnrealize unrealize;
78 void (*change_active)(VirtIOInput *vinput);
79 void (*handle_status)(VirtIOInput *vinput, virtio_input_event *event);
82 struct VirtIOInputHID {
83 VirtIOInput parent_obj;
84 char *display;
85 uint32_t head;
86 QemuInputHandler *handler;
87 QemuInputHandlerState *hs;
88 int ledstate;
89 bool wheel_axis;
92 struct VirtIOInputHost {
93 VirtIOInput parent_obj;
94 char *evdev;
95 int fd;
98 struct VHostUserInput {
99 VirtIOInput parent_obj;
101 VhostUserBackend *vhost;
104 void virtio_input_send(VirtIOInput *vinput, virtio_input_event *event);
105 void virtio_input_init_config(VirtIOInput *vinput,
106 virtio_input_config *config);
107 virtio_input_config *virtio_input_find_config(VirtIOInput *vinput,
108 uint8_t select,
109 uint8_t subsel);
110 void virtio_input_add_config(VirtIOInput *vinput,
111 virtio_input_config *config);
112 void virtio_input_idstr_config(VirtIOInput *vinput,
113 uint8_t select, const char *string);
115 #endif /* QEMU_VIRTIO_INPUT_H */