From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Io4UA-00044q-JX for mharc-grub-devel@gnu.org; Fri, 02 Nov 2007 17:55:26 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Io4U8-000420-8R for grub-devel@gnu.org; Fri, 02 Nov 2007 17:55:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Io4U6-0003yZ-2W for grub-devel@gnu.org; Fri, 02 Nov 2007 17:55:23 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Io4U5-0003yG-Sy for grub-devel@gnu.org; Fri, 02 Nov 2007 17:55:21 -0400 Received: from mailout07.sul.t-online.de ([194.25.134.83] helo=mailout07.sul.t-online.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Io4U5-0001du-DW for grub-devel@gnu.org; Fri, 02 Nov 2007 17:55:21 -0400 Received: from fwd30.aul.t-online.de by mailout07.sul.t-online.com with smtp id 1Io4U4-0000i5-00; Fri, 02 Nov 2007 22:55:20 +0100 Received: from [10.3.2.2] (rAdgukZvYhr4FTiV-38K6DSxG5ZI6yeX7u8+4vYefgFX4A5Pl0sBqG0fdaugqyyw7e@[217.235.222.111]) by fwd30.aul.t-online.de with esmtp id 1Io4Ty-0dLMrA0; Fri, 2 Nov 2007 22:55:14 +0100 Message-ID: <472B9CBF.9030702@t-online.de> Date: Fri, 02 Nov 2007 22:55:11 +0100 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 MIME-Version: 1.0 To: grub-devel@gnu.org Content-Type: multipart/mixed; boundary="------------050702030209020404030801" X-ID: rAdgukZvYhr4FTiV-38K6DSxG5ZI6yeX7u8+4vYefgFX4A5Pl0sBqG0fdaugqyyw7e X-TOI-MSGID: 8760da19-7711-4bb8-8c05-d94b19773051 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: [PATCH] Fix grub-emu curses KEY_* mapping 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: Fri, 02 Nov 2007 21:55:25 -0000 This is a multi-part message in MIME format. --------------050702030209020404030801 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Curses function keys do not work in grub-emu, this patch fixes this in grub_ncurses_getkey(). Another approach would be to remove the scancode translation in grub_console_getkey(), and check for GRUB_CONSOLE_KEY_* in grub_cmdline_get() instead. The GRUB_CONSOLE_KEY_* definitions are already platform specific. Christian 2007-11-02 Christian Franke * util/console.c (grub_ncurses_getkey): Change curses KEY_* mapping, now return control chars instead of GRUB_CONSOLE_KEY_* constants. This fixes the problem that function keys did not work in grub-emu. --------------050702030209020404030801 Content-Type: text/x-patch; name="grub2-console-key.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="grub2-console-key.patch" --- grub2.orig/util/console.c 2007-07-22 01:32:31.000000000 +0200 +++ grub2/util/console.c 2007-10-13 16:13:46.000000000 +0200 @@ -161,53 +161,59 @@ grub_ncurses_getkey (void) c = getch (); } + /* XXX: return GRUB_CONSOLE_KEY_* does not work here, + grub_cmdline_get() does not check for these constants. + At least on i386-pc, GRUB_CONSOLE_KEY_* are in fact keyboard + scancodes which are converted into control chars by + grub_console_getkey(). */ + switch (c) { case KEY_LEFT: - c = GRUB_CONSOLE_KEY_LEFT; + c = 2; /*GRUB_CONSOLE_KEY_LEFT*/ break; case KEY_RIGHT: - c = GRUB_CONSOLE_KEY_RIGHT; + c = 6; /*GRUB_CONSOLE_KEY_RIGHT*/ break; case KEY_UP: - c = GRUB_CONSOLE_KEY_UP; + c = 16; /*GRUB_CONSOLE_KEY_UP*/ break; case KEY_DOWN: - c = GRUB_CONSOLE_KEY_DOWN; + c = 14; /*GRUB_CONSOLE_KEY_DOWN*/ break; case KEY_IC: - c = GRUB_CONSOLE_KEY_IC; + c = 24; /*GRUB_CONSOLE_KEY_IC*/ break; case KEY_DC: - c = GRUB_CONSOLE_KEY_DC; + c = 4; /*GRUB_CONSOLE_KEY_DC*/ break; case KEY_BACKSPACE: /* XXX: For some reason ncurses on xterm does not return KEY_BACKSPACE. */ case 127: - c = GRUB_CONSOLE_KEY_BACKSPACE; + c = 8; /*GRUB_CONSOLE_KEY_BACKSPACE*/; break; case KEY_HOME: - c = GRUB_CONSOLE_KEY_HOME; + c = 1; /*GRUB_CONSOLE_KEY_HOME*/ break; case KEY_END: - c = GRUB_CONSOLE_KEY_END; + c = 5; /*GRUB_CONSOLE_KEY_END*/ break; case KEY_NPAGE: - c = GRUB_CONSOLE_KEY_NPAGE; + c = 3; /*GRUB_CONSOLE_KEY_NPAGE*/ break; case KEY_PPAGE: - c = GRUB_CONSOLE_KEY_PPAGE; + c = 7; /*GRUB_CONSOLE_KEY_PPAGE*/ break; } --------------050702030209020404030801--