2016-06-29 14:47:03 +03:00
|
|
|
#ifndef QEMU_VIRTIO_INPUT_H
|
|
|
|
#define QEMU_VIRTIO_INPUT_H
|
2014-03-14 17:39:20 +04:00
|
|
|
|
|
|
|
#include "ui/input.h"
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------- */
|
|
|
|
/* virtio input protocol */
|
|
|
|
|
|
|
|
#include "standard-headers/linux/virtio_ids.h"
|
|
|
|
#include "standard-headers/linux/virtio_input.h"
|
|
|
|
|
|
|
|
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"
|
|
|
|
#define VIRTIO_INPUT(obj) \
|
|
|
|
OBJECT_CHECK(VirtIOInput, (obj), TYPE_VIRTIO_INPUT)
|
|
|
|
#define VIRTIO_INPUT_GET_PARENT_CLASS(obj) \
|
|
|
|
OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT)
|
|
|
|
#define VIRTIO_INPUT_GET_CLASS(obj) \
|
|
|
|
OBJECT_GET_CLASS(VirtIOInputClass, obj, TYPE_VIRTIO_INPUT)
|
|
|
|
#define VIRTIO_INPUT_CLASS(klass) \
|
|
|
|
OBJECT_CLASS_CHECK(VirtIOInputClass, klass, TYPE_VIRTIO_INPUT)
|
|
|
|
|
2015-06-02 11:31:29 +03: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 12:06:29 +04:00
|
|
|
|
|
|
|
#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)
|
|
|
|
|
2014-03-28 12:18:47 +04:00
|
|
|
#define TYPE_VIRTIO_INPUT_HOST "virtio-input-host-device"
|
|
|
|
#define VIRTIO_INPUT_HOST(obj) \
|
|
|
|
OBJECT_CHECK(VirtIOInputHost, (obj), TYPE_VIRTIO_INPUT_HOST)
|
|
|
|
#define VIRTIO_INPUT_HOST_GET_PARENT_CLASS(obj) \
|
|
|
|
OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HOST)
|
|
|
|
|
2014-03-14 17:39:20 +04:00
|
|
|
typedef struct VirtIOInput VirtIOInput;
|
|
|
|
typedef struct VirtIOInputClass VirtIOInputClass;
|
|
|
|
typedef struct VirtIOInputConfig VirtIOInputConfig;
|
2014-04-01 12:06:29 +04:00
|
|
|
typedef struct VirtIOInputHID VirtIOInputHID;
|
2014-03-28 12:18:47 +04:00
|
|
|
typedef struct VirtIOInputHost VirtIOInputHost;
|
2014-03-14 17:39:20 +04:00
|
|
|
|
|
|
|
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 18:45:47 +03:00
|
|
|
char *serial;
|
2014-03-14 17:39:20 +04:00
|
|
|
|
|
|
|
virtio_input_event *queue;
|
|
|
|
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 12:06:29 +04:00
|
|
|
struct VirtIOInputHID {
|
|
|
|
VirtIOInput parent_obj;
|
2015-06-24 12:59:16 +03:00
|
|
|
char *display;
|
|
|
|
uint32_t head;
|
2014-04-01 12:06:29 +04:00
|
|
|
QemuInputHandler *handler;
|
|
|
|
QemuInputHandlerState *hs;
|
|
|
|
int ledstate;
|
|
|
|
};
|
|
|
|
|
2014-03-28 12:18:47 +04:00
|
|
|
struct VirtIOInputHost {
|
|
|
|
VirtIOInput parent_obj;
|
|
|
|
char *evdev;
|
|
|
|
int fd;
|
|
|
|
};
|
|
|
|
|
2014-03-14 17:39:20 +04: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 17:43:23 +03:00
|
|
|
virtio_input_config *virtio_input_find_config(VirtIOInput *vinput,
|
|
|
|
uint8_t select,
|
|
|
|
uint8_t subsel);
|
2014-03-14 17:39:20 +04: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 14:47:03 +03:00
|
|
|
#endif /* QEMU_VIRTIO_INPUT_H */
|