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>
Philippe Mathieu-Daudé committed
May 2, 2025 at 01:01 UTC
bb8f84727fa6cc310107c8b065e8952edf9b7756
2 files changed
+5
-98
hw/input/virtio-input-hid.c
+5
-97
@@ -81,7 +81,6 @@ static void virtio_input_extend_config(VirtIOInput *vinput,
81
static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
82
InputEvent *evt)
83
{
84
- VirtIOInputHID *vhid = VIRTIO_INPUT_HID(dev);
84
VirtIOInput *vinput = VIRTIO_INPUT(dev);
85
virtio_input_event event;
86
int qcode;
@@ -109,8 +108,7 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
108
break;
109
case INPUT_EVENT_KIND_BTN:
110
btn = evt->u.btn.data;
112
- if (vhid->wheel_axis &&
113
- (btn->button == INPUT_BUTTON_WHEEL_UP ||
111
+ if ((btn->button == INPUT_BUTTON_WHEEL_UP ||
112
btn->button == INPUT_BUTTON_WHEEL_DOWN) &&
113
btn->down) {
114
event.type = cpu_to_le16(EV_REL);
@@ -328,32 +326,7 @@ static const QemuInputHandler virtio_mouse_handler = {
326
.sync = virtio_input_handle_sync,
327
};
328
331
-static struct virtio_input_config virtio_mouse_config_v1[] = {
332
- {
333
- .select = VIRTIO_INPUT_CFG_ID_NAME,
334
- .size = sizeof(VIRTIO_ID_NAME_MOUSE),
335
- .u.string = VIRTIO_ID_NAME_MOUSE,
336
- },{
337
- .select = VIRTIO_INPUT_CFG_ID_DEVIDS,
338
- .size = sizeof(struct virtio_input_devids),
339
- .u.ids = {
340
- .bustype = const_le16(BUS_VIRTUAL),
341
- .vendor = const_le16(0x0627), /* same we use for usb hid devices */
342
- .product = const_le16(0x0002),
343
- .version = const_le16(0x0001),
344
- },
345
- },{
346
- .select = VIRTIO_INPUT_CFG_EV_BITS,
347
- .subsel = EV_REL,
348
- .size = 1,
349
- .u.bitmap = {
350
- (1 << REL_X) | (1 << REL_Y),
351
- },
352
- },
353
- { /* end of list */ },
354
-};
355
-
356
-static struct virtio_input_config virtio_mouse_config_v2[] = {
329
+static struct virtio_input_config virtio_mouse_config[] = {
330
{
331
.select = VIRTIO_INPUT_CFG_ID_NAME,
332
.size = sizeof(VIRTIO_ID_NAME_MOUSE),
@@ -379,26 +352,13 @@ static struct virtio_input_config virtio_mouse_config_v2[] = {
352
{ /* end of list */ },
353
};
354
382
-static const Property virtio_mouse_properties[] = {
383
- DEFINE_PROP_BOOL("wheel-axis", VirtIOInputHID, wheel_axis, true),
384
-};
385
-
386
-static void virtio_mouse_class_init(ObjectClass *klass, const void *data)
387
-{
388
- DeviceClass *dc = DEVICE_CLASS(klass);
389
-
390
- device_class_set_props(dc, virtio_mouse_properties);
391
-}
392
-
355
static void virtio_mouse_init(Object *obj)
356
{
357
VirtIOInputHID *vhid = VIRTIO_INPUT_HID(obj);
358
VirtIOInput *vinput = VIRTIO_INPUT(obj);
359
360
vhid->handler = &virtio_mouse_handler;
399
- virtio_input_init_config(vinput, vhid->wheel_axis
400
- ? virtio_mouse_config_v2
401
- : virtio_mouse_config_v1);
361
+ virtio_input_init_config(vinput, virtio_mouse_config);
362
virtio_input_extend_config(vinput, keymap_button,
363
ARRAY_SIZE(keymap_button),
364
VIRTIO_INPUT_CFG_EV_BITS, EV_KEY);
@@ -409,7 +369,6 @@ static const TypeInfo virtio_mouse_info = {
369
.parent = TYPE_VIRTIO_INPUT_HID,
370
.instance_size = sizeof(VirtIOInputHID),
371
.instance_init = virtio_mouse_init,
412
- .class_init = virtio_mouse_class_init,
372
};
373
374
/* ----------------------------------------------------------------- */
@@ -421,44 +380,7 @@ static const QemuInputHandler virtio_tablet_handler = {
380
.sync = virtio_input_handle_sync,
381
};
382
424
-static struct virtio_input_config virtio_tablet_config_v1[] = {
425
- {
426
- .select = VIRTIO_INPUT_CFG_ID_NAME,
427
- .size = sizeof(VIRTIO_ID_NAME_TABLET),
428
- .u.string = VIRTIO_ID_NAME_TABLET,
429
- },{
430
- .select = VIRTIO_INPUT_CFG_ID_DEVIDS,
431
- .size = sizeof(struct virtio_input_devids),
432
- .u.ids = {
433
- .bustype = const_le16(BUS_VIRTUAL),
434
- .vendor = const_le16(0x0627), /* same we use for usb hid devices */
435
- .product = const_le16(0x0003),
436
- .version = const_le16(0x0001),
437
- },
438
- },{
439
- .select = VIRTIO_INPUT_CFG_EV_BITS,
440
- .subsel = EV_ABS,
441
- .size = 1,
442
- .u.bitmap = {
443
- (1 << ABS_X) | (1 << ABS_Y),
444
- },
445
- },{
446
- .select = VIRTIO_INPUT_CFG_ABS_INFO,
447
- .subsel = ABS_X,
448
- .size = sizeof(virtio_input_absinfo),
449
- .u.abs.min = const_le32(INPUT_EVENT_ABS_MIN),
450
- .u.abs.max = const_le32(INPUT_EVENT_ABS_MAX),
451
- },{
452
- .select = VIRTIO_INPUT_CFG_ABS_INFO,
453
- .subsel = ABS_Y,
454
- .size = sizeof(virtio_input_absinfo),
455
- .u.abs.min = const_le32(INPUT_EVENT_ABS_MIN),
456
- .u.abs.max = const_le32(INPUT_EVENT_ABS_MAX),
457
- },
458
- { /* end of list */ },
459
-};
460
-
461
-static struct virtio_input_config virtio_tablet_config_v2[] = {
383
+static struct virtio_input_config virtio_tablet_config[] = {
384
{
385
.select = VIRTIO_INPUT_CFG_ID_NAME,
386
.size = sizeof(VIRTIO_ID_NAME_TABLET),
@@ -503,26 +425,13 @@ static struct virtio_input_config virtio_tablet_config_v2[] = {
425
{ /* end of list */ },
426
};
427
506
-static const Property virtio_tablet_properties[] = {
507
- DEFINE_PROP_BOOL("wheel-axis", VirtIOInputHID, wheel_axis, true),
508
-};
509
-
510
-static void virtio_tablet_class_init(ObjectClass *klass, const void *data)
511
-{
512
- DeviceClass *dc = DEVICE_CLASS(klass);
513
-
514
- device_class_set_props(dc, virtio_tablet_properties);
515
-}
516
-
428
static void virtio_tablet_init(Object *obj)
429
{
430
VirtIOInputHID *vhid = VIRTIO_INPUT_HID(obj);
431
VirtIOInput *vinput = VIRTIO_INPUT(obj);
432
433
vhid->handler = &virtio_tablet_handler;
523
- virtio_input_init_config(vinput, vhid->wheel_axis
524
- ? virtio_tablet_config_v2
525
- : virtio_tablet_config_v1);
434
+ virtio_input_init_config(vinput, virtio_tablet_config);
435
virtio_input_extend_config(vinput, keymap_button,
436
ARRAY_SIZE(keymap_button),
437
VIRTIO_INPUT_CFG_EV_BITS, EV_KEY);
@@ -533,7 +442,6 @@ static const TypeInfo virtio_tablet_info = {
442
.parent = TYPE_VIRTIO_INPUT_HID,
443
.instance_size = sizeof(VirtIOInputHID),
444
.instance_init = virtio_tablet_init,
536
- .class_init = virtio_tablet_class_init,
445
};
446
447
/* ----------------------------------------------------------------- */
include/hw/virtio/virtio-input.h
-1
@@ -89,7 +89,6 @@ struct VirtIOInputHID {
89
const QemuInputHandler *handler;
90
QemuInputHandlerState *hs;
91
int ledstate;
92
- bool wheel_axis;
92
};
93
94
struct VirtIOInputHost {