From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60664 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PoWRX-0002P8-4W for qemu-devel@nongnu.org; Sun, 13 Feb 2011 02:32:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PoWRV-0000gb-6j for qemu-devel@nongnu.org; Sun, 13 Feb 2011 02:32:26 -0500 Received: from mail-ww0-f41.google.com ([74.125.82.41]:52346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PoWRV-0000gG-0r for qemu-devel@nongnu.org; Sun, 13 Feb 2011 02:32:25 -0500 Received: by wwi18 with SMTP id 18so911057wwi.4 for ; Sat, 12 Feb 2011 23:32:23 -0800 (PST) MIME-Version: 1.0 From: Roy Tam Date: Sun, 13 Feb 2011 15:32:02 +0800 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] [PATCH] PS/2 keyboard Scancode Set 3 support List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel The following patch adds PS/2 keyboard Scancode Set 3 support. Sign-off-by: Roy Tam -- diff --git a/hw/ps2.c b/hw/ps2.c index 762bb00..4b73967 100644 --- a/hw/ps2.c +++ b/hw/ps2.c @@ -143,12 +143,87 @@ 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); }