From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JTPQv-0000xL-SP for qemu-devel@nongnu.org; Sun, 24 Feb 2008 17:34:58 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JTPQo-0000sC-HN for qemu-devel@nongnu.org; Sun, 24 Feb 2008 17:34:55 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JTPQo-0000s0-0M for qemu-devel@nongnu.org; Sun, 24 Feb 2008 17:34:50 -0500 Received: from smtp3-g19.free.fr ([212.27.42.29]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JTPQn-0002Ui-6b for qemu-devel@nongnu.org; Sun, 24 Feb 2008 17:34:49 -0500 Received: from smtp3-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp3-g19.free.fr (Postfix) with ESMTP id 586C617B54F for ; Sun, 24 Feb 2008 23:34:48 +0100 (CET) Received: from [127.0.0.1] (rob92-10-88-171-126-33.fbx.proxad.net [88.171.126.33]) by smtp3-g19.free.fr (Postfix) with ESMTP id 26FB217B53F for ; Sun, 24 Feb 2008 23:34:48 +0100 (CET) Message-ID: <47C1F10C.9010109@reactos.org> Date: Sun, 24 Feb 2008 23:34:52 +0100 From: =?ISO-8859-1?Q?Herv=E9_Poussineau?= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040105060604030900050005" Subject: [Qemu-devel] [PATCH] Add KBD_CMD_SCANCODE command Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------040105060604030900050005 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Hi, PS/2 controller emulation lacks the KBD_CMD_SCANCODE command, which=20 gets/sets the scancode set (1, 2 or 3). Scancode sets 1 and 2 are still not supported. Herv=E9 --------------040105060604030900050005 Content-Type: text/plain; name="ps2.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="ps2.patch" Index: hw/ps2.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /sources/qemu/qemu/hw/ps2.c,v retrieving revision 1.10 diff -u -r1.10 ps2.c --- hw/ps2.c 16 Dec 2007 23:41:11 -0000 1.10 +++ hw/ps2.c 23 Feb 2008 21:05:05 -0000 @@ -34,6 +34,7 @@ /* Keyboard Commands */ #define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */ #define KBD_CMD_ECHO 0xEE +#define KBD_CMD_SCANCODE 0xF0 /* Get/set scancode set */ #define KBD_CMD_GET_ID 0xF2 /* get keyboard ID */ #define KBD_CMD_SET_RATE 0xF3 /* Set typematic rate */ #define KBD_CMD_ENABLE 0xF4 /* Enable scanning */ @@ -89,6 +90,7 @@ conversions we do the translation (if any) in the PS/2 emulation not the keyboard controller. */ int translate; + int scancode_set; } PS2KbdState; =20 typedef struct { @@ -134,7 +136,9 @@ static void ps2_put_keycode(void *opaque, int keycode) { PS2KbdState *s =3D opaque; - if (!s->translate && keycode < 0xe0) + + /* XXX: add support for scancode sets 1 and 2 */ + if (!s->translate && keycode < 0xe0 && s->scancode_set =3D=3D 3) { if (keycode & 0x80) ps2_queue(&s->common, 0xf0); @@ -202,6 +206,7 @@ s->scan_enabled =3D 1; ps2_queue(&s->common, KBD_REPLY_ACK); break; + case KBD_CMD_SCANCODE: case KBD_CMD_SET_LEDS: case KBD_CMD_SET_RATE: s->common.write_cmd =3D val; @@ -227,6 +232,22 @@ break; } break; + case KBD_CMD_SCANCODE: + if (val =3D=3D 0) { + if (s->scancode_set =3D=3D 1) + ps2_queue(&s->common, 0x43); + else if (s->scancode_set =3D=3D 2) + ps2_queue(&s->common, 0x41); + else if (s->scancode_set =3D=3D 3) + ps2_queue(&s->common, 0x3f); + else + ps2_queue(&s->common, KBD_REPLY_ACK); + } else { + s->scancode_set =3D val; + ps2_queue(&s->common, KBD_REPLY_ACK); + } + s->common.write_cmd =3D -1; + break; case KBD_CMD_SET_LEDS: ps2_queue(&s->common, KBD_REPLY_ACK); s->common.write_cmd =3D -1; @@ -493,6 +514,7 @@ ps2_common_save (f, &s->common); qemu_put_be32(f, s->scan_enabled); qemu_put_be32(f, s->translate); + qemu_put_be32(f, s->scancode_set); } =20 static void ps2_mouse_save(QEMUFile* f, void* opaque) @@ -516,12 +538,16 @@ { PS2KbdState *s =3D (PS2KbdState*)opaque; =20 - if (version_id !=3D 2) + if (version_id !=3D 2 && version_id !=3D 3) return -EINVAL; =20 ps2_common_load (f, &s->common); s->scan_enabled=3Dqemu_get_be32(f); s->translate=3Dqemu_get_be32(f); + if (version_id =3D=3D 3) + s->scancode_set=3Dqemu_get_be32(f); + else + s->scancode_set=3D3; return 0; } =20 @@ -552,8 +578,9 @@ =20 s->common.update_irq =3D update_irq; s->common.update_arg =3D update_arg; + s->scancode_set =3D 3; ps2_reset(&s->common); - register_savevm("ps2kbd", 0, 2, ps2_kbd_save, ps2_kbd_load, s); + register_savevm("ps2kbd", 0, 3, ps2_kbd_save, ps2_kbd_load, s); qemu_add_kbd_event_handler(ps2_put_keycode, s); qemu_register_reset(ps2_reset, &s->common); return s; --------------040105060604030900050005--