From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1V6ckA-0001kb-Hw for mharc-grub-devel@gnu.org; Tue, 06 Aug 2013 04:35:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6ck1-0001jQ-Pv for grub-devel@gnu.org; Tue, 06 Aug 2013 04:35:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6cjv-0006rR-B9 for grub-devel@gnu.org; Tue, 06 Aug 2013 04:35:41 -0400 Received: from mx3.wp.pl ([212.77.101.7]:25363) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6cju-0006qn-Rn for grub-devel@gnu.org; Tue, 06 Aug 2013 04:35:35 -0400 Received: (wp-smtpd smtp.wp.pl 18054 invoked from network); 6 Aug 2013 10:35:30 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1375778130; bh=5jyn32AnjwyARbgGgk1CEDxVbH0JvZEjxqxB4DnudWY=; h=From:To:Subject; b=gnU9lW0GZvRoK44C3uSOwshuFe56fpDwERA6lHFxdkOvs8OP310l9Z5b7fHVN5HuB ynQa3g0j5PvE6WfJwMgvAq5D67qbY51wNYV8dMj9NouGtsk1sU90tgkV7/AsuJReF/ /Q4hmaKZ0j93wCicVEpCsurdQjezobfLTF7ZycPY= Received: from mail.kontron.pl (eyak@[217.153.153.212]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with SMTP for ; 6 Aug 2013 10:35:30 +0200 Message-ID: <5200B552.4020705@wp.pl> Date: Tue, 06 Aug 2013 10:35:30 +0200 From: Pawel Wojtalczyk MIME-Version: 1.0 To: grub-devel@gnu.org Subject: ctrl-x / ctrl-c may not work under GRUB2 with EFI Content-Type: multipart/alternative; boundary="------------010300070404020802020508" X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000000 [YeP0] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 212.77.101.7 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Aug 2013 08:35:48 -0000 This is a multi-part message in MIME format. --------------010300070404020802020508 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit Hello, I run GRUB2 as 64-bit EFI application and I use gfxterm and serial as output. I would like to edit commands before boot by type 'e' command. Then I would like to boot by press ctrl-x, but unfortunately the boot does not appears. The reason is that in AMI and Phoenix BIOSes when ctrl key is pressed then EFI_SIMPLE_TEXT_INPUT_PROTOCOL protocol returns VT100 style encoding of pressed unicode character ( http://www.vt100.net/docs/vt100-ug/table3-5.html). I tried to use EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL to get the pressed key modifier (ctrl, alt, etc), but in case when serial console redirection enabled in Phoenix BIOS, none characters are received via serial with EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL(with AMI BIOS characters are received in VT100 encoding style). So maybe we can do another way. Maybe we can explicitly set key modifier (as in grub_terminfo_getkey() with http://wiki.phoenix.com/wiki/index.php/Unicode_Control_Characters restrictions) as following: --- grub.orig/grub-core/term/efi/console.c 2013-07-31 07:50:52.000000000 +0200 +++ grub/grub-core/term/efi/console.c 2013-08-06 10:28:26.117499386 +0200 @@ -125,7 +125,12 @@ return GRUB_TERM_NO_KEY; if (key.scan_code == 0) - return key.unicode_char; +#if defined (__i386__) || defined (__x86_64__) + if (key.unicode_char < 0x20 && key.unicode_char != 0 && key.unicode_char != '\t' && key.unicode_char != '\b' && key.unicode_char != '\n' && key.unicode_char != '\r') + return GRUB_TERM_CTRL | (key.unicode_char - 1 + 'a'); + else +#endif /* defined (__i386__) || defined (__x86_64__) */ + return key.unicode_char; else if (key.scan_code < ARRAY_SIZE (efi_codes)) return efi_codes[key.scan_code]; In some remote systems EFI serial redirection must be enabled and thus we cannot use serial (as termianl_input) module in GRUB2 and in such case it would be good to allow add support for ctrl-x/ctrl-c under GRUB2 via serial console redirection enabled in EFI and attached USB keyboard. Regrads Pawel Wojtalczyk --------------010300070404020802020508 Content-Type: text/html; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit Hello,

I run GRUB2 as 64-bit EFI application and I use gfxterm and serial as output.

I would like to edit commands before boot by type 'e' command. Then I would like to boot by press ctrl-x, but unfortunately the boot does not appears.

The reason is that in AMI and Phoenix BIOSes when ctrl key is pressed then EFI_SIMPLE_TEXT_INPUT_PROTOCOL protocol returns VT100 style encoding of pressed unicode character ( http://www.vt100.net/docs/vt100-ug/table3-5.html).

I tried to use EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL to get the pressed key modifier (ctrl, alt, etc), but in case when serial console redirection enabled in Phoenix BIOS, none characters are received via serial with EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL(with AMI BIOS characters are received in VT100 encoding style).

So maybe we can do another way. Maybe we can explicitly set key modifier (as in grub_terminfo_getkey() with http://wiki.phoenix.com/wiki/index.php/Unicode_Control_Characters restrictions) as following:

--- grub.orig/grub-core/term/efi/console.c      2013-07-31 07:50:52.000000000 +0200
+++ grub/grub-core/term/efi/console.c   2013-08-06 10:28:26.117499386 +0200
@@ -125,7 +125,12 @@
     return GRUB_TERM_NO_KEY;
 
   if (key.scan_code == 0)
-    return key.unicode_char;
+#if defined (__i386__) || defined (__x86_64__)
+    if (key.unicode_char < 0x20 && key.unicode_char != 0 && key.unicode_char != '\t' && key.unicode_char != '\b' && key.unicode_char != '\n' && key.unicode_char != '\r')
+      return GRUB_TERM_CTRL | (key.unicode_char - 1 + 'a');
+    else
+#endif /* defined (__i386__) || defined (__x86_64__) */
+      return key.unicode_char;
   else if (key.scan_code < ARRAY_SIZE (efi_codes))
     return efi_codes[key.scan_code];


In some remote systems EFI serial redirection must be enabled and thus we cannot use serial (as termianl_input) module in GRUB2 and in such case it would be good to allow add support for ctrl-x/ctrl-c under GRUB2 via serial console redirection enabled in EFI and attached USB keyboard.

Regrads
Pawel Wojtalczyk
--------------010300070404020802020508--