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(-)
static const VMStateDescription vmstate_stellaris_gamepad = {
@@ -44,13 +36,18 @@ static const VMStateDescription vmstate_stellaris_gamepad =
{
.version_id = 2,
.minimum_version_id = 2,
.fields = (VMStateField[]) {
- VMSTATE_INT32(extension, StellarisGamepad),
VMSTATE_VARRAY_UINT32(pressed, StellarisGamepad, num_buttons,
0, vmstate_info_uint8, uint8_t),
VMSTATE_END_OF_LIST()
}
};