Implement the 'setkey' command to allow changing the keyboard map
cover Implement the 'setkey' command to allow changing the keyboard map
Legacy GRUB had a 'setkey' command to remap the keyboard keys. GRUB2 no longer has this command. Instead, it provides an 'at_keyboard' input terminal module, which can load a GRUB keymap. Unfortunately, at least on the i386-pc platform, 'at_keyboard' is problematic, in that it easily causes hangups.
For now, I'm unsure what needs to be done to fix 'at_keyboard', which is why I decided to look for a different solution. Whether I can fix the 'at_keyboard' input terminal, and in what time frame, remains to be seen.
This patch set reintroduces a 'setkey' command, to support changing the keyboard map, similarly to what was possible under Legacy GRUB.
The first patch just makes a simple edit to a comment line in the 'memory.h' header file. It updates the URL for the 'bios_data_area.html' web page, which contains helpful information about BIOS, and specifically, the keyboard interface.
The second patch implements the 'nusetkey' module, which provides the 'setkey' command. In addition, it provides a 'setnumpad' command, to change the behavior of the numeric keypad.
The third patch implements the 'nuconsole' input terminal, which works in conjunction with the 'nusetkey' module to support keyboard map changes.
Finally, the fourth patch provides updates to the GRUB manual. It documents the 'keymap' command (which loads a keyboard map for use by the 'at_keyboard' or 'usb_keyboard' input terminals), plus the 'setkey' and 'setnumpad' commands implemented by the 'nusetkey' module.
Luc Van Rompaey (4):
update URL to bios_data_area.html on comment line implement the nusetkey module
implement the nuconsole input terminal
add documentation for keymap, setkey, and setnumpad commands
docs/grub.texi | 150 +++++++++ grub-core/Makefile.core.def | 12 + grub-core/commands/i386/pc/nusetkey.c | 583 ++++++++++++++++++++++++++++++++++ grub-core/term/i386/pc/nuconsole.c | 111 +++++++ include/grub/i386/pc/memory.h | 2 +- include/grub/i386/pc/nusetkey.h | 25 ++ 6 files changed, 882 insertions(+), 1 deletion(-) create mode 100644 grub-core/commands/i386/pc/nusetkey.c create mode 100644 grub-core/term/i386/pc/nuconsole.c create mode 100644 include/grub/i386/pc/nusetkey.h
Signature · 1 line
2.1.4
PATCH 1/4 update URL to bios_data_area.html on comment line
The URL to the bios_data_area.html web page, as given on a comment line in the i386/pc/memory.h header file, is dead. Replace it with the new location of the page.
--- include/grub/i386/pc/memory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/grub/i386/pc/memory.h +1 -1
@@ -45,7 +45,7 @@#ifndef ASM_FILE -/* See http://heim.ifi.uio.no/~stanisls/helppc/bios_data_area.html for a +/* See http://stanislavs.org/helppc/bios_data_area.html for a description of the BIOS Data Area layout. */ struct grub_machine_bios_data_area {
Signature · 1 line
2.1.4
PATCH 2/4 implement the nusetkey module
In reply to Luc Van RompaeyThe nusetkey module implements the setkey command, which will change the keyboard keymap, in much the same way as the setkey command did in GRUB legacy.
Restrictions: This version of the setkey command does not support the modifier keys (shift, control, alt). In addition, the keymap changes will not become active until the terminal_input is set to nuconsole. The module also implements the setnumpad command, which allows you to change the behavior of the numeric keypad, to make it output numeric ASCII characters, irrespective of the numlock and shift key states.
--- grub-core/Makefile.core.def | 6 + grub-core/commands/i386/pc/nusetkey.c | 583 ++++++++++++++++++++++++++++++++++ include/grub/i386/pc/nusetkey.h | 25 ++ 3 files changed, 614 insertions(+) create mode 100644 grub-core/commands/i386/pc/nusetkey.c create mode 100644 include/grub/i386/pc/nusetkey.h
grub-core/Makefile.core.def +6 -0
@@ -2313,3 +2313,9 @@ module = { common = loader/i386/xen_file64.c; extra_dist = loader/i386/xen_fileXX.c; }; + +module = { + name = nusetkey; + i386_pc = commands/i386/pc/nusetkey.c; + enable = i386_pc; +};
grub-core/commands/i386/pc/nusetkey.c new file +583 -0
583 lines not on this page · raw message
include/grub/i386/pc/nusetkey.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2006,2007 Free Software Foundation, Inc. +* +* GRUB is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GRUB is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GRUB. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef GRUB_SETKEY_HEADER +#define GRUB_SETKEY_HEADER 1 + +extern int +grub_nusetkey_xlat (grub_uint16_t key); + +#endif /* ! GRUB_SETKEY_HEADER */
Signature · 1 line
2.1.4
PATCH 3/4 implement the nuconsole input terminal
In reply to Luc Van RompaeyThe nuconsole input terminal works in conjunction with the nusetkey module to support changing the keyboard keymap.
--- grub-core/Makefile.core.def | 6 ++ grub-core/term/i386/pc/nuconsole.c | 111 +++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 grub-core/term/i386/pc/nuconsole.c
grub-core/Makefile.core.def +6 -0
@@ -2319,3 +2319,9 @@ module = { i386_pc = commands/i386/pc/nusetkey.c; enable = i386_pc; }; + +module = { + name = nuconsole; + i386_pc = term/i386/pc/nuconsole.c; + enable = i386_pc; +};
grub-core/term/i386/pc/nuconsole.c new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 4/4 add documentation for keymap, setkey, and setnumpad commands
In reply to Luc Van RompaeyUpdate the GNU GRUB manual with entries that document the keymap, setkey, and setnumpad commands, under the list of general commands.
--- docs/grub.texi | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+)
docs/grub.texi +150 -0
@@ -3660,13 +3660,57 @@ All options are the same as in the @command{menuentry} command Commands usable anywhere in the menu and in the command-line. @menu +* keymap:: Load a keyboard layout * serial:: Set up a serial device +* setkey:: Change the keyboard map +* setnumpad:: Change the numeric keypad behavior * terminal_input:: Manage input terminals * terminal_output:: Manage output terminals * terminfo:: Define terminal type @end menu +@node keymap +@subsection keymap + +@deffn Command keymap LAYOUT +Load a keyboard layout. + +If @var{LAYOUT} is just the identifier of a keyboard layout, then GRUB will +look for file @file{$prefix/layouts/@var{LAYOUT}.gkb}. +Alternatively, @var{LAYOUT} may be the full path to a GRUB keyboard layout file. + +This command will have no effect unless and until you use the +@command{terminal_input} command to activate either the @samp{at_keyboard} +input terminal: + +@example +terminal_input at_keyboard +@end example + +or the @samp{usb_keyboard} input terminal: + +@example +terminal_input usb_keyboard +@end example + +@table @asis +@item Creating a GRUB keyboard layout file: + +To generate a GRUB keyboard layout file, you can use the @command{grub-mklayout} +command-line utility, which takes a Linux console keyboard layout description +as input, and converts it to a format that GRUB can understand. + +For instance, if you use the @samp{dvorak} keyboard layout, then the following +command will create the @file{dvorak.gkb} file for use with GRUB: + +@example +ckbcomp dvorak | grub-mklayout -o dvorak.gkb +@end example +@end table +@end deffn + + @node serial @subsection serial
@@ -3689,6 +3733,112 @@ See also @ref{Serial terminal}. @end deffn +@node setkey +@subsection setkey + +@deffn Command setkey [[TO_KEY] FROM_KEY] +Change the keyboard map. + +With no arguments, reset the keyboard map to its default U.S. layout. + +When only the @var{FROM_KEY} argument is given, or when @var{TO_KEY} is equal to +@var{FROM_KEY}, the mapping entry for the specified key will be cleared. +Keep in mind that @var{FROM_KEY} identifies the position of the key under the default +U.S. layout. + +With two unequal arguments, the key @var{FROM_KEY} will be mapped to @var{TO_KEY}. +In effect, the @var{FROM_KEY} argument identifies the position of the key under the +default U.S. layout, and @var{TO_KEY} specifies how the key should behave under your +local keyboard layout. + +A key must be: +@itemize @bullet +@item +a lowercase letter; +@item +an uppercase letter; +@item +a decimal digit; +@item +a function key---i.e., @kbd{F1} through @kbd{F12}; +@end itemize + +or one of the following: + +@verbatim + ampersand barx delete less question + asterisk braceleft dollar minus quote + at braceright doublequote numbersign semicolon + backslash bracketleft enter parenleft slash + backslashx bracketright equal parenright space + backquote caret escape percent tab + backspace colon exclam period tilde + bar comma greater plus underscore +@end verbatim + +This command is only available on PC BIOS systems. It will have no effect unless +and until you use the @command{terminal_input} command to activate the @samp{nuconsole} +input terminal: + +@example +terminal_input nuconsole +@end example + +Differences with the @command{setkey} command under GRUB Legacy: + +@itemize @bullet +@item +This @command{setkey} command does not support the modifier keys---i.e., @kbd{shift}, +@kbd{control}, @kbd{alt}, @kbd{capslock}. + +@item +This @command{setkey} command supports all twelve function keys. + +@item +Depending on your keyboard layout, there may be an extra key between the @key{Left Shift} +key and the row of letter keys to its right. This extra key will output a backslash (i.e., +@kbd{\}) or, when shifted, a vertical bar (i.e., @kbd{|}), by default. + +This @command{setkey} command will not affect this extra key when you remap the +@kbd{backslash} or @kbd{bar} keys. You can instead remap the key separately, using the +@kbd{backslashx} or @kbd{barx} values for the @var{FROM_KEY} argument. + +For instance, under the Belgian keyboard layout, this key will output a @kbd{<} or, when +shifted, a @kbd{>} character. The following GRUB commands will, then, appropriately remap +the key: + +@example +setkey less backslashx +setkey greater barx +@end example +@end itemize +@end deffn + + +@node setnumpad +@subsection setnumpad + +@deffn Command setnumpad [@option{--force}|@option{--noforce}] +Change the behavior of the numeric keypad. + +With @option{--force}, make the keys on the numeric keypad emit the numeric +characters on their keycaps, irrespective of the @key{NumLock} and @key{Shift} +key states. + +With @option{--noforce}, or if no option is given, restore default behavior +of the keys on the numeric keypad, which depends on the @key{NumLock} and +@key{Shift} states. + +This command is only available on PC BIOS systems. It will have no effect unless +and until you use the @command{terminal_input} command to activate the @samp{nuconsole} +input terminal: + +@example +terminal_input nuconsole +@end example +@end deffn + + @node terminal_input @subsection terminal_input
Signature · 1 line
2.1.4
В Sat, 11 Jul 2015 20:28:20 +0200
Luc Van Rompaey <[email protected]> пишет:
Quoted 6 lines
Legacy GRUB had a 'setkey' command to remap the keyboard keys. GRUB2 no longer has this command. Instead, it provides an '
at_keyboard' input terminal module, which can load a GRUB keymap. Unfortunately, at least on the i386-pc platform, 'at_keyboard' is problematic, in that it easily causes hangups.
Do you have some more data? Fixing it would be preferable.
Quoted 7 lines
For now, I'm unsure what needs to be done to fix '
at_keyboard', which is why I decided to look for a different solution. Whether I can fix the 'at_keyboard' input terminal, and in what time frame, remains to be seen.This patch set reintroduces a 'setkey' command, to support changing the keyboard map, similarly to what was possible under Legacy GRUB.
GRUB2 already has framework for custom keyboard layouts. Why not reuse grub_term_map_key() from keylayouts same as at_keyboard and usb_keyboard do? Map scan code to GRUB_KEYBOARD_* and let grub_term_map_key() to care about keyboard mapping. This has additional advantage of supporting localized keyboard tables (your approach does not, it only changes ASCII layouts).
Quoted 5 lines
The first patch just makes a simple edit to a comment line in the '
memory.h' header file. It updates the URL for the 'bios_data_area.html' web page, which contains helpful information about BIOS, and specifically, the keyboard interface.
You already sent this one, it hardly belongs to this patch series.
Quoted 4 lines
The second patch implements the 'nusetkey' module, which provides the 'setkey' command. In addition, it provides a 'setnumpad' command, to change the behavior of the numeric keypad.
Why NumLock is not sufficient?
Quoted 3 lines
The third patch implements the 'nuconsole' input terminal, which works in conjunction with the 'nusetkey' module to support keyboard map changes.
Making them two different modules in your case is pointless; nuconsole cannot work without nusetkey and nusetkey is used only by nuconsole. Also, something like ext_keyboard would probably be more appropriate.
Quoted 22 lines
Finally, the fourth patch provides updates to the GRUB manual. It documents the 'keymap' command (which loads a keyboard map for use by the '
at_keyboard' or 'usb_keyboard' input terminals), plus the 'setkey' and 'setnumpad' commands implemented by the 'nusetkey' module.Luc Van Rompaey (4):
update URL to bios_data_area.html on comment line implement the nusetkey module
implement the nuconsole input terminal
add documentation for keymap, setkey, and setnumpad commandsdocs/grub.texi | 150 +++++++++ grub-core/Makefile.core.def | 12 + grub-core/commands/i386/pc/nusetkey.c | 583 ++++++++++++++++++++++++++++++++++ grub-core/term/i386/pc/nuconsole.c | 111 +++++++ include/grub/i386/pc/memory.h | 2 +- include/grub/i386/pc/nusetkey.h | 25 ++ 6 files changed, 882 insertions(+), 1 deletion(-) create mode 100644 grub-core/commands/i386/pc/nusetkey.c create mode 100644 grub-core/term/i386/pc/nuconsole.c create mode 100644 include/grub/i386/pc/nusetkey.h
2015-07-12 12:03 GMT+02:00 Andrei Borzenkov <[email protected]>:
Quoted 7 lines
В Sat, 11 Jul 2015 20:28:20 +0200
Luc Van Rompaey <[email protected]> пишет:Quoted 4 lines
Legacy GRUB had a 'setkey' command to remap the keyboard keys. GRUB2 no longer has this command. Instead, it provides an '
at_keyboard' input terminal module, which can load a GRUB keymap. Unfortunately, at least on the i386-pc platform, 'at_keyboard' is
Quoted 7 lines
problematic,
Quoted 2 lines
in that it easily causes hangups.
Do you have some more data? Fixing it would be preferable.
For starters, the first keystroke after I activate '
at_keyboard', will not
get processed, even though the countdown until automatic boot will get stopped.
Further keystrokes are something of a hit-and-miss, until the system no longer responds to keyboard input.
At that point, either some kind of crash will happen, after which the computer reboots, or I need to perform a hard reset (power cycle).
If I do get to the point where I can chainload another GRUB copy (with a default config as automatically generated under, e.g., Debian or Ubuntu), then apparently, the keystrokes that didn't get processed earlier on, suddenly seem to be run, ... after which the system locks up, and a hard reset is, again, required.
I would love to fix the 'at_keyboard' issue, and I will if I can. I cannot at this point promise anything, though. Plus, something less convoluted is a great exercise to get a feel for the GRUB code.
Quoted 11 lines
For now, I'm unsure what needs to be done to fix '
at_keyboard', which is whyQuoted 1 line
I decided to look for a different solution. Whether I can fix the
'
at_keyboard'Quoted 3 lines
input terminal, and in what time frame, remains to be seen.
This patch set reintroduces a 'setkey' command, to support changing the
keyboard
Quoted 2 lines
map, similarly to what was possible under Legacy GRUB.
Quoted 6 lines
GRUB2 already has framework for custom keyboard layouts. Why not reuse
grub_term_map_key()from keylayouts same asat_keyboardandusb_keyboarddo? Map scan code to GRUB_KEYBOARD_* and letgrub_term_map_key()to care about keyboard mapping. This has additional advantage of supporting localized keyboard tables (your approach does not, it only changes ASCII layouts).
Hmm... good idea. I'll look into this. Thanks for the pointer.
Quoted 10 lines
Quoted 1 line
The first patch just makes a simple edit to a comment line in the
'
memory.h'Quoted 1 line
header file. It updates the URL for the 'bios_data_area.html' web page,
which
Quoted 3 lines
contains helpful information about BIOS, and specifically, the keyboard interface.
You already sent this one, it hardly belongs to this patch series.
Sorry about that.
Quoted 9 lines
Quoted 2 lines
The second patch implements the 'nusetkey' module, which provides the
'setkey'
Quoted 3 lines
command. In addition, it provides a 'setnumpad' command, to change the behavior of the numeric keypad.
Why NumLock is not sufficient?
NumLock is 'sufficient' in that it works.
I implemented the 'always output numeric character' feature because I find it annoying that the numeric keypad doesn't produce numeric characters by default.
The BIOS of my laptop doesn't offer me the option of automatically turning NumLock on, which is an added annoyance.
And, last but not least, my laptop doesn't have a NumLock LED, so I cannot even visually verify if NumLock is on or off.
I use the numeric keypad only ever to get numeric characters anyway (which is what it should be there for in the first place, in my not so humble opinion), and since the feature was pretty easy to implement, I decided to go for it.
Quoted 8 lines
Quoted 4 lines
The third patch implements the 'nuconsole' input terminal, which works in conjunction with the 'nusetkey' module to support keyboard map changes.
Making them two different modules in your case is pointless; nuconsole cannot work without nusetkey and nusetkey is used only by nuconsole.
I won't disagree that it seems pointless.
In fact, I initially wanted to integrate all of my code in one module, but that didn't work.
I got some kind of error about some out-of-memory or table-full condition, or some such (don't remember exactly; failed to take notes). It seemed to me that terminal input and/or output modules couldn't provide their own commands.
I may be wrong, though, in which case I must have done something awfully stupid.
Quoted 2 lines
Also, something like
ext_keyboardwould probably be more appropriate.
Agreed.. will go for the 'ext_keyboard' name.
Quoted 27 lines
Quoted 4 lines
Finally, the fourth patch provides updates to the GRUB manual. It documents the 'keymap' command (which loads a keyboard map for use by the '
at_keyboard' or 'usb_keyboard' input terminals), plus the 'setkey'and
Quoted 11 lines
'setnumpad' commands implemented by the 'nusetkey' module.
Luc Van Rompaey (4):
update URL to bios_data_area.html on comment line implement the nusetkey module
implement the nuconsole input terminal
add documentation for keymap, setkey, and setnumpad commandsdocs/grub.texi | 150 +++++++++ grub-core/Makefile.core.def | 12 + grub-core/commands/i386/pc/nusetkey.c | 583++++++++++++++++++++++++++++++++++
Quoted 8 lines
grub-core/term/i386/pc/nuconsole.c | 111 +++++++ include/grub/i386/pc/memory.h | 2 +- include/grub/i386/pc/nusetkey.h | 25 ++ 6 files changed, 882 insertions(+), 1 deletion(-) create mode 100644 grub-core/commands/i386/pc/nusetkey.c create mode 100644 grub-core/term/i386/pc/nuconsole.c create mode 100644 include/grub/i386/pc/nusetkey.h
Just a few quick notes:
- I have just retried to integrate my 'setkey' and 'setnumpad' commands into my input terminal module, and it works.
I have no idea what I did wrong when I tried it earlier on, but it obviously must have been something silly.
- The INT16H/10H extended keyboard input call, used by my input terminal module, is not powerful enough to fully support a keymap.
For instance, the Belgian keyboard layout uses quite a few <AltGr> (or <RightAlt>) key combinations for various characters, and the call doesn't distinguish between <LeftAlt> and <RightAlt>.
Furthermore, not all keys report their <Alt> combination. As a result, under the Belgian keyboard layout, there would be no way to input, for example, a backslash character.
Of course, my 'setkey' command runs into similar problems, so that is not a perfect solution either.
- Since it's a bit silly to replace one not entirely satisfying solution with another, I will not further pursue a solution that is based upon my input terminal modules; that really seems somewhat like a waste of time. Instead, I'll try and find out what is going wrong with 'at_keyboard', and see if I can fix it.
- In any case, I can continue to use my input terminal for now, until I can work out a better option.
2015-07-12 14:25 GMT+02:00 Luc Van Rompaey <[email protected]>:
Quoted 147 lines
2015-07-12 12:03 GMT+02:00 Andrei Borzenkov <[email protected]>:
Quoted 7 lines
В Sat, 11 Jul 2015 20:28:20 +0200
Luc Van Rompaey <[email protected]> пишет:Quoted 4 lines
Legacy GRUB had a 'setkey' command to remap the keyboard keys. GRUB2 no longer has this command. Instead, it provides an '
at_keyboard' input terminal module, which can load a GRUB keymap. Unfortunately, at least on the i386-pc platform, 'at_keyboard' isQuoted 7 lines
problematic,
Quoted 2 lines
in that it easily causes hangups.
Do you have some more data? Fixing it would be preferable.
For starters, the first keystroke after I activate '
at_keyboard', willnot get processed, even though the countdown until automatic boot will get stopped.
Further keystrokes are something of a hit-and-miss, until the system no longer responds to keyboard input.
At that point, either some kind of crash will happen, after which the computer reboots, or I need to perform a hard reset (power cycle).If I do get to the point where I can chainload another GRUB copy (with a default config as automatically generated under, e.g., Debian or Ubuntu), then apparently, the keystrokes that didn't get processed earlier on, suddenly seem to be run, ... after which the system locks up, and a hard reset is, again, required.
I would love to fix the '
at_keyboard' issue, and I will if I can. I cannot at this point promise anything, though. Plus, something less convoluted is a great exercise to get a feel for the GRUB code.Quoted 11 lines
For now, I'm unsure what needs to be done to fix '
at_keyboard', which is whyQuoted 1 line
I decided to look for a different solution. Whether I can fix the
'
at_keyboard'Quoted 3 lines
input terminal, and in what time frame, remains to be seen.
This patch set reintroduces a 'setkey' command, to support changing the
keyboard
Quoted 2 lines
map, similarly to what was possible under Legacy GRUB.
Quoted 6 lines
GRUB2 already has framework for custom keyboard layouts. Why not reuse
grub_term_map_key()from keylayouts same asat_keyboardandusb_keyboarddo? Map scan code to GRUB_KEYBOARD_* and letgrub_term_map_key()to care about keyboard mapping. This has additional advantage of supporting localized keyboard tables (your approach does not, it only changes ASCII layouts).Hmm... good idea. I'll look into this. Thanks for the pointer.
Quoted 10 lines
Quoted 1 line
The first patch just makes a simple edit to a comment line in the
'
memory.h'Quoted 1 line
header file. It updates the URL for the 'bios_data_area.html' web
page, which
Quoted 3 lines
contains helpful information about BIOS, and specifically, the keyboard interface.
You already sent this one, it hardly belongs to this patch series.
Sorry about that.
Quoted 9 lines
Quoted 2 lines
The second patch implements the 'nusetkey' module, which provides the
'setkey'
Quoted 3 lines
command. In addition, it provides a 'setnumpad' command, to change the behavior of the numeric keypad.
Why NumLock is not sufficient?
NumLock is 'sufficient' in that it works.
I implemented the 'always output numeric character' feature because I find it annoying that the numeric keypad doesn't produce numeric characters by default.
The BIOS of my laptop doesn't offer me the option of automatically turning NumLock on, which is an added annoyance.
And, last but not least, my laptop doesn't have a NumLock LED, so I cannot even visually verify if NumLock is on or off.I use the numeric keypad only ever to get numeric characters anyway (which is what it should be there for in the first place, in my not so humble opinion), and since the feature was pretty easy to implement, I decided to go for it.
Quoted 9 lines
Quoted 2 lines
The third patch implements the 'nuconsole' input terminal, which works
in
Quoted 2 lines
conjunction with the 'nusetkey' module to support keyboard map changes.
Making them two different modules in your case is pointless; nuconsole cannot work without nusetkey and nusetkey is used only by nuconsole.
I won't disagree that it seems pointless.
In fact, I initially wanted to integrate all of my code in one module, but that didn't work.
I got some kind of error about some out-of-memory or table-full condition, or some such (don't remember exactly; failed to take notes). It seemed to me that terminal input and/or output modules couldn't provide their own commands.
I may be wrong, though, in which case I must have done something awfully stupid.Quoted 2 lines
Also, something like
ext_keyboardwould probably be more appropriate.Agreed.. will go for the '
ext_keyboard' name.Quoted 27 lines
Quoted 4 lines
Finally, the fourth patch provides updates to the GRUB manual. It documents the 'keymap' command (which loads a keyboard map for use by the '
at_keyboard' or 'usb_keyboard' input terminals), plus the 'setkey'and
Quoted 11 lines
'setnumpad' commands implemented by the 'nusetkey' module.
Luc Van Rompaey (4):
update URL to bios_data_area.html on comment line implement the nusetkey module
implement the nuconsole input terminal
add documentation for keymap, setkey, and setnumpad commandsdocs/grub.texi | 150 +++++++++ grub-core/Makefile.core.def | 12 + grub-core/commands/i386/pc/nusetkey.c | 583++++++++++++++++++++++++++++++++++
Quoted 8 lines
grub-core/term/i386/pc/nuconsole.c | 111 +++++++ include/grub/i386/pc/memory.h | 2 +- include/grub/i386/pc/nusetkey.h | 25 ++ 6 files changed, 882 insertions(+), 1 deletion(-) create mode 100644 grub-core/commands/i386/pc/nusetkey.c create mode 100644 grub-core/term/i386/pc/nuconsole.c create mode 100644 include/grub/i386/pc/nusetkey.h
Le 14 juil. 2015 19:25, "Luc Van Rompaey" <[email protected]> a écrit :
Quoted 3 lines
Just a few quick notes:
I have just retried to integrate my 'setkey' and 'setnumpad' commands
into my input terminal module, and it works.
Quoted 1 line
I have no idea what I did wrong when I tried it earlier on, but it
obviously must have been something silly.
Quoted 1 line
The INT16H/10H extended keyboard input call, used by my input terminal
module, is not powerful enough to fully support a keymap.
Quoted 1 line
For instance, the Belgian keyboard layout uses quite a few <AltGr> (or
<RightAlt>) key combinations for various characters, and the call doesn't distinguish between <LeftAlt> and <RightAlt>.
Quoted 1 line
Furthermore, not all keys report their <Alt> combination. As a result,
under the Belgian keyboard layout, there would be no way to input, for example, a backslash character.
Yep. I've run into the same problem when I was investigating possibility of keymap with BIOS. Only few keyboards end up functional under those restrictions. You might have better luck of you read some of this data from BDA directly.
I have few others comments as to code style but I skip them as I'm not even sure it's a viable solution at all.
Quoted 1 line
Of course, my 'setkey' command runs into similar problems, so that is not
a perfect solution either.
Quoted 1 line
Since it's a bit silly to replace one not entirely satisfying solution
with another, I will not further pursue a solution that is based upon my input terminal modules; that really seems somewhat like a waste of time. Instead, I'll try and find out what is going wrong with 'at_keyboard', and see if I can fix it.
Most likely you just need to add code to disable keyboard inferior INT1 AFAIR
Quoted 1 line
In any case, I can continue to use my input terminal for now, until I can
work out a better option.
Quoted 11 lines
2015-07-12 14:25 GMT+02:00 Luc Van Rompaey <[email protected]>:
Quoted 9 lines
2015-07-12 12:03 GMT+02:00 Andrei Borzenkov <[email protected]>:
Quoted 6 lines
В Sat, 11 Jul 2015 20:28:20 +0200
Luc Van Rompaey <[email protected]> пишет:Quoted 2 lines
Legacy GRUB had a 'setkey' command to remap the keyboard keys. GRUB2 no longer has this command. Instead, it provides an
'at_keyboard'
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
input terminal module, which can load a GRUB keymap. Unfortunately, at least on the i386-pc platform, '
at_keyboard' is
problematic,
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
in that it easily causes hangups.
Do you have some more data? Fixing it would be preferable.
For starters, the first keystroke after I activate '
at_keyboard', will
not get processed, even though the countdown until automatic boot will get stopped.
Quoted 1 line
Quoted 1 line
Further keystrokes are something of a hit-and-miss, until the system no
longer responds to keyboard input.
Quoted 1 line
Quoted 1 line
At that point, either some kind of crash will happen, after which the
computer reboots, or I need to perform a hard reset (power cycle).
Quoted 2 lines
Quoted 2 lines
If I do get to the point where I can chainload another GRUB copy (with a
default config as automatically generated under, e.g., Debian or Ubuntu), then apparently, the keystrokes that didn't get processed earlier on, suddenly seem to be run, ... after which the system locks up, and a hard reset is, again, required.
Quoted 2 lines
Quoted 2 lines
I would love to fix the '
at_keyboard' issue, and I will if I can. I
cannot at this point promise anything, though. Plus, something less convoluted is a great exercise to get a feel for the GRUB code.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
For now, I'm unsure what needs to be done to fix '
at_keyboard', which
is why
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
I decided to look for a different solution. Whether I can fix the
'at_keyboard'
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
input terminal, and in what time frame, remains to be seen.
This patch set reintroduces a 'setkey' command, to support changing
the keyboard
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 2 lines
map, similarly to what was possible under Legacy GRUB.
GRUB2 already has framework for custom keyboard layouts. Why not reuse
grub_term_map_key()from keylayouts same asat_keyboardandusb_keyboarddo? Map scan code to GRUB_KEYBOARD_* and letgrub_term_map_key()to care about keyboard mapping. This has additional advantage of supporting localized keyboard tables (your approach does not, it only changes ASCII layouts).
Quoted 4 lines
Quoted 4 lines
Hmm... good idea. I'll look into this. Thanks for the pointer.
Quoted 2 lines
Quoted 2 lines
The first patch just makes a simple edit to a comment line in the
'memory.h'
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
header file. It updates the URL for the 'bios_data_area.html' web
page, which
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
contains helpful information about BIOS, and specifically, the
keyboard
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 2 lines
interface.
You already sent this one, it hardly belongs to this patch series.
Sorry about that.
Quoted 3 lines
Quoted 3 lines
The second patch implements the 'nusetkey' module, which provides the
'setkey'
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
command. In addition, it provides a 'setnumpad' command, to change the behavior of the numeric keypad.
Why NumLock is not sufficient?
NumLock is 'sufficient' in that it works.
I implemented the 'always output numeric character' feature because I
find it annoying that the numeric keypad doesn't produce numeric characters by default.
Quoted 1 line
Quoted 1 line
The BIOS of my laptop doesn't offer me the option of automatically
turning NumLock on, which is an added annoyance.
Quoted 1 line
Quoted 1 line
And, last but not least, my laptop doesn't have a NumLock LED, so I
cannot even visually verify if NumLock is on or off.
Quoted 2 lines
Quoted 2 lines
I use the numeric keypad only ever to get numeric characters anyway
(which is what it should be there for in the first place, in my not so humble opinion), and since the feature was pretty easy to implement, I decided to go for it.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
The third patch implements the 'nuconsole' input terminal, which
works in
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
conjunction with the 'nusetkey' module to support keyboard map
changes.
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Making them two different modules in your case is pointless; nuconsole cannot work without nusetkey and nusetkey is used only by nuconsole.
I won't disagree that it seems pointless.
In fact, I initially wanted to integrate all of my code in one module,
but that didn't work.
Quoted 1 line
Quoted 1 line
I got some kind of error about some out-of-memory or table-full
condition, or some such (don't remember exactly; failed to take notes).
Quoted 1 line
Quoted 1 line
It seemed to me that terminal input and/or output modules couldn't
provide their own commands.
Quoted 1 line
Quoted 1 line
I may be wrong, though, in which case I must have done something awfully
stupid.
Quoted 10 lines
Quoted 10 lines
Quoted 3 lines
Also, something like
ext_keyboardwould probably be more appropriate.Agreed.. will go for the '
ext_keyboard' name.Quoted 4 lines
Quoted 4 lines
Finally, the fourth patch provides updates to the GRUB manual. It documents the 'keymap' command (which loads a keyboard map for use
by
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
the '
at_keyboard' or 'usb_keyboard' input terminals), plus the
'setkey' and
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
'setnumpad' commands implemented by the 'nusetkey' module.
Luc Van Rompaey (4):
update URL to bios_data_area.html on comment line implement the nusetkey module
implement the nuconsole input terminal
add documentation for keymap, setkey, and setnumpad commandsdocs/grub.texi | 150 +++++++++ grub-core/Makefile.core.def | 12 + grub-core/commands/i386/pc/nusetkey.c | 583
++++++++++++++++++++++++++++++++++
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
Quoted 8 lines
grub-core/term/i386/pc/nuconsole.c | 111 +++++++ include/grub/i386/pc/memory.h | 2 +- include/grub/i386/pc/nusetkey.h | 25 ++ 6 files changed, 882 insertions(+), 1 deletion(-) create mode 100644 grub-core/commands/i386/pc/nusetkey.c create mode 100644 grub-core/term/i386/pc/nuconsole.c create mode 100644 include/grub/i386/pc/nusetkey.h_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel