1 #ifndef QEMU_VIRTIO_INPUT_H
2 #define QEMU_VIRTIO_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 /* ----------------------------------------------------------------- */
21 #define TYPE_VIRTIO_INPUT "virtio-input-device"
22 OBJECT_DECLARE_TYPE(VirtIOInput
, VirtIOInputClass
,
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"
31 #define TYPE_VIRTIO_MULTITOUCH "virtio-multitouch-device"
33 OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHID
, VIRTIO_INPUT_HID
)
34 #define VIRTIO_INPUT_HID_GET_PARENT_CLASS(obj) \
35 OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HID)
37 #define TYPE_VIRTIO_INPUT_HOST "virtio-input-host-device"
38 OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHost
, VIRTIO_INPUT_HOST
)
39 #define VIRTIO_INPUT_HOST_GET_PARENT_CLASS(obj) \
40 OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HOST)
42 #define TYPE_VHOST_USER_INPUT "vhost-user-input"
43 OBJECT_DECLARE_SIMPLE_TYPE(VHostUserInput
, VHOST_USER_INPUT
)
44 #define VHOST_USER_INPUT_GET_PARENT_CLASS(obj) \
45 OBJECT_GET_PARENT_CLASS(obj, TYPE_VHOST_USER_INPUT)
47 typedef struct VirtIOInputConfig VirtIOInputConfig
;
49 struct VirtIOInputConfig
{
50 virtio_input_config config
;
51 QTAILQ_ENTRY(VirtIOInputConfig
) node
;
55 VirtIODevice parent_obj
;
59 QTAILQ_HEAD(, VirtIOInputConfig
) cfg_list
;
64 virtio_input_event event
;
65 VirtQueueElement
*elem
;
67 uint32_t qindex
, qsize
;
72 struct VirtIOInputClass
{
74 VirtioDeviceClass parent
;
77 DeviceRealize realize
;
78 DeviceUnrealize unrealize
;
79 void (*change_active
)(VirtIOInput
*vinput
);
80 void (*handle_status
)(VirtIOInput
*vinput
, virtio_input_event
*event
);
83 struct VirtIOInputHID
{
84 VirtIOInput parent_obj
;
87 QemuInputHandler
*handler
;
88 QemuInputHandlerState
*hs
;
93 struct VirtIOInputHost
{
94 VirtIOInput parent_obj
;
99 struct VHostUserInput
{
100 VirtIOInput parent_obj
;
102 VhostUserBackend
*vhost
;
105 void virtio_input_send(VirtIOInput
*vinput
, virtio_input_event
*event
);
106 void virtio_input_init_config(VirtIOInput
*vinput
,
107 virtio_input_config
*config
);
108 virtio_input_config
*virtio_input_find_config(VirtIOInput
*vinput
,
111 void virtio_input_add_config(VirtIOInput
*vinput
,
112 virtio_input_config
*config
);
113 void virtio_input_idstr_config(VirtIOInput
*vinput
,
114 uint8_t select
, const char *string
);
116 #endif /* QEMU_VIRTIO_INPUT_H */