Hi Mark,
On 7/9/24 19:37, Mark Cave-Ayland wrote:
Update the ADB mouse implementation to use QemuInputHandler instead of the
legacy qemu_add_mouse_event_handler() function.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/input/adb-mouse.c | 56 ++++++++++++++++++++++++++++++++++++--------
1 file changed, 46 insertions(+), 10 deletions(-)
v2:
- Rebase onto master
- Replace (DeviceState *)s with dev in adb_mouse_realize() as suggested by
Phil
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
+static const QemuInputHandler adb_mouse_handler = {
+ .name = "QEMU ADB Mouse",
+ .mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
+ .event = adb_mouse_handle_event,
+};
Do you mind if you amend your comment from v1 for clarity?
I could squash the following and take in my next PR:
diff --git a/hw/input/adb-mouse.c b/hw/input/adb-mouse.c
index c0e0282fee..15e6e91804 100644
--- a/hw/input/adb-mouse.c
+++ b/hw/input/adb-mouse.c
@@ -97,6 +97,11 @@ static const QemuInputHandler adb_mouse_handler = {
.name = "QEMU ADB Mouse",
.mask = INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_REL,
.event = adb_mouse_handle_event,
+ /*
+ * We do not need the .sync handler because unlike e.g. PS/2 where async
+ * mouse events are sent over the serial port, an ADB mouse is constantly
+ * polled by the host via the adb_mouse_poll() callback.
+ */
};
Regards,
Phil.