From: John Arbuckle <programmingkidx@gmail.com>
To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, qemu-devel@nongnu.org
Cc: John Arbuckle <programmingkidx@gmail.com>
Subject: [Qemu-devel] [PATCH v5 4/4] adb.c: prevent NO_KEY value from going to guest
Date: Wed, 17 Aug 2016 22:27:50 -0400 [thread overview]
Message-ID: <1471487270-1490-5-git-send-email-programmingkidx@gmail.com> (raw)
In-Reply-To: <1471487270-1490-1-git-send-email-programmingkidx@gmail.com>
The NO_KEY value should not be sent to the guest. This patch drops that value.
Signed-off-by: John Arbuckle <programmingkidx@gmail.com>
---
v5 changes:
Added ADB_DPRINTF() call.
v4 changes:
Added NO_KEY related code to this patch.
Added removal of "= 0" code near end of qcode_to_adb_keycode.
hw/input/adb.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/hw/input/adb.c b/hw/input/adb.c
index 12c6333..3d39368 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,
@@ -306,19 +311,6 @@ int qcode_to_adb_keycode[] = {
[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,
[Q_KEY_CODE_POWER] = ADB_KEY_POWER
};
@@ -446,7 +438,10 @@ 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 */
+ ADB_DPRINTF("Ignoring NO_KEY\n");
+ return;
+ }
if (evt->u.key.data->down == false) { /* if key release event */
keycode = keycode | 0x80; /* create keyboard break code */
}
--
2.7.2
next prev parent reply other threads:[~2016-08-18 2:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-18 2:27 [Qemu-devel] [PATCH v5 0/4] ADB improvements John Arbuckle
2016-08-18 2:27 ` [Qemu-devel] [PATCH v5 1/4] adb-keys.h: initial commit John Arbuckle
2016-08-18 2:27 ` [Qemu-devel] [PATCH v5 2/4] adb.c: add support for QKeyCode John Arbuckle
2016-08-18 11:04 ` [Qemu-devel] [Qemu-ppc] " BALATON Zoltan
2016-09-15 0:00 ` [Qemu-devel] " David Gibson
2016-08-18 2:27 ` [Qemu-devel] [PATCH v5 3/4] adb.c: correct several key assignments John Arbuckle
2016-08-18 2:27 ` John Arbuckle [this message]
2016-08-18 11:06 ` [Qemu-devel] [Qemu-ppc] [PATCH v5 4/4] adb.c: prevent NO_KEY value from going to guest BALATON Zoltan
2016-08-20 1:29 ` Programmingkid
2016-08-20 17:18 ` BALATON Zoltan
2016-08-18 2:37 ` [Qemu-devel] [PATCH v5 0/4] ADB improvements no-reply
2016-08-23 12:19 ` David Gibson
2016-08-23 19:21 ` Programmingkid
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1471487270-1490-5-git-send-email-programmingkidx@gmail.com \
--to=programmingkidx@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.