Skip to contentSkip to conversation

virtio-input: send rel-wheel events for wheel buttons

PATCH New Gerd Hoffmann 1 participant 1 message Sep 26, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 virtio-input: send rel-wheel events for wheel buttons

qemu uses wheel-up/down button events for mouse wheel input, however linux applications typically want REL_WHEEL events.

This fixes wheel with linux guests. Tested with X11/wayland, and windows virtio-input driver.

Based on a patch from Marc.
Added property to enable/disable wheel axis.

Cc Marc-André Lureau <[email protected]>
---
 include/hw/compat.h              |  10 +++-
 include/hw/virtio/virtio-input.h |   1 +
 hw/input/virtio-input-hid.c      | 119 +++++++++++++++++++++++++++++++++++++--
 3 files changed, 124 insertions(+), 6 deletions(-)
include/hw/compat.h +9 -1
index 9cc14dd798..cf389b4e85 100644
@@ -2,7 +2,15 @@
 #define HW_COMPAT_H
 
 #define HW_COMPAT_2_10 \
-    /* empty */
+    {\
+        .driver   = "virtio-mouse-device",\
+        .property = "wheel-axis",\
+        .value    = "false",\
+    },{\
+        .driver   = "virtio-tablet-device",\
+        .property = "wheel-axis",\
+        .value    = "false",\
+    },
 
 #define HW_COMPAT_2_9 \
     {\
include/hw/virtio/virtio-input.h +1 -0
index 91df57eca4..054c38836f 100644
@@ -89,6 +89,7 @@ struct VirtIOInputHID {
     QemuInputHandler                  *handler;
     QemuInputHandlerState             *hs;
     int                               ledstate;
+    bool                              wheel_axis;
 };
 
 struct VirtIOInputHost {
hw/input/virtio-input-hid.c +114 -5

179 lines not on this page · raw message

Signature · 1 line
2.9.3