diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2023-10-30 11:48:02 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2023-11-02 12:52:06 +0000 |
commit | 7c76f397fde313bcdfd3781d64fc28dae0e42df8 (patch) | |
tree | 65c4871d09fd2ba9e694e2b0298ae5e49e08fe1b /hw/arm | |
parent | a75f336b97a643fc536ba847042f840890e9b378 (diff) | |
download | qemu-7c76f397fde313bcdfd3781d64fc28dae0e42df8.zip qemu-7c76f397fde313bcdfd3781d64fc28dae0e42df8.tar.gz qemu-7c76f397fde313bcdfd3781d64fc28dae0e42df8.tar.bz2 |
hw/input/stellaris_gamepad: Convert to qemu_input_handler_register()
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>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20231030114802.3671871-7-peter.maydell@linaro.org
Diffstat (limited to 'hw/arm')
-rw-r--r-- | hw/arm/stellaris.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 707b0da..dd90f68 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -32,6 +32,7 @@ #include "hw/qdev-clock.h" #include "qom/object.h" #include "qapi/qmp/qlist.h" +#include "ui/input.h" #define GPIO_A 0 #define GPIO_B 1 @@ -1276,7 +1277,10 @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board) } if (board->peripherals & BP_GAMEPAD) { QList *gpad_keycode_list = qlist_new(); - static const int gpad_keycode[5] = { 0xc8, 0xd0, 0xcb, 0xcd, 0x1d }; + static const int gpad_keycode[5] = { + Q_KEY_CODE_UP, Q_KEY_CODE_DOWN, Q_KEY_CODE_LEFT, + Q_KEY_CODE_RIGHT, Q_KEY_CODE_CTRL, + }; DeviceState *gpad; gpad = qdev_new(TYPE_STELLARIS_GAMEPAD); |