david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[console] Add keymap generator

Inspired by LILO's keytab-lilo.pl, genkeymap.pl uses "loadkeys -b" to
obtain a Linux keyboard map, and generates a file keymap_xx.c in
hci/keymap.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2011-03-16 03:22:45 +00:00
parent f98cf7d70f
commit 1febd879e3
35 changed files with 1160 additions and 0 deletions

View File

@ -45,6 +45,7 @@ ELF2EFI64 := ./util/elf2efi64
EFIROM := ./util/efirom
ICCFIX := ./util/iccfix
EINFO := ./util/einfo
GENKEYMAP := ./util/genkeymap.pl
DOXYGEN := doxygen
BINUTILS_DIR := /usr
BFD_DIR := $(BINUTILS_DIR)
@ -80,6 +81,7 @@ SRCDIRS += tests
SRCDIRS += crypto crypto/axtls crypto/matrixssl
SRCDIRS += hci hci/commands hci/tui
SRCDIRS += hci/mucurses hci/mucurses/widgets
SRCDIRS += hci/keymap
SRCDIRS += usr
SRCDIRS += config

View File

@ -1085,6 +1085,14 @@ docview :
endif # defined(BIN)
###############################################################################
#
# Keyboard maps
#
hci/keymap/keymap_%.c : $(GENKEYMAP)
$(Q)$(PERL) $(GENKEYMAP) $* > $@
###############################################################################
#
# Clean-up

View File

@ -0,0 +1,31 @@
/** @file
*
* "al" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "al" keyboard mapping */
struct key_mapping al_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x22, 0x7b }, /* '"' => '{' */
{ 0x27, 0x5b }, /* '\'' => '[' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x59, 0x5a }, /* 'Y' => 'Z' */
{ 0x5a, 0x59 }, /* 'Z' => 'Y' */
{ 0x5c, 0x5d }, /* '\\' => ']' */
{ 0x5d, 0x40 }, /* ']' => '@' */
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
{ 0x7c, 0x7d }, /* '|' => '}' */
{ 0x7d, 0x27 }, /* '}' => '\'' */
{ 0x7e, 0x7c }, /* '~' => '|' */
};

View File

@ -0,0 +1,24 @@
/** @file
*
* "az" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "az" keyboard mapping */
struct key_mapping az_mapping[] __keymap = {
{ 0x23, 0x27 }, /* '#' => '\'' */
{ 0x24, 0x3b }, /* '$' => ';' */
{ 0x26, 0x3f }, /* '&' => '?' */
{ 0x2f, 0x2e }, /* '/' => '.' */
{ 0x3a, 0x49 }, /* ':' => 'I' */
{ 0x3f, 0x2c }, /* '?' => ',' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5e, 0x3a }, /* '^' => ':' */
{ 0x7c, 0x2f }, /* '|' => '/' */
};

View File

@ -0,0 +1,15 @@
/** @file
*
* "bg" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "bg" keyboard mapping */
struct key_mapping bg_mapping[] __keymap = {
};

View File

@ -0,0 +1,15 @@
/** @file
*
* "by" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "by" keyboard mapping */
struct key_mapping by_mapping[] __keymap = {
};

View File

@ -0,0 +1,24 @@
/** @file
*
* "cf" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "cf" keyboard mapping */
struct key_mapping cf_mapping[] __keymap = {
{ 0x23, 0x2f }, /* '#' => '/' */
{ 0x3c, 0x27 }, /* '<' => '\'' */
{ 0x3e, 0x2e }, /* '>' => '.' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x3c }, /* '\\' => '<' */
{ 0x5e, 0x3f }, /* '^' => '?' */
{ 0x60, 0x23 }, /* '`' => '#' */
{ 0x7c, 0x3e }, /* '|' => '>' */
{ 0x7e, 0x7c }, /* '~' => '|' */
};

View File

@ -0,0 +1,27 @@
/** @file
*
* "cz" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "cz" keyboard mapping */
struct key_mapping cz_mapping[] __keymap = {
{ 0x21, 0x2b }, /* '!' => '+' */
{ 0x2d, 0x3d }, /* '-' => '=' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x31, 0x2b }, /* '1' => '+' */
{ 0x3c, 0x5c }, /* '<' => '\\' */
{ 0x3e, 0x2e }, /* '>' => '.' */
{ 0x3f, 0x2d }, /* '?' => '-' */
{ 0x5d, 0x29 }, /* ']' => ')' */
{ 0x5f, 0x3d }, /* '_' => '=' */
{ 0x60, 0x3b }, /* '`' => ';' */
{ 0x7d, 0x29 }, /* '}' => ')' */
{ 0x7e, 0x3b }, /* '~' => ';' */
};

View File

@ -0,0 +1,45 @@
/** @file
*
* "de" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "de" keyboard mapping */
struct key_mapping de_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x22, 0x7d }, /* '"' => '}' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x27, 0x5d }, /* '\'' => ']' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3a, 0x7b }, /* ':' => '{' */
{ 0x3b, 0x5b }, /* ';' => '[' */
{ 0x3d, 0x27 }, /* '=' => '\'' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x59, 0x5a }, /* 'Y' => 'Z' */
{ 0x5a, 0x59 }, /* 'Z' => 'Y' */
{ 0x5b, 0x40 }, /* '[' => '@' */
{ 0x5c, 0x23 }, /* '\\' => '#' */
{ 0x5d, 0x2b }, /* ']' => '+' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x5e }, /* '`' => '^' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
{ 0x7b, 0x5c }, /* '{' => '\\' */
{ 0x7c, 0x27 }, /* '|' => '\'' */
{ 0x7d, 0x2a }, /* '}' => '*' */
};

View File

@ -0,0 +1,30 @@
/** @file
*
* "dk" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "dk" keyboard mapping */
struct key_mapping dk_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x27 }, /* '\\' => '\'' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0x7d, 0x5e }, /* '}' => '^' */
};

View File

@ -0,0 +1,28 @@
/** @file
*
* "es" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "es" keyboard mapping */
struct key_mapping es_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2d, 0x27 }, /* '-' => '\'' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5d, 0x2b }, /* ']' => '+' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7d, 0x2a }, /* '}' => '*' */
};

View File

@ -0,0 +1,28 @@
/** @file
*
* "et" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "et" keyboard mapping */
struct key_mapping et_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x27 }, /* '\\' => '\'' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7c, 0x2a }, /* '|' => '*' */
};

View File

@ -0,0 +1,37 @@
/** @file
*
* "fi" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "fi" keyboard mapping */
struct key_mapping fi_mapping[] __keymap = {
{ 0x22, 0x5b }, /* '"' => '[' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3a, 0x5c }, /* ':' => '\\' */
{ 0x3b, 0x7c }, /* ';' => '|' */
{ 0x3d, 0x27 }, /* '=' => '\'' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5b, 0x7d }, /* '[' => '}' */
{ 0x5c, 0x27 }, /* '\\' => '\'' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7b, 0x5d }, /* '{' => ']' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0x7d, 0x5e }, /* '}' => '^' */
};

View File

@ -0,0 +1,67 @@
/** @file
*
* "fr" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "fr" keyboard mapping */
struct key_mapping fr_mapping[] __keymap = {
{ 0x01, 0x11 }, /* Ctrl-A => Ctrl-Q */
{ 0x11, 0x01 }, /* Ctrl-Q => Ctrl-A */
{ 0x17, 0x1a }, /* Ctrl-W => Ctrl-Z */
{ 0x1a, 0x17 }, /* Ctrl-Z => Ctrl-W */
{ 0x21, 0x31 }, /* '!' => '1' */
{ 0x22, 0x25 }, /* '"' => '%' */
{ 0x23, 0x33 }, /* '#' => '3' */
{ 0x24, 0x34 }, /* '$' => '4' */
{ 0x25, 0x35 }, /* '%' => '5' */
{ 0x26, 0x37 }, /* '&' => '7' */
{ 0x27, 0x7c }, /* '\'' => '|' */
{ 0x28, 0x39 }, /* '(' => '9' */
{ 0x29, 0x30 }, /* ')' => '0' */
{ 0x2a, 0x38 }, /* '*' => '8' */
{ 0x2c, 0x3b }, /* ',' => ';' */
{ 0x2d, 0x29 }, /* '-' => ')' */
{ 0x2e, 0x3a }, /* '.' => ':' */
{ 0x2f, 0x21 }, /* '/' => '!' */
{ 0x30, 0x40 }, /* '0' => '@' */
{ 0x31, 0x26 }, /* '1' => '&' */
{ 0x32, 0x7b }, /* '2' => '{' */
{ 0x33, 0x22 }, /* '3' => '"' */
{ 0x34, 0x27 }, /* '4' => '\'' */
{ 0x35, 0x28 }, /* '5' => '(' */
{ 0x36, 0x2d }, /* '6' => '-' */
{ 0x37, 0x7d }, /* '7' => '}' */
{ 0x38, 0x5f }, /* '8' => '_' */
{ 0x39, 0x2f }, /* '9' => '/' */
{ 0x3a, 0x4d }, /* ':' => 'M' */
{ 0x3b, 0x6d }, /* ';' => 'm' */
{ 0x3e, 0x2f }, /* '>' => '/' */
{ 0x3f, 0x5c }, /* '?' => '\\' */
{ 0x40, 0x32 }, /* '@' => '2' */
{ 0x41, 0x51 }, /* 'A' => 'Q' */
{ 0x4d, 0x3f }, /* 'M' => '?' */
{ 0x51, 0x41 }, /* 'Q' => 'A' */
{ 0x57, 0x5a }, /* 'W' => 'Z' */
{ 0x5a, 0x57 }, /* 'Z' => 'W' */
{ 0x5b, 0x5e }, /* '[' => '^' */
{ 0x5c, 0x2a }, /* '\\' => '*' */
{ 0x5d, 0x24 }, /* ']' => '$' */
{ 0x5e, 0x36 }, /* '^' => '6' */
{ 0x5f, 0x5d }, /* '_' => ']' */
{ 0x60, 0x2a }, /* '`' => '*' */
{ 0x61, 0x71 }, /* 'a' => 'q' */
{ 0x6d, 0x2c }, /* 'm' => ',' */
{ 0x71, 0x61 }, /* 'q' => 'a' */
{ 0x77, 0x7a }, /* 'w' => 'z' */
{ 0x7a, 0x77 }, /* 'z' => 'w' */
{ 0x7b, 0x3c }, /* '{' => '<' */
{ 0x7c, 0x23 }, /* '|' => '#' */
{ 0x7d, 0x3e }, /* '}' => '>' */
};

View File

@ -0,0 +1,15 @@
/** @file
*
* "gr" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "gr" keyboard mapping */
struct key_mapping gr_mapping[] __keymap = {
};

View File

@ -0,0 +1,34 @@
/** @file
*
* "hu" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "hu" keyboard mapping */
struct key_mapping hu_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x21, 0x27 }, /* '!' => '\'' */
{ 0x23, 0x2b }, /* '#' => '+' */
{ 0x24, 0x21 }, /* '$' => '!' */
{ 0x26, 0x3d }, /* '&' => '=' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3f }, /* '<' => '?' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x59, 0x5a }, /* 'Y' => 'Z' */
{ 0x5a, 0x59 }, /* 'Z' => 'Y' */
{ 0x5e, 0x2f }, /* '^' => '/' */
{ 0x60, 0x30 }, /* '`' => '0' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
};

View File

@ -0,0 +1,15 @@
/** @file
*
* "il" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "il" keyboard mapping */
struct key_mapping il_mapping[] __keymap = {
};

View File

@ -0,0 +1,31 @@
/** @file
*
* "it" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "it" keyboard mapping */
struct key_mapping it_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x5e }, /* '+' => '^' */
{ 0x2d, 0x27 }, /* '-' => '\'' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5d, 0x2b }, /* ']' => '+' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x7d, 0x2a }, /* '}' => '*' */
{ 0x7e, 0x7c }, /* '~' => '|' */
};

View File

@ -0,0 +1,16 @@
/** @file
*
* "lt" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "lt" keyboard mapping */
struct key_mapping lt_mapping[] __keymap = {
{ 0x7f, 0x08 }, /* 0x7f => Ctrl-H */
};

View File

@ -0,0 +1,15 @@
/** @file
*
* "mk" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "mk" keyboard mapping */
struct key_mapping mk_mapping[] __keymap = {
};

View File

@ -0,0 +1,21 @@
/** @file
*
* "mt" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "mt" keyboard mapping */
struct key_mapping mt_mapping[] __keymap = {
{ 0x22, 0x40 }, /* '"' => '@' */
{ 0x23, 0x04 }, /* '#' => Ctrl-D */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x23 }, /* '\\' => '#' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0x7f, 0x08 }, /* 0x7f => Ctrl-H */
};

View File

@ -0,0 +1,34 @@
/** @file
*
* "nl" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "nl" keyboard mapping */
struct key_mapping nl_mapping[] __keymap = {
{ 0x26, 0x5f }, /* '&' => '_' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x27 }, /* ')' => '\'' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x7e }, /* '+' => '~' */
{ 0x2d, 0x2f }, /* '-' => '/' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3b, 0x2b }, /* ';' => '+' */
{ 0x3c, 0x5d }, /* '<' => ']' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x3d }, /* '?' => '=' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x3c }, /* '\\' => '<' */
{ 0x5d, 0x2a }, /* ']' => '*' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x40 }, /* '`' => '@' */
{ 0x7c, 0x3e }, /* '|' => '>' */
{ 0x7d, 0x7c }, /* '}' => '|' */
};

105
src/hci/keymap/keymap_no.c Normal file
View File

@ -0,0 +1,105 @@
/** @file
*
* "no" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "no" keyboard mapping */
struct key_mapping no_mapping[] __keymap = {
{ 0x02, 0x18 }, /* Ctrl-B => Ctrl-X */
{ 0x03, 0x0a }, /* Ctrl-C => Ctrl-J */
{ 0x04, 0x05 }, /* Ctrl-D => Ctrl-E */
{ 0x06, 0x15 }, /* Ctrl-F => Ctrl-U */
{ 0x07, 0x09 }, /* Ctrl-G => Ctrl-I */
{ 0x08, 0x04 }, /* Ctrl-H => Ctrl-D */
{ 0x0a, 0x08 }, /* Ctrl-J => Ctrl-H */
{ 0x0b, 0x14 }, /* Ctrl-K => Ctrl-T */
{ 0x0c, 0x0e }, /* Ctrl-L => Ctrl-N */
{ 0x0e, 0x02 }, /* Ctrl-N => Ctrl-B */
{ 0x0f, 0x12 }, /* Ctrl-O => Ctrl-R */
{ 0x10, 0x0c }, /* Ctrl-P => Ctrl-L */
{ 0x12, 0x10 }, /* Ctrl-R => Ctrl-P */
{ 0x13, 0x0f }, /* Ctrl-S => Ctrl-O */
{ 0x14, 0x19 }, /* Ctrl-T => Ctrl-Y */
{ 0x15, 0x07 }, /* Ctrl-U => Ctrl-G */
{ 0x16, 0x0b }, /* Ctrl-V => Ctrl-K */
{ 0x18, 0x11 }, /* Ctrl-X => Ctrl-Q */
{ 0x19, 0x06 }, /* Ctrl-Y => Ctrl-F */
{ 0x22, 0x5f }, /* '"' => '_' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x27, 0x2d }, /* '\'' => '-' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2c, 0x77 }, /* ',' => 'w' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2e, 0x76 }, /* '.' => 'v' */
{ 0x2f, 0x7a }, /* '/' => 'z' */
{ 0x3a, 0x53 }, /* ':' => 'S' */
{ 0x3b, 0x73 }, /* ';' => 's' */
{ 0x3c, 0x57 }, /* '<' => 'W' */
{ 0x3d, 0x5c }, /* '=' => '\\' */
{ 0x3e, 0x56 }, /* '>' => 'V' */
{ 0x3f, 0x5a }, /* '?' => 'Z' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x42, 0x58 }, /* 'B' => 'X' */
{ 0x43, 0x4a }, /* 'C' => 'J' */
{ 0x44, 0x45 }, /* 'D' => 'E' */
{ 0x45, 0x3a }, /* 'E' => ':' */
{ 0x46, 0x55 }, /* 'F' => 'U' */
{ 0x47, 0x49 }, /* 'G' => 'I' */
{ 0x48, 0x44 }, /* 'H' => 'D' */
{ 0x49, 0x43 }, /* 'I' => 'C' */
{ 0x4a, 0x48 }, /* 'J' => 'H' */
{ 0x4b, 0x54 }, /* 'K' => 'T' */
{ 0x4c, 0x4e }, /* 'L' => 'N' */
{ 0x4e, 0x42 }, /* 'N' => 'B' */
{ 0x4f, 0x52 }, /* 'O' => 'R' */
{ 0x50, 0x4c }, /* 'P' => 'L' */
{ 0x52, 0x50 }, /* 'R' => 'P' */
{ 0x53, 0x4f }, /* 'S' => 'O' */
{ 0x54, 0x59 }, /* 'T' => 'Y' */
{ 0x55, 0x47 }, /* 'U' => 'G' */
{ 0x56, 0x4b }, /* 'V' => 'K' */
{ 0x57, 0x3b }, /* 'W' => ';' */
{ 0x58, 0x51 }, /* 'X' => 'Q' */
{ 0x59, 0x46 }, /* 'Y' => 'F' */
{ 0x5b, 0x27 }, /* '[' => '\'' */
{ 0x5c, 0x3c }, /* '\\' => '<' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x7c }, /* '`' => '|' */
{ 0x62, 0x78 }, /* 'b' => 'x' */
{ 0x63, 0x6a }, /* 'c' => 'j' */
{ 0x64, 0x65 }, /* 'd' => 'e' */
{ 0x65, 0x2e }, /* 'e' => '.' */
{ 0x66, 0x75 }, /* 'f' => 'u' */
{ 0x67, 0x69 }, /* 'g' => 'i' */
{ 0x68, 0x64 }, /* 'h' => 'd' */
{ 0x69, 0x63 }, /* 'i' => 'c' */
{ 0x6a, 0x68 }, /* 'j' => 'h' */
{ 0x6b, 0x74 }, /* 'k' => 't' */
{ 0x6c, 0x6e }, /* 'l' => 'n' */
{ 0x6e, 0x62 }, /* 'n' => 'b' */
{ 0x6f, 0x72 }, /* 'o' => 'r' */
{ 0x70, 0x6c }, /* 'p' => 'l' */
{ 0x72, 0x70 }, /* 'r' => 'p' */
{ 0x73, 0x6f }, /* 's' => 'o' */
{ 0x74, 0x79 }, /* 't' => 'y' */
{ 0x75, 0x67 }, /* 'u' => 'g' */
{ 0x76, 0x6b }, /* 'v' => 'k' */
{ 0x77, 0x2c }, /* 'w' => ',' */
{ 0x78, 0x71 }, /* 'x' => 'q' */
{ 0x79, 0x66 }, /* 'y' => 'f' */
{ 0x7b, 0x2a }, /* '{' => '*' */
{ 0x7c, 0x3e }, /* '|' => '>' */
{ 0x7d, 0x5e }, /* '}' => '^' */
};

View File

@ -0,0 +1,15 @@
/** @file
*
* "pl" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "pl" keyboard mapping */
struct key_mapping pl_mapping[] __keymap = {
};

View File

@ -0,0 +1,29 @@
/** @file
*
* "pt" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "pt" keyboard mapping */
struct key_mapping pt_mapping[] __keymap = {
{ 0x1c, 0x1d }, /* 0x1c => 0x1d */
{ 0x1d, 0x1b }, /* 0x1d => 0x1b */
{ 0x22, 0x5e }, /* '"' => '^' */
{ 0x27, 0x7e }, /* '\'' => '~' */
{ 0x2f, 0x3b }, /* '/' => ';' */
{ 0x3f, 0x3a }, /* '?' => ':' */
{ 0x5b, 0x27 }, /* '[' => '\'' */
{ 0x5c, 0x5d }, /* '\\' => ']' */
{ 0x5d, 0x5b }, /* ']' => '[' */
{ 0x60, 0x27 }, /* '`' => '\'' */
{ 0x7b, 0x60 }, /* '{' => '`' */
{ 0x7c, 0x7d }, /* '|' => '}' */
{ 0x7d, 0x7b }, /* '}' => '{' */
{ 0x7e, 0x22 }, /* '~' => '"' */
};

View File

@ -0,0 +1,15 @@
/** @file
*
* "ro" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "ro" keyboard mapping */
struct key_mapping ro_mapping[] __keymap = {
};

View File

@ -0,0 +1,15 @@
/** @file
*
* "ru" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "ru" keyboard mapping */
struct key_mapping ru_mapping[] __keymap = {
};

View File

@ -0,0 +1,40 @@
/** @file
*
* "sg" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "sg" keyboard mapping */
struct key_mapping sg_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x21, 0x2b }, /* '!' => '+' */
{ 0x23, 0x2a }, /* '#' => '*' */
{ 0x24, 0x34 }, /* '$' => '4' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x27 }, /* '-' => '\'' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3d, 0x5e }, /* '=' => '^' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x59, 0x5a }, /* 'Y' => 'Z' */
{ 0x5a, 0x59 }, /* 'Z' => 'Y' */
{ 0x5c, 0x24 }, /* '\\' => '$' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
{ 0x7c, 0x24 }, /* '|' => '$' */
{ 0x7d, 0x21 }, /* '}' => '!' */
};

View File

@ -0,0 +1,34 @@
/** @file
*
* "sr" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "sr" keyboard mapping */
struct key_mapping sr_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x2a }, /* '+' => '*' */
{ 0x2d, 0x27 }, /* '-' => '\'' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3d, 0x2b }, /* '=' => '+' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x59, 0x5a }, /* 'Y' => 'Z' */
{ 0x5a, 0x59 }, /* 'Z' => 'Y' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
};

View File

@ -0,0 +1,16 @@
/** @file
*
* "th" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "th" keyboard mapping */
struct key_mapping th_mapping[] __keymap = {
{ 0x7f, 0x08 }, /* 0x7f => Ctrl-H */
};

View File

@ -0,0 +1,16 @@
/** @file
*
* "ua" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "ua" keyboard mapping */
struct key_mapping ua_mapping[] __keymap = {
{ 0x7f, 0x08 }, /* 0x7f => Ctrl-H */
};

View File

@ -0,0 +1,20 @@
/** @file
*
* "uk" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "uk" keyboard mapping */
struct key_mapping uk_mapping[] __keymap = {
{ 0x22, 0x40 }, /* '"' => '@' */
{ 0x3c, 0x5c }, /* '<' => '\\' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x23 }, /* '\\' => '#' */
{ 0x7c, 0x7e }, /* '|' => '~' */
};

View File

@ -0,0 +1,15 @@
/** @file
*
* "us" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "us" keyboard mapping */
struct key_mapping us_mapping[] __keymap = {
};

View File

@ -0,0 +1,54 @@
/** @file
*
* "wo" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "wo" keyboard mapping */
struct key_mapping wo_mapping[] __keymap = {
{ 0x01, 0x11 }, /* Ctrl-A => Ctrl-Q */
{ 0x11, 0x01 }, /* Ctrl-Q => Ctrl-A */
{ 0x17, 0x1a }, /* Ctrl-W => Ctrl-Z */
{ 0x1a, 0x17 }, /* Ctrl-Z => Ctrl-W */
{ 0x21, 0x31 }, /* '!' => '1' */
{ 0x23, 0x33 }, /* '#' => '3' */
{ 0x24, 0x34 }, /* '$' => '4' */
{ 0x25, 0x35 }, /* '%' => '5' */
{ 0x26, 0x37 }, /* '&' => '7' */
{ 0x28, 0x39 }, /* '(' => '9' */
{ 0x29, 0x30 }, /* ')' => '0' */
{ 0x2a, 0x38 }, /* '*' => '8' */
{ 0x2c, 0x3b }, /* ',' => ';' */
{ 0x2d, 0x29 }, /* '-' => ')' */
{ 0x2e, 0x3a }, /* '.' => ':' */
{ 0x2f, 0x21 }, /* '/' => '!' */
{ 0x31, 0x26 }, /* '1' => '&' */
{ 0x33, 0x22 }, /* '3' => '"' */
{ 0x34, 0x27 }, /* '4' => '\'' */
{ 0x35, 0x28 }, /* '5' => '(' */
{ 0x36, 0x2d }, /* '6' => '-' */
{ 0x38, 0x5f }, /* '8' => '_' */
{ 0x3a, 0x4d }, /* ':' => 'M' */
{ 0x3b, 0x6d }, /* ';' => 'm' */
{ 0x3e, 0x2f }, /* '>' => '/' */
{ 0x40, 0x32 }, /* '@' => '2' */
{ 0x41, 0x51 }, /* 'A' => 'Q' */
{ 0x4d, 0x3f }, /* 'M' => '?' */
{ 0x51, 0x41 }, /* 'Q' => 'A' */
{ 0x57, 0x5a }, /* 'W' => 'Z' */
{ 0x5a, 0x57 }, /* 'Z' => 'W' */
{ 0x5d, 0x24 }, /* ']' => '$' */
{ 0x5e, 0x36 }, /* '^' => '6' */
{ 0x61, 0x71 }, /* 'a' => 'q' */
{ 0x6d, 0x2c }, /* 'm' => ',' */
{ 0x71, 0x61 }, /* 'q' => 'a' */
{ 0x77, 0x7a }, /* 'w' => 'z' */
{ 0x7a, 0x77 }, /* 'z' => 'w' */
{ 0x7e, 0x25 }, /* '~' => '%' */
};

224
src/util/genkeymap.pl Executable file
View File

@ -0,0 +1,224 @@
#!/usr/bin/perl -w
#
# Copyright (C) 2011 Michael Brown <mbrown@fensystems.co.uk>.
#
# This program 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 2 of the
# License, or any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
=head1 NAME
genkeymap.pl
=head1 SYNOPSIS
genkeymap.pl [options] <keymap name>
Options:
-f,--from=<name> Set BIOS keymap name (default "us")
-h,--help Display brief help message
-v,--verbose Increase verbosity
-q,--quiet Decrease verbosity
=cut
# With reference to:
#
# http://gunnarwrobel.de/wiki/Linux-and-the-keyboard.html
use Getopt::Long;
use Pod::Usage;
use strict;
use warnings;
use constant BIOS_KEYMAP => "us";
use constant BKEYMAP_MAGIC => "bkeymap";
use constant MAX_NR_KEYMAPS => 256;
use constant NR_KEYS => 128;
use constant KG_SHIFT => 0;
use constant KG_ALTGR => 1;
use constant KG_CTRL => 2;
use constant KG_ALT => 3;
use constant KG_SHIFTL => 4;
use constant KG_KANASHIFT => 4;
use constant KG_SHIFTR => 5;
use constant KG_CTRLL => 6;
use constant KG_CTRLR => 7;
use constant KG_CAPSSHIFT => 8;
use constant KT_LATIN => 0;
use constant KT_FN => 1;
use constant KT_SPEC => 2;
use constant KT_PAD => 3;
use constant KT_DEAD => 4;
use constant KT_CONS => 5;
use constant KT_CUR => 6;
use constant KT_SHIFT => 7;
use constant KT_META => 8;
use constant KT_ASCII => 9;
use constant KT_LOCK => 10;
use constant KT_LETTER => 11;
use constant KT_SLOCK => 12;
use constant KT_SPKUP => 14;
my $verbosity = 1;
my $from_name = BIOS_KEYMAP;
# Read named keymaps using "loadkeys -b"
#
sub read_keymaps {
my $name = shift;
my $keymaps = [];
# Generate binary keymap
open my $pipe, "-|", "loadkeys", "-b", $name
or die "Could not load keymap \"".$name."\": $!\n";
# Check magic
read $pipe, my $magic, length BKEYMAP_MAGIC
or die "Could not read from \"".$name."\": $!\n";
die "Bad magic value from \"".$name."\"\n"
unless $magic eq BKEYMAP_MAGIC;
# Read list of included keymaps
read $pipe, my $included, MAX_NR_KEYMAPS
or die "Could not read from \"".$name."\": $!\n";
my @included = unpack ( "C*", $included );
die "Missing or truncated keymap list from \"".$name."\"\n"
unless @included == MAX_NR_KEYMAPS;
# Read each keymap in turn
for ( my $keymap = 0 ; $keymap < MAX_NR_KEYMAPS ; $keymap++ ) {
if ( $included[$keymap] ) {
read $pipe, my $keysyms, ( NR_KEYS * 2 )
or die "Could not read from \"".$name."\": $!\n";
my @keysyms = unpack ( "S*", $keysyms );
die "Missing or truncated keymap ".$keymap." from \"".$name."\"\n"
unless @keysyms == NR_KEYS;
push @$keymaps, \@keysyms;
} else {
push @$keymaps, undef;
}
}
close $pipe;
return $keymaps;
}
# Translate keysym value to ASCII
#
sub keysym_to_ascii {
my $keysym = shift;
# Non-existent keysyms have no ASCII equivalent
return unless $keysym;
# Sanity check
die "Unexpected keysym ".sprintf ( "0x%04x\n", $keysym )."\n"
if $keysym & 0xf000;
# Extract type and value
my $type = ( $keysym >> 8 );
my $value = ( $keysym & 0xff );
# Non-simple types have no ASCII equivalent
return unless ( ( $type == KT_LATIN ) || ( $type == KT_ASCII ) ||
( $type == KT_LETTER ) );
# High-bit-set characters cannot be generated on a US keyboard
return if $value & 0x80;
return $value;
}
# Translate ASCII to descriptive name
#
sub ascii_to_name {
my $ascii = shift;
if ( $ascii == 0x5c ) {
return "'\\\\'";
} elsif ( $ascii == 0x27 ) {
return "'\\\''";
} elsif ( ( $ascii >= 0x20 ) && ( $ascii <= 0x7e ) ) {
return sprintf ( "'%c'", $ascii );
} elsif ( $ascii <= 0x1a ) {
return sprintf ( "Ctrl-%c", ( 0x40 + $ascii ) );
} else {
return sprintf ( "0x%02x", $ascii );
}
}
# Produce translation table between two keymaps
#
sub translate_keymaps {
my $from = shift;
my $to = shift;
my $map = {};
foreach my $keymap ( 0, 1 << KG_SHIFT, 1 << KG_CTRL ) {
for ( my $keycode = 0 ; $keycode < NR_KEYS ; $keycode++ ) {
my $from_ascii = keysym_to_ascii ( $from->[$keymap]->[$keycode] )
or next;
my $to_ascii = keysym_to_ascii ( $to->[$keymap]->[$keycode] )
or next;
if ( ( $from_ascii != $to_ascii ) && $verbosity > 1 ) {
printf STDERR "In keymap %d: %s => %s%s\n", $keymap,
ascii_to_name ( $from_ascii ), ascii_to_name ( $to_ascii ),
( $map->{$from_ascii} ? " (ignored)" : "" );
}
$map->{$from_ascii} ||= $to_ascii;
}
}
return $map;
}
# Parse command-line options
Getopt::Long::Configure ( 'bundling', 'auto_abbrev' );
GetOptions (
'verbose|v+' => sub { $verbosity++; },
'quiet|q+' => sub { $verbosity--; },
'from|f=s' => sub { shift; $from_name = shift; },
'help|h' => sub { pod2usage ( 1 ); },
) or die "Could not parse command-line options\n";
pod2usage ( 1 ) unless @ARGV == 1;
my $to_name = shift;
# Read and translate keymaps
my $from = read_keymaps ( $from_name );
my $to = read_keymaps ( $to_name );
my $map = translate_keymaps ( $from, $to );
# Generate output
( my $to_name_c = $to_name ) =~ s/\W/_/g;
printf "/** \@file\n";
printf " *\n";
printf " * \"".$to_name."\" keyboard mapping\n";
printf " *\n";
printf " * This file is automatically generated; do not edit\n";
printf " *\n";
printf " */\n";
printf "\n";
printf "FILE_LICENCE ( PUBLIC_DOMAIN );\n";
printf "\n";
printf "#include <ipxe/keymap.h>\n";
printf "\n";
printf "/** \"".$to_name."\" keyboard mapping */\n";
printf "struct key_mapping ".$to_name_c."_mapping[] __keymap = {\n";
foreach my $from_sym ( sort { $a <=> $b } keys %$map ) {
my $to_sym = $map->{$from_sym};
next if $from_sym == $to_sym;
printf "\t{ 0x%02x, 0x%02x },\t/* %s => %s */\n", $from_sym, $to_sym,
ascii_to_name ( $from_sym ), ascii_to_name ( $to_sym );
}
printf "};\n";