* commands/i386/pc/sendkey.c (options): Remove "keep" from all
status flag options; simply omitting the option is equivalent and simpler. Rename "wait" to "pause". Rename "sysreq" to "sysrq". (keysym_table): Rename "num5numlock" to "numlock". (grub_cmd_sendkey): Reinitialise `andmask' and `ormask', so that we can uniformly say that only the last of multiple `sendkey' invocations has any effect. * docs/grub.texi (sendkey): New section.
This commit is contained in:
parent
93541d660d
commit
c4d1654256
3 changed files with 180 additions and 17 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2010-08-20 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* commands/i386/pc/sendkey.c (options): Remove "keep" from all
|
||||
status flag options; simply omitting the option is equivalent and
|
||||
simpler. Rename "wait" to "pause". Rename "sysreq" to "sysrq".
|
||||
(keysym_table): Rename "num5numlock" to "numlock".
|
||||
(grub_cmd_sendkey): Reinitialise `andmask' and `ormask', so that we
|
||||
can uniformly say that only the last of multiple `sendkey'
|
||||
invocations has any effect.
|
||||
* docs/grub.texi (sendkey): New section.
|
||||
|
||||
2010-08-19 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* commands/i386/pc/sendkey.c (options): Fix three typos.
|
||||
|
|
|
@ -33,22 +33,22 @@ static int keylen = 0;
|
|||
static int noled = 0;
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"num", 'n', 0, "set numlock mode", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"caps", 'c', 0, "set capslock mode", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"scroll", 's', 0, "set scrolllock mode", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"insert", 0, 0, "set insert mode", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"wait", 0, 0, "set wait mode", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"left-shift", 0, 0, "press left shift", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"right-shift", 0, 0, "press right shift", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"sysreq", 0, 0, "press sysreq", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"numkey", 0, 0, "press NumLock key", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"capskey", 0, 0, "press CapsLock key", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"scrollkey", 0, 0, "press ScrollLock key", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"insertkey", 0, 0, "press Insert key", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"left-alt", 0, 0, "press left alt", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"right-alt", 0, 0, "press right alt", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"left-ctrl", 0, 0, "press left ctrl", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"right-ctrl", 0, 0, "press right ctrl", "[keep|on|off]", ARG_TYPE_STRING},
|
||||
{"num", 'n', 0, "set numlock mode", "[on|off]", ARG_TYPE_STRING},
|
||||
{"caps", 'c', 0, "set capslock mode", "[on|off]", ARG_TYPE_STRING},
|
||||
{"scroll", 's', 0, "set scrolllock mode", "[on|off]", ARG_TYPE_STRING},
|
||||
{"insert", 0, 0, "set insert mode", "[on|off]", ARG_TYPE_STRING},
|
||||
{"pause", 0, 0, "set pause mode", "[on|off]", ARG_TYPE_STRING},
|
||||
{"left-shift", 0, 0, "press left shift", "[on|off]", ARG_TYPE_STRING},
|
||||
{"right-shift", 0, 0, "press right shift", "[on|off]", ARG_TYPE_STRING},
|
||||
{"sysrq", 0, 0, "press SysRq", "[on|off]", ARG_TYPE_STRING},
|
||||
{"numkey", 0, 0, "press NumLock key", "[on|off]", ARG_TYPE_STRING},
|
||||
{"capskey", 0, 0, "press CapsLock key", "[on|off]", ARG_TYPE_STRING},
|
||||
{"scrollkey", 0, 0, "press ScrollLock key", "[on|off]", ARG_TYPE_STRING},
|
||||
{"insertkey", 0, 0, "press Insert key", "[on|off]", ARG_TYPE_STRING},
|
||||
{"left-alt", 0, 0, "press left alt", "[on|off]", ARG_TYPE_STRING},
|
||||
{"right-alt", 0, 0, "press right alt", "[on|off]", ARG_TYPE_STRING},
|
||||
{"left-ctrl", 0, 0, "press left ctrl", "[on|off]", ARG_TYPE_STRING},
|
||||
{"right-ctrl", 0, 0, "press right ctrl", "[on|off]", ARG_TYPE_STRING},
|
||||
{"no-led", 0, 0, "don't update LED state", 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
@ -144,7 +144,7 @@ static struct keysym keysym_table[] =
|
|||
{"num9", "numpgup", '9', 0, 0x49},
|
||||
{"numminus", 0, '-', 0, 0x4a},
|
||||
{"num4", "numleft", '4', 0, 0x4b},
|
||||
{"num5", "num5numlock", '5', 0, 0x4c},
|
||||
{"num5", "numlock", '5', 0, 0x4c},
|
||||
{"num6", "numright", '6', 0, 0x4d},
|
||||
{"numplus", 0, '-', 0, 0x4e},
|
||||
{"num1", "numend", '1', 0, 0x4f},
|
||||
|
@ -325,6 +325,9 @@ grub_cmd_sendkey (grub_extcmd_t cmd, int argc, char **args)
|
|||
return 0;
|
||||
}
|
||||
|
||||
andmask = 0xffffffff;
|
||||
ormask = 0;
|
||||
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
149
docs/grub.texi
149
docs/grub.texi
|
@ -2094,6 +2094,7 @@ you forget a command, you can run the command @command{help}
|
|||
* pxe_unload:: Unload the PXE environment
|
||||
* reboot:: Reboot your computer
|
||||
* search:: Search devices by file, label, or UUID
|
||||
* sendkey:: Emulate keystrokes
|
||||
* set:: Set an environment variable
|
||||
* unset:: Unset an environment variable
|
||||
* uppermem:: Set the upper memory size
|
||||
|
@ -2604,6 +2605,154 @@ commands are aliases for @samp{search --file}, @samp{search --label}, and
|
|||
@end deffn
|
||||
|
||||
|
||||
@node sendkey
|
||||
@subsection sendkey
|
||||
|
||||
@deffn Command sendkey @
|
||||
[@option{--num}|@option{--caps}|@option{--scroll}|@option{--insert}|@
|
||||
@option{--pause}|@option{--left-shift}|@option{--right-shift}|@
|
||||
@option{--sysrq}|@option{--numkey}|@option{--capskey}|@option{--scrollkey}|@
|
||||
@option{--insertkey}|@option{--left-alt}|@option{--right-alt}|@
|
||||
@option{--left-ctrl}|@option{--right-ctrl} @
|
||||
@samp{on}|@samp{off}]@dots{} @
|
||||
[@option{no-led}] @
|
||||
keystroke
|
||||
Insert keystrokes into the keyboard buffer when booting. Sometimes an
|
||||
operating system or chainloaded boot loader requires particular keys to be
|
||||
pressed: for example, one might need to press a particular key to enter
|
||||
"safe mode", or when chainloading another boot loader one might send
|
||||
keystrokes to it to navigate its menu.
|
||||
|
||||
You may provide up to 16 keystrokes (the length of the BIOS keyboard
|
||||
buffer). Keystroke names may be upper-case or lower-case letters, digits,
|
||||
or taken from the following table:
|
||||
|
||||
@c Please keep this table in the same order as in
|
||||
@c commands/i386/pc/sendkey.c, for ease of maintenance.
|
||||
@c Exception: The function and numeric keys are sorted, for aesthetics.
|
||||
|
||||
@multitable @columnfractions .4 .5
|
||||
@headitem Name @tab Key
|
||||
@item escape @tab Escape
|
||||
@item exclam @tab !
|
||||
@item at @tab @@
|
||||
@item numbersign @tab #
|
||||
@item dollar @tab $
|
||||
@item percent @tab %
|
||||
@item caret @tab ^
|
||||
@item ampersand @tab &
|
||||
@item asterisk @tab *
|
||||
@item parenleft @tab (
|
||||
@item parenright @tab )
|
||||
@item minus @tab -
|
||||
@item underscore @tab _
|
||||
@item equal @tab =
|
||||
@item plus @tab +
|
||||
@item backspace @tab Backspace
|
||||
@item tab @tab Tab
|
||||
@item bracketleft @tab [
|
||||
@item braceleft @tab @{
|
||||
@item bracketright @tab ]
|
||||
@item braceright @tab @}
|
||||
@item enter @tab Enter
|
||||
@item control @tab press and release Control
|
||||
@item semicolon @tab ;
|
||||
@item colon @tab :
|
||||
@item quote @tab '
|
||||
@item doublequote @tab "
|
||||
@item backquote @tab `
|
||||
@item tilde @tab ~
|
||||
@item shift @tab press and release left Shift
|
||||
@item backslash @tab \
|
||||
@item bar @tab |
|
||||
@item comma @tab ,
|
||||
@item less @tab <
|
||||
@item period @tab .
|
||||
@item greater @tab >
|
||||
@item slash @tab /
|
||||
@item question @tab ?
|
||||
@item rshift @tab press and release right Shift
|
||||
@item alt @tab press and release Alt
|
||||
@item space @tab space bar
|
||||
@item capslock @tab Caps Lock
|
||||
@item F1 @tab F1
|
||||
@item F2 @tab F2
|
||||
@item F3 @tab F3
|
||||
@item F4 @tab F4
|
||||
@item F5 @tab F5
|
||||
@item F6 @tab F6
|
||||
@item F7 @tab F7
|
||||
@item F8 @tab F8
|
||||
@item F9 @tab F9
|
||||
@item F10 @tab F10
|
||||
@item F11 @tab F11
|
||||
@item F12 @tab F12
|
||||
@item num1 @tab 1 (numeric keypad)
|
||||
@item num2 @tab 2 (numeric keypad)
|
||||
@item num3 @tab 3 (numeric keypad)
|
||||
@item num4 @tab 4 (numeric keypad)
|
||||
@item num5 @tab 5 (numeric keypad)
|
||||
@item num6 @tab 6 (numeric keypad)
|
||||
@item num7 @tab 7 (numeric keypad)
|
||||
@item num8 @tab 8 (numeric keypad)
|
||||
@item num9 @tab 9 (numeric keypad)
|
||||
@item num0 @tab 0 (numeric keypad)
|
||||
@item numperiod @tab . (numeric keypad)
|
||||
@item numend @tab End (numeric keypad)
|
||||
@item numdown @tab Down (numeric keypad)
|
||||
@item numpgdown @tab Page Down (numeric keypad)
|
||||
@item numleft @tab Left (numeric keypad)
|
||||
@item numlock @tab Num Lock (numeric keypad)
|
||||
@item numright @tab Right (numeric keypad)
|
||||
@item numhome @tab Home (numeric keypad)
|
||||
@item numup @tab Up (numeric keypad)
|
||||
@item numpgup @tab Page Up (numeric keypad)
|
||||
@item numinsert @tab Insert (numeric keypad)
|
||||
@item numdelete @tab Delete (numeric keypad)
|
||||
@item numasterisk @tab * (numeric keypad)
|
||||
@item numminus @tab - (numeric keypad)
|
||||
@item numplus @tab + (numeric keypad)
|
||||
@item numslash @tab / (numeric keypad)
|
||||
@item numenter @tab Enter (numeric keypad)
|
||||
@item delete @tab Delete
|
||||
@item insert @tab Insert
|
||||
@item home @tab Home
|
||||
@item end @tab End
|
||||
@item pgdown @tab Page Down
|
||||
@item pgup @tab Page Up
|
||||
@item down @tab Down
|
||||
@item up @tab Up
|
||||
@item left @tab Left
|
||||
@item right @tab Right
|
||||
@end multitable
|
||||
|
||||
As well as keystrokes, the @command{sendkey} command takes various options
|
||||
that affect the BIOS keyboard status flags. These options take an @samp{on}
|
||||
or @samp{off} parameter, specifying that the corresponding status flag be
|
||||
set or unset; omitting the option for a given status flag will leave that
|
||||
flag at its initial state at boot. The @option{--num}, @option{--caps},
|
||||
@option{--scroll}, and @option{--insert} options emulate setting the
|
||||
corresponding mode, while the @option{--numkey}, @option{--capskey},
|
||||
@option{--scrollkey}, and @option{--insertkey} options emulate pressing and
|
||||
holding the corresponding key. The other status flag options are
|
||||
self-explanatory.
|
||||
|
||||
If the @option{--no-led} option is given, the status flag options will have
|
||||
no effect on keyboard LEDs.
|
||||
|
||||
If the @command{sendkey} command is given multiple times, then only the last
|
||||
invocation has any effect.
|
||||
|
||||
Since @command{sendkey} manipulates the BIOS keyboard buffer, it may cause
|
||||
hangs, reboots, or other misbehaviour on some systems. If the operating
|
||||
system or boot loader that runs after GRUB uses its own keyboard driver
|
||||
rather than the BIOS keyboard functions, then @command{sendkey} will have no
|
||||
effect.
|
||||
|
||||
This command is only available on PC BIOS systems.
|
||||
@end deffn
|
||||
|
||||
|
||||
@node set
|
||||
@subsection set
|
||||
|
||||
|
|
Loading…
Reference in a new issue