2016-06-29 13:47:03 +02:00
|
|
|
#ifndef QEMU_VIRTIO_INPUT_H
|
|
|
|
#define QEMU_VIRTIO_INPUT_H
|
2014-03-14 14:39:20 +01:00
|
|
|
|
|
|
|
#include "ui/input.h"
|
2019-05-03 15:00:32 +02:00
|
|
|
#include "sysemu/vhost-user-backend.h"
|
2014-03-14 14:39:20 +01:00
|
|
|
|
|
|
|
/* ----------------------------------------------------------------- */
|
|
|
|
/* virtio input protocol */
|
|
|
|
|
|
|
|
#include "standard-headers/linux/virtio_ids.h"
|
|
|
|
#include "standard-headers/linux/virtio_input.h"
|
2020-09-03 22:43:22 +02:00
|
|
|
#include "qom/object.h"
|
2014-03-14 14:39:20 +01:00
|
|
|
|
|
|
|
typedef struct virtio_input_absinfo virtio_input_absinfo;
|
|
|
|
typedef struct virtio_input_config virtio_input_config;
|
|
|
|
typedef struct virtio_input_event virtio_input_event;
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------- */
|
|
|
|
/* qemu internals */
|
|
|
|
|
|
|
|
#define TYPE_VIRTIO_INPUT "virtio-input-device"
|
2020-08-31 23:07:37 +02:00
|
|
|
OBJECT_DECLARE_TYPE(VirtIOInput, VirtIOInputClass,
|
qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros
One of the goals of having less boilerplate on QOM declarations
is to avoid human error. Requiring an extra argument that is
never used is an opportunity for mistakes.
Remove the unused argument from OBJECT_DECLARE_TYPE and
OBJECT_DECLARE_SIMPLE_TYPE.
Coccinelle patch used to convert all users of the macros:
@@
declarer name OBJECT_DECLARE_TYPE;
identifier InstanceType, ClassType, lowercase, UPPERCASE;
@@
OBJECT_DECLARE_TYPE(InstanceType, ClassType,
- lowercase,
UPPERCASE);
@@
declarer name OBJECT_DECLARE_SIMPLE_TYPE;
identifier InstanceType, lowercase, UPPERCASE;
@@
OBJECT_DECLARE_SIMPLE_TYPE(InstanceType,
- lowercase,
UPPERCASE);
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Paul Durrant <paul@xen.org>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200916182519.415636-4-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-09-16 20:25:17 +02:00
|
|
|
VIRTIO_INPUT)
|
2014-03-14 14:39:20 +01:00
|
|
|
#define VIRTIO_INPUT_GET_PARENT_CLASS(obj) \
|
|
|
|
OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT)
|
|
|
|
|
2015-06-02 10:31:29 +02:00
|
|
|
#define TYPE_VIRTIO_INPUT_HID "virtio-input-hid-device"
|
|
|
|
#define TYPE_VIRTIO_KEYBOARD "virtio-keyboard-device"
|
|
|
|
#define TYPE_VIRTIO_MOUSE "virtio-mouse-device"
|
|
|
|
#define TYPE_VIRTIO_TABLET "virtio-tablet-device"
|
2014-04-01 10:06:29 +02:00
|
|
|
|
2020-09-16 20:25:19 +02:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHID, VIRTIO_INPUT_HID)
|
2014-04-01 10:06:29 +02:00
|
|
|
#define VIRTIO_INPUT_HID_GET_PARENT_CLASS(obj) \
|
|
|
|
OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HID)
|
|
|
|
|
2014-03-28 09:18:47 +01:00
|
|
|
#define TYPE_VIRTIO_INPUT_HOST "virtio-input-host-device"
|
2020-09-16 20:25:19 +02:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHost, VIRTIO_INPUT_HOST)
|
2014-03-28 09:18:47 +01:00
|
|
|
#define VIRTIO_INPUT_HOST_GET_PARENT_CLASS(obj) \
|
|
|
|
OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HOST)
|
|
|
|
|
2019-05-03 15:00:32 +02:00
|
|
|
#define TYPE_VHOST_USER_INPUT "vhost-user-input"
|
2020-09-16 20:25:19 +02:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(VHostUserInput, VHOST_USER_INPUT)
|
2019-05-03 15:00:32 +02:00
|
|
|
#define VHOST_USER_INPUT_GET_PARENT_CLASS(obj) \
|
|
|
|
OBJECT_GET_PARENT_CLASS(obj, TYPE_VHOST_USER_INPUT)
|
|
|
|
|
2014-03-14 14:39:20 +01:00
|
|
|
typedef struct VirtIOInputConfig VirtIOInputConfig;
|
|
|
|
|
|
|
|
struct VirtIOInputConfig {
|
|
|
|
virtio_input_config config;
|
|
|
|
QTAILQ_ENTRY(VirtIOInputConfig) node;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct VirtIOInput {
|
|
|
|
VirtIODevice parent_obj;
|
|
|
|
uint8_t cfg_select;
|
|
|
|
uint8_t cfg_subsel;
|
|
|
|
uint32_t cfg_size;
|
|
|
|
QTAILQ_HEAD(, VirtIOInputConfig) cfg_list;
|
|
|
|
VirtQueue *evt, *sts;
|
2015-06-18 17:45:47 +02:00
|
|
|
char *serial;
|
2014-03-14 14:39:20 +01:00
|
|
|
|
2017-03-24 15:24:50 +01:00
|
|
|
struct {
|
|
|
|
virtio_input_event event;
|
|
|
|
VirtQueueElement *elem;
|
|
|
|
} *queue;
|
2014-03-14 14:39:20 +01:00
|
|
|
uint32_t qindex, qsize;
|
|
|
|
|
|
|
|
bool active;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct VirtIOInputClass {
|
|
|
|
/*< private >*/
|
|
|
|
VirtioDeviceClass parent;
|
|
|
|
/*< public >*/
|
|
|
|
|
|
|
|
DeviceRealize realize;
|
|
|
|
DeviceUnrealize unrealize;
|
|
|
|
void (*change_active)(VirtIOInput *vinput);
|
|
|
|
void (*handle_status)(VirtIOInput *vinput, virtio_input_event *event);
|
|
|
|
};
|
|
|
|
|
2014-04-01 10:06:29 +02:00
|
|
|
struct VirtIOInputHID {
|
|
|
|
VirtIOInput parent_obj;
|
2015-06-24 11:59:16 +02:00
|
|
|
char *display;
|
|
|
|
uint32_t head;
|
2014-04-01 10:06:29 +02:00
|
|
|
QemuInputHandler *handler;
|
|
|
|
QemuInputHandlerState *hs;
|
|
|
|
int ledstate;
|
2017-09-26 13:32:43 +02:00
|
|
|
bool wheel_axis;
|
2014-04-01 10:06:29 +02:00
|
|
|
};
|
|
|
|
|
2014-03-28 09:18:47 +01:00
|
|
|
struct VirtIOInputHost {
|
|
|
|
VirtIOInput parent_obj;
|
|
|
|
char *evdev;
|
|
|
|
int fd;
|
|
|
|
};
|
|
|
|
|
2019-05-03 15:00:32 +02:00
|
|
|
struct VHostUserInput {
|
|
|
|
VirtIOInput parent_obj;
|
|
|
|
|
|
|
|
VhostUserBackend *vhost;
|
|
|
|
};
|
|
|
|
|
2014-03-14 14:39:20 +01:00
|
|
|
void virtio_input_send(VirtIOInput *vinput, virtio_input_event *event);
|
|
|
|
void virtio_input_init_config(VirtIOInput *vinput,
|
|
|
|
virtio_input_config *config);
|
2016-04-13 16:43:23 +02:00
|
|
|
virtio_input_config *virtio_input_find_config(VirtIOInput *vinput,
|
|
|
|
uint8_t select,
|
|
|
|
uint8_t subsel);
|
2014-03-14 14:39:20 +01:00
|
|
|
void virtio_input_add_config(VirtIOInput *vinput,
|
|
|
|
virtio_input_config *config);
|
|
|
|
void virtio_input_idstr_config(VirtIOInput *vinput,
|
|
|
|
uint8_t select, const char *string);
|
|
|
|
|
2016-06-29 13:47:03 +02:00
|
|
|
#endif /* QEMU_VIRTIO_INPUT_H */
|