Browse Source

hw/input/virtio-input: Remove VirtIOInputHID::wheel_axis field

The VirtIOInputHID::wheel_axis boolean was only set in the
hw_compat_2_10[] array, via the 'wheel-axis=false' property.
We removed all machines using that array, lets remove that
property and all the code around it. There is only one
virtio_input_config[] version for each device, rename it
removing the '_v2' suffix.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250501230129.2596-4-philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
master
Philippe Mathieu-Daudé 11 months ago
committed by Thomas Huth
parent
commit
bb8f84727f
  1. 102
      hw/input/virtio-input-hid.c
  2. 1
      include/hw/virtio/virtio-input.h

102
hw/input/virtio-input-hid.c

@ -81,7 +81,6 @@ static void virtio_input_extend_config(VirtIOInput *vinput,
static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src, static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
InputEvent *evt) InputEvent *evt)
{ {
VirtIOInputHID *vhid = VIRTIO_INPUT_HID(dev);
VirtIOInput *vinput = VIRTIO_INPUT(dev); VirtIOInput *vinput = VIRTIO_INPUT(dev);
virtio_input_event event; virtio_input_event event;
int qcode; int qcode;
@ -109,8 +108,7 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
break; break;
case INPUT_EVENT_KIND_BTN: case INPUT_EVENT_KIND_BTN:
btn = evt->u.btn.data; btn = evt->u.btn.data;
if (vhid->wheel_axis && if ((btn->button == INPUT_BUTTON_WHEEL_UP ||
(btn->button == INPUT_BUTTON_WHEEL_UP ||
btn->button == INPUT_BUTTON_WHEEL_DOWN) && btn->button == INPUT_BUTTON_WHEEL_DOWN) &&
btn->down) { btn->down) {
event.type = cpu_to_le16(EV_REL); event.type = cpu_to_le16(EV_REL);
@ -328,32 +326,7 @@ static const QemuInputHandler virtio_mouse_handler = {
.sync = virtio_input_handle_sync, .sync = virtio_input_handle_sync,
}; };
static struct virtio_input_config virtio_mouse_config_v1[] = { static struct virtio_input_config virtio_mouse_config[] = {
{
.select = VIRTIO_INPUT_CFG_ID_NAME,
.size = sizeof(VIRTIO_ID_NAME_MOUSE),
.u.string = VIRTIO_ID_NAME_MOUSE,
},{
.select = VIRTIO_INPUT_CFG_ID_DEVIDS,
.size = sizeof(struct virtio_input_devids),
.u.ids = {
.bustype = const_le16(BUS_VIRTUAL),
.vendor = const_le16(0x0627), /* same we use for usb hid devices */
.product = const_le16(0x0002),
.version = const_le16(0x0001),
},
},{
.select = VIRTIO_INPUT_CFG_EV_BITS,
.subsel = EV_REL,
.size = 1,
.u.bitmap = {
(1 << REL_X) | (1 << REL_Y),
},
},
{ /* end of list */ },
};
static struct virtio_input_config virtio_mouse_config_v2[] = {
{ {
.select = VIRTIO_INPUT_CFG_ID_NAME, .select = VIRTIO_INPUT_CFG_ID_NAME,
.size = sizeof(VIRTIO_ID_NAME_MOUSE), .size = sizeof(VIRTIO_ID_NAME_MOUSE),
@ -379,26 +352,13 @@ static struct virtio_input_config virtio_mouse_config_v2[] = {
{ /* end of list */ }, { /* end of list */ },
}; };
static const Property virtio_mouse_properties[] = {
DEFINE_PROP_BOOL("wheel-axis", VirtIOInputHID, wheel_axis, true),
};
static void virtio_mouse_class_init(ObjectClass *klass, const void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
device_class_set_props(dc, virtio_mouse_properties);
}
static void virtio_mouse_init(Object *obj) static void virtio_mouse_init(Object *obj)
{ {
VirtIOInputHID *vhid = VIRTIO_INPUT_HID(obj); VirtIOInputHID *vhid = VIRTIO_INPUT_HID(obj);
VirtIOInput *vinput = VIRTIO_INPUT(obj); VirtIOInput *vinput = VIRTIO_INPUT(obj);
vhid->handler = &virtio_mouse_handler; vhid->handler = &virtio_mouse_handler;
virtio_input_init_config(vinput, vhid->wheel_axis virtio_input_init_config(vinput, virtio_mouse_config);
? virtio_mouse_config_v2
: virtio_mouse_config_v1);
virtio_input_extend_config(vinput, keymap_button, virtio_input_extend_config(vinput, keymap_button,
ARRAY_SIZE(keymap_button), ARRAY_SIZE(keymap_button),
VIRTIO_INPUT_CFG_EV_BITS, EV_KEY); VIRTIO_INPUT_CFG_EV_BITS, EV_KEY);
@ -409,7 +369,6 @@ static const TypeInfo virtio_mouse_info = {
.parent = TYPE_VIRTIO_INPUT_HID, .parent = TYPE_VIRTIO_INPUT_HID,
.instance_size = sizeof(VirtIOInputHID), .instance_size = sizeof(VirtIOInputHID),
.instance_init = virtio_mouse_init, .instance_init = virtio_mouse_init,
.class_init = virtio_mouse_class_init,
}; };
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
@ -421,44 +380,7 @@ static const QemuInputHandler virtio_tablet_handler = {
.sync = virtio_input_handle_sync, .sync = virtio_input_handle_sync,
}; };
static struct virtio_input_config virtio_tablet_config_v1[] = { static struct virtio_input_config virtio_tablet_config[] = {
{
.select = VIRTIO_INPUT_CFG_ID_NAME,
.size = sizeof(VIRTIO_ID_NAME_TABLET),
.u.string = VIRTIO_ID_NAME_TABLET,
},{
.select = VIRTIO_INPUT_CFG_ID_DEVIDS,
.size = sizeof(struct virtio_input_devids),
.u.ids = {
.bustype = const_le16(BUS_VIRTUAL),
.vendor = const_le16(0x0627), /* same we use for usb hid devices */
.product = const_le16(0x0003),
.version = const_le16(0x0001),
},
},{
.select = VIRTIO_INPUT_CFG_EV_BITS,
.subsel = EV_ABS,
.size = 1,
.u.bitmap = {
(1 << ABS_X) | (1 << ABS_Y),
},
},{
.select = VIRTIO_INPUT_CFG_ABS_INFO,
.subsel = ABS_X,
.size = sizeof(virtio_input_absinfo),
.u.abs.min = const_le32(INPUT_EVENT_ABS_MIN),
.u.abs.max = const_le32(INPUT_EVENT_ABS_MAX),
},{
.select = VIRTIO_INPUT_CFG_ABS_INFO,
.subsel = ABS_Y,
.size = sizeof(virtio_input_absinfo),
.u.abs.min = const_le32(INPUT_EVENT_ABS_MIN),
.u.abs.max = const_le32(INPUT_EVENT_ABS_MAX),
},
{ /* end of list */ },
};
static struct virtio_input_config virtio_tablet_config_v2[] = {
{ {
.select = VIRTIO_INPUT_CFG_ID_NAME, .select = VIRTIO_INPUT_CFG_ID_NAME,
.size = sizeof(VIRTIO_ID_NAME_TABLET), .size = sizeof(VIRTIO_ID_NAME_TABLET),
@ -503,26 +425,13 @@ static struct virtio_input_config virtio_tablet_config_v2[] = {
{ /* end of list */ }, { /* end of list */ },
}; };
static const Property virtio_tablet_properties[] = {
DEFINE_PROP_BOOL("wheel-axis", VirtIOInputHID, wheel_axis, true),
};
static void virtio_tablet_class_init(ObjectClass *klass, const void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
device_class_set_props(dc, virtio_tablet_properties);
}
static void virtio_tablet_init(Object *obj) static void virtio_tablet_init(Object *obj)
{ {
VirtIOInputHID *vhid = VIRTIO_INPUT_HID(obj); VirtIOInputHID *vhid = VIRTIO_INPUT_HID(obj);
VirtIOInput *vinput = VIRTIO_INPUT(obj); VirtIOInput *vinput = VIRTIO_INPUT(obj);
vhid->handler = &virtio_tablet_handler; vhid->handler = &virtio_tablet_handler;
virtio_input_init_config(vinput, vhid->wheel_axis virtio_input_init_config(vinput, virtio_tablet_config);
? virtio_tablet_config_v2
: virtio_tablet_config_v1);
virtio_input_extend_config(vinput, keymap_button, virtio_input_extend_config(vinput, keymap_button,
ARRAY_SIZE(keymap_button), ARRAY_SIZE(keymap_button),
VIRTIO_INPUT_CFG_EV_BITS, EV_KEY); VIRTIO_INPUT_CFG_EV_BITS, EV_KEY);
@ -533,7 +442,6 @@ static const TypeInfo virtio_tablet_info = {
.parent = TYPE_VIRTIO_INPUT_HID, .parent = TYPE_VIRTIO_INPUT_HID,
.instance_size = sizeof(VirtIOInputHID), .instance_size = sizeof(VirtIOInputHID),
.instance_init = virtio_tablet_init, .instance_init = virtio_tablet_init,
.class_init = virtio_tablet_class_init,
}; };
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */

1
include/hw/virtio/virtio-input.h

@ -89,7 +89,6 @@ struct VirtIOInputHID {
const QemuInputHandler *handler; const QemuInputHandler *handler;
QemuInputHandlerState *hs; QemuInputHandlerState *hs;
int ledstate; int ledstate;
bool wheel_axis;
}; };
struct VirtIOInputHost { struct VirtIOInputHost {

Loading…
Cancel
Save