qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 6/6] hw/input/stellaris_gamepad: Convert to qemu_input_handle


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 6/6] hw/input/stellaris_gamepad: Convert to qemu_input_handler_register()
Date: Thu, 19 Oct 2023 23:47:30 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

Hi Peter,

On 17/10/23 14:23, Peter Maydell wrote:
Now that we have converted to qdev, we can use the newer
qemu_input_handler_register() API rather than the legacy
qemu_add_kbd_event_handler().

Since we only have one user, take the opportunity to convert
from scancodes to QCodes, rather than using
qemu_input_key_value_to_scancode() (which adds an 0xe0
prefix and encodes up/down indication in the scancode,
which our old handler function then had to reverse). That
lets us drop the old state field which was tracking whether
we were halfway through a two-byte scancode.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
  include/hw/input/stellaris_gamepad.h |  2 +-
  hw/arm/stellaris.c                   |  6 ++++-
  hw/input/stellaris_gamepad.c         | 33 +++++++++++++---------------
  3 files changed, 21 insertions(+), 20 deletions(-)

If 20231019211814.30576-47-philmd@linaro.org/">https://lore.kernel.org/qemu-devel/20231019211814.30576-47-philmd@linaro.org/
gets merged before you respin, this structure needs to be declared
const:

+static QemuInputHandler stellaris_gamepad_handler = {
+    .name = "Stellaris Gamepad",
+    .mask = INPUT_EVENT_MASK_KEY,
+    .event = stellaris_gamepad_event,
+};




reply via email to

[Prev in Thread] Current Thread [Next in Thread]