From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jl4l4-000679-8B for qemu-devel@nongnu.org; Sun, 13 Apr 2008 12:08:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jl4l3-00066r-JE for qemu-devel@nongnu.org; Sun, 13 Apr 2008 12:08:45 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jl4l3-00066k-C7 for qemu-devel@nongnu.org; Sun, 13 Apr 2008 12:08:45 -0400 Received: from savannah.gnu.org ([199.232.41.3] helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jl4l2-0000XE-Vq for qemu-devel@nongnu.org; Sun, 13 Apr 2008 12:08:45 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1Jl4l2-0004Ty-Ka for qemu-devel@nongnu.org; Sun, 13 Apr 2008 16:08:44 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1Jl4l2-0004Tu-Du for qemu-devel@nongnu.org; Sun, 13 Apr 2008 16:08:44 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Sun, 13 Apr 2008 16:08:44 +0000 Subject: [Qemu-devel] [4209] Fix keyboard emulation for ARM versatile board: 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 Revision: 4209 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4209 Author: aurel32 Date: 2008-04-13 16:08:44 +0000 (Sun, 13 Apr 2008) Log Message: ----------- Fix keyboard emulation for ARM versatile board: - 0xab is actually a keyboard reply. It should not be escaped. - Because of translated value 0x41, translated to raw conversion is not a bijection. Instead of creating two translation tables, test for s->translate before writing this value. Modified Paths: -------------- trunk/hw/ps2.c Modified: trunk/hw/ps2.c =================================================================== --- trunk/hw/ps2.c 2008-04-13 16:08:37 UTC (rev 4208) +++ trunk/hw/ps2.c 2008-04-13 16:08:44 UTC (rev 4209) @@ -44,6 +44,7 @@ /* Keyboard Replies */ #define KBD_REPLY_POR 0xAA /* Power on reset */ +#define KBD_REPLY_ID 0xAB /* Keyboard ID */ #define KBD_REPLY_ACK 0xFA /* Command ACK */ #define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */ @@ -133,7 +134,11 @@ s->update_irq(s->update_arg, 1); } -/* keycode is expressed in scancode set 2 */ +/* + keycode is expressed as follow: + bit 7 - 0 key pressed, 1 = key released + bits 6-0 - translated scancode set 2 + */ static void ps2_put_keycode(void *opaque, int keycode) { PS2KbdState *s = opaque; @@ -199,8 +204,11 @@ case KBD_CMD_GET_ID: ps2_queue(&s->common, KBD_REPLY_ACK); /* We emulate a MF2 AT keyboard here */ - ps2_put_keycode(s, 0xab); - ps2_put_keycode(s, 0x83); + ps2_queue(&s->common, KBD_REPLY_ID); + if (s->translate) + ps2_queue(&s->common, 0x41); + else + ps2_queue(&s->common, 0x83); break; case KBD_CMD_ECHO: ps2_queue(&s->common, KBD_CMD_ECHO);