[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH v4 4/5] adb.c: prevent NO_KEY value from going to
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PATCH v4 4/5] adb.c: prevent NO_KEY value from going to guest |
Date: |
Mon, 15 Aug 2016 22:11:08 +1000 |
User-agent: |
Mutt/1.6.2 (2016-07-01) |
On Fri, Aug 12, 2016 at 08:10:02PM -0400, John Arbuckle wrote:
> The NO_KEY value should not be sent to the guest. This patch drops that value.
>
> Signed-off-by: John Arbuckle <address@hidden>
> Reviewed-by: Peter Maydell <address@hidden>
> ---
> v4 changes:
> Added NO_KEY related code to this patch.
> Added removal of "= 0" code near end of qcode_to_adb_keycode.
There seem to be two separate parts to this: first, adding NO_KEY
mappings to the translate table - which looks like it should be folded
into an earlier patch. Second not passing those to the guest; I'm
less clear if that's a separate fix to the original code, or a fix to
an earlier patch in this series which should be folded in.
>
> hw/input/adb.c | 23 ++++++++---------------
> 1 file changed, 8 insertions(+), 15 deletions(-)
>
> diff --git a/hw/input/adb.c b/hw/input/adb.c
> index 5ca7b4a..2042903 100644
> --- a/hw/input/adb.c
> +++ b/hw/input/adb.c
> @@ -62,6 +62,9 @@ do { printf("ADB: " fmt , ## __VA_ARGS__); } while (0)
> /* error codes */
> #define ADB_RET_NOTPRESENT (-2)
>
> +/* The adb keyboard doesn't have every key imaginable */
> +#define NO_KEY 0xff
> +
> static void adb_device_reset(ADBDevice *d)
> {
> qdev_reset_all(DEVICE(d));
> @@ -191,6 +194,8 @@ typedef struct ADBKeyboardClass {
> } ADBKeyboardClass;
>
> int qcode_to_adb_keycode[] = {
> + /* Make sure future additions are automatically set to NO_KEY */
> + [0 ... 0xff] = NO_KEY,
>
> [Q_KEY_CODE_SHIFT] = ADB_KEY_LEFT_SHIFT,
> [Q_KEY_CODE_SHIFT_R] = ADB_KEY_RIGHT_SHIFT,
> @@ -305,20 +310,6 @@ int qcode_to_adb_keycode[] = {
> [Q_KEY_CODE_END] = ADB_KEY_END,
> [Q_KEY_CODE_PGUP] = ADB_KEY_PAGE_UP,
> [Q_KEY_CODE_PGDN] = ADB_KEY_PAGE_DOWN,
> -
> - [Q_KEY_CODE_LESS] = 0xa,
> - [Q_KEY_CODE_STOP] = 0,
> - [Q_KEY_CODE_AGAIN] = 0,
> - [Q_KEY_CODE_PROPS] = 0,
> - [Q_KEY_CODE_UNDO] = 0,
> - [Q_KEY_CODE_FRONT] = 0,
> - [Q_KEY_CODE_COPY] = 0,
> - [Q_KEY_CODE_OPEN] = 0,
> - [Q_KEY_CODE_PASTE] = 0,
> - [Q_KEY_CODE_FIND] = 0,
> - [Q_KEY_CODE_CUT] = 0,
> - [Q_KEY_CODE_LF] = 0,
> - [Q_KEY_CODE_COMPOSE] = 0,
> };
>
> static void adb_kbd_put_keycode(void *opaque, int keycode)
> @@ -430,7 +421,9 @@ static void adb_keyboard_event(DeviceState *dev,
> QemuConsole *src,
> return;
> }
> keycode = qcode_to_adb_keycode[qcode];
> -
> + if (keycode == NO_KEY) { /* We don't want to send this to the guest */
> + return;
> + }
> if (evt->u.key.data->down == false) { /* if key release event */
> keycode = keycode | 0x80; /* create keyboard break code */
> }
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature