From: Kevin Wolf <kwolf@redhat.com>
To: Roy Tam <roytam@gmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2] PS/2 keyboard Scancode Set 3 support
Date: Mon, 14 Feb 2011 12:43:12 +0100 [thread overview]
Message-ID: <4D591550.2070801@redhat.com> (raw)
In-Reply-To: <AANLkTim5C=bytyBZxRVwjpZj668UTzTFJ-oAftkphS7T@mail.gmail.com>
Am 13.02.2011 11:07, schrieb Roy Tam:
> The following patch adds PS/2 keyboard Scancode Set 3 support.
>
> Sign-off-by: Roy Tam <roytam@gmail.com>
> --
> v2: checkpatch.pl style fixes
>
> diff --git a/hw/ps2.c b/hw/ps2.c
> index 762bb00..6bea0ef 100644
> --- a/hw/ps2.c
> +++ b/hw/ps2.c
> @@ -143,13 +143,85 @@ static void ps2_put_keycode(void *opaque, int keycode)
> {
> PS2KbdState *s = opaque;
>
> - /* XXX: add support for scancode sets 1 and 3 */
> - if (!s->translate && keycode < 0xe0 && s->scancode_set == 2)
> - {
> + /* XXX: add support for scancode sets 1 */
> + if (!s->translate && keycode < 0xe0 && s->scancode_set > 1) {
> if (keycode & 0x80)
> ps2_queue(&s->common, 0xf0);
> keycode = ps2_raw_keycode[keycode & 0x7f];
> - }
> + if (s->scancode_set == 3) {
> + switch (keycode) {
> + case 0x1:
> + keycode = 0x47;
> + break;
> + case 0x3:
> + keycode = 0x27;
> + break;
> + case 0x4:
> + keycode = 0x17;
> + break;
> + case 0x5:
> + keycode = 0x7;
> + break;
> + case 0x6:
> + keycode = 0xf;
> + break;
> + case 0x7:
> + keycode = 0x5e;
> + break;
> + case 0x9:
> + keycode = 0x4f;
> + break;
> + case 0xa:
> + keycode = 0x3f;
> + break;
> + case 0xb:
> + keycode = 0x2f;
> + break;
> + case 0xc:
> + keycode = 0x1f;
> + break;
> + case 0x11:
> + keycode = 0x19;
> + break;
> + case 0x14:
> + keycode = 0x11;
> + break;
> + case 0x58:
> + keycode = 0x14;
> + break;
> + case 0x5d:
> + keycode = 0x5c;
> + break;
> + case 0x76:
> + keycode = 0x8;
> + break;
> + case 0x77:
> + keycode = 0x76;
> + break;
> + case 0x78:
> + keycode = 0x56;
> + break;
> + case 0x79:
> + keycode = 0x7c;
> + break;
> + case 0x7b:
> + keycode = 0x84;
> + break;
> + case 0x7c:
> + keycode = 0x7e;
> + break;
> + case 0x7e:
> + keycode = 0x5f;
> + break;
> + case 0x83:
> + keycode = 0x37;
> + break;
> + case 0x84:
> + keycode = 0x57;
> + break;
> + }
> + }
> + }
> ps2_queue(&s->common, keycode);
> }
Wouldn't a second table like ps2_raw_keycode be better than a huge
switch block that translates from scancode set 2 to 3?
Kevin
next prev parent reply other threads:[~2011-02-14 11:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-13 10:07 [Qemu-devel] [PATCH v2] PS/2 keyboard Scancode Set 3 support Roy Tam
2011-02-14 11:43 ` Kevin Wolf [this message]
2011-02-14 12:49 ` Roy Tam
2011-02-14 13:15 ` Kevin Wolf
2011-02-14 13:22 ` Roy Tam
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=4D591550.2070801@redhat.com \
--to=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=roytam@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).