Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1L2Vr3-0005gt-Ni for mharc-grub-devel@gnu.org; Tue, 18 Nov 2008 14:03:17 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L2Vr0-0005gT-St for grub-devel@gnu.org; Tue, 18 Nov 2008 14:03:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L2Vr0-0005g6-DS for grub-devel@gnu.org; Tue, 18 Nov 2008 14:03:14 -0500 Received: from [199.232.76.173] (port=43268 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L2Vr0-0005g3-2B for grub-devel@gnu.org; Tue, 18 Nov 2008 14:03:14 -0500 Received: from igw3.br.ibm.com ([32.104.18.26]:52765) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L2Vqy-0006jP-QT for grub-devel@gnu.org; Tue, 18 Nov 2008 14:03:13 -0500 Received: from d24relay01.br.ibm.com (unknown [9.8.31.16]) by igw3.br.ibm.com (Postfix) with ESMTP id 8088B390196 for ; Tue, 18 Nov 2008 17:00:37 -0200 (BRDT) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.18.232.46]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mAIK2TGO1224726 for ; Tue, 18 Nov 2008 17:02:29 -0300 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mAIJ2pdM031098 for ; Tue, 18 Nov 2008 17:02:52 -0200 Received: from [9.18.253.48] ([9.18.253.48]) by d24av01.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id mAIJ2mlp030605; Tue, 18 Nov 2008 17:02:48 -0200 From: Manoel To: The development of GRUB 2 Content-Type: multipart/mixed; boundary="=-+czDo03bq8dbbgZpLBbN" Date: Tue, 18 Nov 2008 17:02:33 -0200 Message-Id: <1227034953.17386.30.camel@manoel-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.24.1 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (tstamp-) Cc: Carlos Roberto do Nascimento Costa , Segher Boessenkool , Hollis Blanchard Subject: [PATCH] GRUB2 keyboard fixes on PowerPC64 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 19:03:15 -0000 --=-+czDo03bq8dbbgZpLBbN Content-Type: text/plain Content-Transfer-Encoding: 7bit These are some keyboard fixes. keys.patch --------------------------------------------------------------- This patch implements functionality of some keys (Home, End and Backspace) following the ECMA-48 standard. unimplemented_key.patch ---------------------------------------------------------------- This patch prevents that fancy characters show up in screen when keys that the virtual terminal doesn't understand are pressed. -- Best Regards, Manoel Abranches IBM Linux Technology Center Brazil --=-+czDo03bq8dbbgZpLBbN Content-Disposition: attachment; filename="keys.patch" Content-Type: text/x-patch; name="keys.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit Index: term/ieee1275/ofconsole.c =================================================================== --- term/ieee1275/ofconsole.c (revision 1917) +++ term/ieee1275/ofconsole.c (working copy) @@ -150,41 +150,60 @@ grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); - if (actual > 0 && c == '\e') - { - grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); - if (actual <= 0) - { + if (actual > 0) + switch(c){ + case 0x7f: + /* Backspace: Ctrl-h. */ + c=8; + break; + case '\e': + grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); + if (actual <= 0) + { *key = '\e'; return 1; } + + if (c != 91 ) + return 0; + + grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); + + if (actual <= 0) + return 0; - if (c != 91) - return 0; - - grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); - if (actual <= 0) - return 0; - - switch (c) + switch (c) { - case 65: - /* Up: Ctrl-p. */ - c = 16; - break; - case 66: - /* Down: Ctrl-n. */ - c = 14; - break; - case 67: - /* Right: Ctrl-f. */ - c = 6; - break; - case 68: - /* Left: Ctrl-b. */ - c = 2; - break; + case 72: + /* Home: Ctrl-a. */ + c = 1; + break; + case 70: + /* End: Ctrl-e. */ + c = 5; + break; + case 51: + /* Delete: Ctrl-d. */ + c = 4; + break; + case 65: + /* Up: Ctrl-p. */ + c = 16; + break; + case 66: + /* Down: Ctrl-n. */ + c = 14; + break; + case 67: + /* Right: Ctrl-f. */ + c = 6; + break; + case 68: + /* Left: Ctrl-b. */ + c = 2; + break; } + break; } *key = c; --=-+czDo03bq8dbbgZpLBbN Content-Disposition: attachment; filename="unimplemented_key.patch" Content-Type: text/x-patch; name="unimplemented_key.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit --- term/ieee1275/ofconsole-bk.c 2008-11-18 17:00:46.000000000 +0100 +++ term/ieee1275/ofconsole.c 2008-11-18 16:59:50.000000000 +0100 @@ -146,7 +146,10 @@ static int grub_ofconsole_readkey (int *key) { char c; + char ctmp; grub_ssize_t actual = 0; + grub_ssize_t actualtmp = 0; + char implemented = 1;//indicates an unimplemented key grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); @@ -165,8 +168,11 @@ grub_ofconsole_readkey (int *key) } if (c != 91 ) - return 0; - + { + implemented = 0; + break; + } + grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); if (actual <= 0) @@ -202,12 +208,25 @@ grub_ofconsole_readkey (int *key) /* Left: Ctrl-b. */ c = 2; break; + default: + implemented = 0; + break; } break; } + + /*stores actual state*/ + ctmp = c; + actualtmp = actual; + /*clean buffer*/ + while(actual > 0 && !grub_ieee1275_read(stdin_ihandle, &c, 1, &actual)); + /*return to previos state*/ + c = ctmp; + actual = actualtmp; *key = c; - return actual > 0; + return (actual > 0 && implemented); + } static int --=-+czDo03bq8dbbgZpLBbN--