iPXE discussion forum
how to press F1 - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: how to press F1 (/showthread.php?tid=18568)

how to press F1 - cckp - 2019-07-03 00:49

from here:
I saw an example:
prompt --key 0x02 --timeout 2000 Press Ctrl-B for the iPXE shell... || goto no_shell

just to be curious, how to change the key to F1?

there's some keycode in that page, F4....F12,

but I didn't see keycode for F1 F2 F3 F4, is there any special reason for not defining these four keys?

RE: how to press F1 - NiKiZe - 2019-07-03 07:00

Maybe it doesn't need conversation?

I think building iPXE with DEBUG=bios_console should show you the scancodes.

RE: how to press F1 - cckp - 2019-07-03 11:19

The values for special keys such as Ctrl-B and F12 are defined in include/ipxe/keys.h within the iPXE source code.


#define KEY_DC KEY_ANSI ( 3, '~' ) /**< Delete */
73 #define KEY_PPAGE KEY_ANSI ( 5, '~' ) /**< Page up */
74 #define KEY_NPAGE KEY_ANSI ( 6, '~' ) /**< Page down */
75 #define KEY_F5 KEY_ANSI ( 15, '~' ) /**< F5 */
76 #define KEY_F6 KEY_ANSI ( 17, '~' ) /**< F6 */
77 #define KEY_F7 KEY_ANSI ( 18, '~' ) /**< F7 */
78 #define KEY_F8 KEY_ANSI ( 19, '~' ) /**< F8 (for PXE) */
79 #define KEY_F9 KEY_ANSI ( 20, '~' ) /**< F9 */
80 #define KEY_F10 KEY_ANSI ( 21, '~' ) /**< F10 */
81 #define KEY_F11 KEY_ANSI ( 23, '~' ) /**< F11 */
82 #define KEY_F12 KEY_ANSI ( 24, '~' ) /**< F12 */
84 /* Not in the [KEY_MIN,KEY_MAX] range; terminals seem to send these as
85 *

only keys from F5 to F12 are defined

is F1 not supported ? or not recommend?

if it IS supported, you must build it from source and add that parameter to find the keycode?

RE: how to press F1 - NiKiZe - 2019-07-03 13:46

A-Z is not defined either, and they work, again, they might not need special handling, but I have not confirmed.

RE: how to press F1 - cckp - 2019-07-03 13:56

a-z is not special key, can be used as is in cmd
as, so need not define

prompt -k a

this works

but you cannot use this:

prompt -k f1

I tried my best to find the keycode for F1
but failed.

i tried ( 14, '~' ) , since F5 is ( 15, '~' ) , but failed

these keys must be something special, there should be some reason. or the programmer just forgot it?

RE: how to press F1 - cckp - 2019-07-04 03:03

finally I setup a vmware machine to build iPXE, with suggested DEBUG=bios_console

then, when I run the command "prompt",

and press F1, I got this error:
"Unrecognised BIOS scancode 3b"

and for F2:
"Unrecognised BIOS scancode 3c"

and for F3:
"Unrecognised BIOS scancode 3d"

and for F4:
"Unrecognised BIOS scancode 3e"

and for F5...F12, no problem.

I think 'Unrecognised' means the iPXE programmer forgot to define it , right?

tried this:
prompt -k 0x3b
did not work.

RE: how to press F1 - mcb30 - 2019-07-09 13:18

(2019-07-04 03:03)cckp Wrote:  I think 'Unrecognised' means the iPXE programmer forgot to define it , right?

There is a surprising amount of inconsistency in the ANSI escape codes that various terminals will generate for the lower-numbered function keys. For example: try running "cat" in a graphical terminal window, press F1-F12 in turn to see which sequences are generated, then do the same in a text console (i.e. outside of X11).

Only F6-F12 can reliably be recognised without needing to define a concept of terminal type. (F5 was erroneously added to the "reliable" list; it shouldn't really be there.) iPXE deliberately defines only the keys that are likely to work almost all of the time.