Compare commits

..

3 Commits

Author SHA1 Message Date
7d27190e99 [efi] Attempt to fetch autoexec script via TFTP
Attempt to fetch the autoexec.ipxe script via TFTP using the PXE base
code protocol installed on the loaded image's device handle, if
present.

This provides a generic alternative to the use of an embedded script
for chainloaded binaries, which is particularly useful in a UEFI
Secure Boot environment since it allows the script to be modified
without the need to sign a new binary.

As a side effect, this also provides a third method for breaking the
PXE chainloading loop (as an alternative to requiring an embedded
script or custom DHCP server configuration).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-01-17 16:17:17 +00:00
461e02d371 [efi] Allow for autoexec scripts that are not located in a filesystem
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-01-17 16:14:53 +00:00
8e8c2188da [pxe] Allow cached DHCP settings to be fetched before registration
Register cached DHCP settings in a placeholder standalone settings
block, to allow settings to be fetched during early initialisation
code (before the startup code that registers them into the root
settings hierarchy).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2022-01-17 16:06:30 +00:00
59 changed files with 677 additions and 1958 deletions

View File

@ -24,7 +24,6 @@ CP := cp
ECHO := echo
PRINTF := printf
PERL := perl
PYTHON := python
TRUE := true
CC := $(CROSS_COMPILE)gcc
CPP := $(CC) -E
@ -51,7 +50,7 @@ ELF2EFI64 := ./util/elf2efi64
EFIROM := ./util/efirom
EFIFATBIN := ./util/efifatbin
EINFO := ./util/einfo
GENKEYMAP := ./util/genkeymap.py
GENKEYMAP := ./util/genkeymap.pl
DOXYGEN := doxygen
LCAB := lcab
QEMUIMG := qemu-img

View File

@ -1563,7 +1563,7 @@ endif # defined(BIN)
#
hci/keymap/keymap_%.c :
$(Q)$(PYTHON) $(GENKEYMAP) $* > $@
$(Q)$(PERL) $(GENKEYMAP) $* > $@
###############################################################################
#

View File

@ -6,11 +6,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define BDA_SEG 0x0040
#define BDA_EBDA 0x000e
#define BDA_EQUIPMENT_WORD 0x0010
#define BDA_KB0 0x0017
#define BDA_KB0_RSHIFT 0x01
#define BDA_KB0_LSHIFT 0x02
#define BDA_KB0_CTRL 0x04
#define BDA_KB0_CAPSLOCK 0x040
#define BDA_FBMS 0x0013
#define BDA_TICKS 0x006c
#define BDA_MIDNIGHT 0x0070
@ -18,7 +13,5 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define BDA_REBOOT_WARM 0x1234
#define BDA_NUM_DRIVES 0x0075
#define BDA_CHAR_HEIGHT 0x0085
#define BDA_KB2 0x0096
#define BDA_KB2_RALT 0x08
#endif /* BIOS_H */

View File

@ -60,21 +60,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define ATTR_DEFAULT ATTR_FCOL_WHITE
/** Maximum keycode subject to remapping
*
* This allows us to avoid remapping the numeric keypad, which is
* necessary for keyboard layouts such as "fr" that swap the shifted
* and unshifted digit keys.
*/
#define SCANCODE_RSHIFT 0x36
/** Scancode for the "non-US \ and |" key
*
* This is the key that appears between Left Shift and Z on non-US
* keyboards.
*/
#define SCANCODE_NON_US 0x56
/* Set default console usage if applicable */
#if ! ( defined ( CONSOLE_PCBIOS ) && CONSOLE_EXPLICIT ( CONSOLE_PCBIOS ) )
#undef CONSOLE_PCBIOS
@ -354,6 +339,22 @@ static const char * bios_ansi_seq ( unsigned int scancode ) {
return NULL;
}
/**
* Map a key
*
* @v character Character read from console
* @ret character Mapped character
*/
static int bios_keymap ( unsigned int character ) {
struct key_mapping *mapping;
for_each_table_entry ( mapping, KEYMAP ) {
if ( mapping->from == character )
return mapping->to;
}
return character;
}
/**
* Get character from BIOS console
*
@ -361,9 +362,6 @@ static const char * bios_ansi_seq ( unsigned int scancode ) {
*/
static int bios_getchar ( void ) {
uint16_t keypress;
uint8_t kb0;
uint8_t kb2;
unsigned int scancode;
unsigned int character;
const char *ansi_seq;
@ -385,42 +383,11 @@ static int bios_getchar ( void ) {
: "=a" ( keypress )
: "a" ( 0x1000 ), "m" ( bios_inject_lock ) );
bios_inject_lock--;
scancode = ( keypress >> 8 );
character = ( keypress & 0xff );
get_real ( kb0, BDA_SEG, BDA_KB0 );
get_real ( kb2, BDA_SEG, BDA_KB2 );
/* If it's a normal character, map (if applicable) and return it */
if ( character && ( character < 0x80 ) ) {
/* Handle special scancodes */
if ( scancode == SCANCODE_NON_US ) {
/* Treat as "\|" with high bit set */
character |= KEYMAP_PSEUDO;
} else if ( scancode >= SCANCODE_RSHIFT ) {
/* Non-remappable scancode (e.g. numeric keypad) */
return character;
}
/* Apply modifiers */
if ( kb0 & BDA_KB0_CTRL )
character |= KEYMAP_CTRL;
if ( kb0 & BDA_KB0_CAPSLOCK )
character |= KEYMAP_CAPSLOCK_REDO;
if ( kb2 & BDA_KB2_RALT )
character |= KEYMAP_ALTGR;
/* Treat LShift+RShift as AltGr since many BIOSes will
* not return ASCII characters when AltGr is pressed.
*/
if ( ( kb0 & ( BDA_KB0_LSHIFT | BDA_KB0_RSHIFT ) ) ==
( BDA_KB0_LSHIFT | BDA_KB0_RSHIFT ) ) {
character |= KEYMAP_ALTGR;
}
/* Map and return */
return key_remap ( character );
}
/* If it's a normal character, just map and return it */
if ( character && ( character < 0x80 ) )
return bios_keymap ( character );
/* Otherwise, check for a special key that we know about */
if ( ( ansi_seq = bios_ansi_seq ( keypress >> 8 ) ) ) {

View File

@ -380,11 +380,6 @@ process_bytes:
pushl %eax
pushl %ebp
/* Construct ljmp code on stack (since .prefix may not be writable) */
.equ LJMP_LEN, 0x06
pushw %cs /* "nop ; ljmp %cs, $2f" */
pushw $2f
pushw $0xea90
/* Construct GDT on stack (since .prefix may not be writable) */
.equ GDT_LEN, 0x20
.equ PM_DS, 0x18 /* Flat data segment */
@ -415,9 +410,8 @@ process_bytes:
pushw %es
pushw %ds
pushw %ss
pushw %ss /* Far pointer to ljmp code on stack */
leaw (GDT_LEN + 1)(%bp), %ax
pushw %ax
pushw %cs
pushw $2f
cli
data32 lgdt (%bp)
movl %cr0, %eax
@ -444,7 +438,7 @@ process_bytes:
popfw
movl %eax, %cr0
lret
2: /* lret will ljmp to here (via constructed ljmp on stack) */
2: /* lret will ljmp to here */
popw %ss
popw %ds
popw %es
@ -467,7 +461,7 @@ process_bytes:
/* Restore GDT */
data32 lgdt -8(%bp)
leaw (GDT_LEN + LJMP_LEN)(%bp), %sp
leaw GDT_LEN(%bp), %sp
/* Restore registers and return */
popl %ebp

View File

@ -58,8 +58,4 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define NAP_EFIARM
#endif
#if defined ( __aarch64__ )
#define IMAGE_GZIP /* GZIP image support */
#endif
#endif /* CONFIG_DEFAULTS_EFI_H */

View File

@ -67,8 +67,22 @@ static struct cached_dhcp_packet *cached_packets[] = {
&cached_pxebs,
};
/** Cached DHCP settings placeholder block */
struct generic_settings cachedhcp_generic = {
.settings = {
.refcnt = NULL,
.name = "cachedhcp",
.siblings =
LIST_HEAD_INIT ( cachedhcp_generic.settings.siblings ),
.children =
LIST_HEAD_INIT ( cachedhcp_generic.settings.children ),
.op = &generic_settings_operations,
},
.list = LIST_HEAD_INIT ( cachedhcp_generic.list ),
};
/** Colour for debug messages */
#define colour &cached_dhcpack
#define colour &cachedhcp_settings
/**
* Free cached DHCP packet
@ -114,6 +128,9 @@ static int cachedhcp_apply ( struct cached_dhcp_packet *cache,
/* Select appropriate parent settings block */
settings = ( netdev ? netdev_settings ( netdev ) : NULL );
/* Unregister from placeholder settings block */
unregister_settings ( &cache->dhcppkt->settings );
/* Register settings */
if ( ( rc = register_settings ( &cache->dhcppkt->settings, settings,
cache->name ) ) != 0 ) {
@ -143,6 +160,7 @@ int cachedhcp_record ( struct cached_dhcp_packet *cache, userptr_t data,
struct dhcphdr *dhcphdr;
unsigned int i;
size_t len;
int rc;
/* Free any existing cached packet */
cachedhcp_free ( cache );
@ -188,6 +206,14 @@ int cachedhcp_record ( struct cached_dhcp_packet *cache, userptr_t data,
}
}
/* Register in placeholder settings block */
if ( ( rc = register_settings ( &dhcppkt->settings, &cachedhcp_settings,
cache->name ) ) != 0 ) {
DBGC ( colour, "CACHEDHCP %s could not register placeholder "
"settings: %s\n", cache->name, strerror ( rc ) );
return rc;
}
/* Store as cached packet */
DBGC ( colour, "CACHEDHCP %s at %#08lx+%#zx/%#zx\n", cache->name,
user_to_phys ( data, 0 ), len, max_len );

View File

@ -1,131 +0,0 @@
/*
* Copyright (C) 2022 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., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* You can also choose to distribute this program under the terms of
* the Unmodified Binary Distribution Licence (as given in the file
* COPYING.UBDL), provided that you have satisfied its requirements.
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
* Dynamic keyboard mappings
*
*/
#include <stdlib.h>
#include <errno.h>
#include <ipxe/settings.h>
#include <ipxe/keymap.h>
/**
* Require a keyboard map
*
* @v name Keyboard map name
*/
#define REQUIRE_KEYMAP( name ) REQUIRE_OBJECT ( keymap_ ## name )
/** Keyboard map setting */
const struct setting keymap_setting __setting ( SETTING_MISC, keymap ) = {
.name = "keymap",
.description = "Keyboard map",
.type = &setting_type_string,
};
/**
* Apply keyboard map settings
*
* @ret rc Return status code
*/
static int keymap_apply ( void ) {
struct keymap *keymap;
char *name;
int rc;
/* Fetch keyboard map name */
fetch_string_setting_copy ( NULL, &keymap_setting, &name );
/* Identify keyboard map */
if ( name ) {
/* Identify named keyboard map */
keymap = keymap_find ( name );
if ( ! keymap ) {
DBGC ( &keymap_setting, "KEYMAP could not identify "
"\"%s\"\n", name );
rc = -ENOENT;
goto err_unknown;
}
} else {
/* Use default keyboard map */
keymap = NULL;
}
/* Set keyboard map */
keymap_set ( keymap );
/* Success */
rc = 0;
err_unknown:
free ( name );
return rc;
}
/** Keyboard map setting applicator */
struct settings_applicator keymap_applicator __settings_applicator = {
.apply = keymap_apply,
};
/* Provide virtual "dynamic" keyboard map for linker */
PROVIDE_SYMBOL ( obj_keymap_dynamic );
/* Drag in keyboard maps via keymap_setting */
REQUIRING_SYMBOL ( keymap_setting );
/* Require all known keyboard maps */
REQUIRE_KEYMAP ( al );
REQUIRE_KEYMAP ( by );
REQUIRE_KEYMAP ( cf );
REQUIRE_KEYMAP ( cz );
REQUIRE_KEYMAP ( de );
REQUIRE_KEYMAP ( dk );
REQUIRE_KEYMAP ( es );
REQUIRE_KEYMAP ( et );
REQUIRE_KEYMAP ( fi );
REQUIRE_KEYMAP ( fr );
REQUIRE_KEYMAP ( gr );
REQUIRE_KEYMAP ( hu );
REQUIRE_KEYMAP ( il );
REQUIRE_KEYMAP ( it );
REQUIRE_KEYMAP ( lt );
REQUIRE_KEYMAP ( mk );
REQUIRE_KEYMAP ( mt );
REQUIRE_KEYMAP ( nl );
REQUIRE_KEYMAP ( no );
REQUIRE_KEYMAP ( no_latin1 );
REQUIRE_KEYMAP ( pl );
REQUIRE_KEYMAP ( pt );
REQUIRE_KEYMAP ( ro );
REQUIRE_KEYMAP ( ru );
REQUIRE_KEYMAP ( se );
REQUIRE_KEYMAP ( sg );
REQUIRE_KEYMAP ( sr_latin );
REQUIRE_KEYMAP ( ua );
REQUIRE_KEYMAP ( uk );
REQUIRE_KEYMAP ( us );

View File

@ -338,12 +338,9 @@ int image_exec ( struct image *image ) {
/* Sanity check */
assert ( image->flags & IMAGE_REGISTERED );
/* Switch current working directory to be that of the image
* itself, if applicable
*/
/* Switch current working directory to be that of the image itself */
old_cwuri = uri_get ( cwuri );
if ( image->uri )
churi ( image->uri );
churi ( image->uri );
/* Preserve record of any currently-running image */
saved_current_image = current_image;

View File

@ -1,131 +0,0 @@
/*
* Copyright (C) 2022 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., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* You can also choose to distribute this program under the terms of
* the Unmodified Binary Distribution Licence (as given in the file
* COPYING.UBDL), provided that you have satisfied its requirements.
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <ctype.h>
#include <ipxe/keys.h>
#include <ipxe/keymap.h>
/** @file
*
* Keyboard mappings
*
*/
/** ASCII character mask */
#define ASCII_MASK 0x7f
/** Control character mask */
#define CTRL_MASK 0x1f
/** Upper case character mask */
#define UPPER_MASK 0x5f
/** Case toggle bit */
#define CASE_TOGGLE ( ASCII_MASK & ~UPPER_MASK )
/** Default keyboard mapping */
static TABLE_START ( keymap_start, KEYMAP );
/** Current keyboard mapping */
static struct keymap *keymap_current = keymap_start;
/**
* Remap a key
*
* @v character Character read from console
* @ret mapped Mapped character
*/
unsigned int key_remap ( unsigned int character ) {
struct keymap *keymap = keymap_current;
unsigned int mapped = ( character & KEYMAP_MASK );
struct keymap_key *key;
/* Invert case before remapping if applicable */
if ( ( character & KEYMAP_CAPSLOCK_UNDO ) && isalpha ( mapped ) )
mapped ^= CASE_TOGGLE;
/* Select remapping table */
key = ( ( character & KEYMAP_ALTGR ) ? keymap->altgr : keymap->basic );
/* Remap via table */
for ( ; key->from ; key++ ) {
if ( mapped == key->from ) {
mapped = key->to;
break;
}
}
/* Handle Ctrl-<key> and CapsLock */
if ( isalpha ( mapped ) ) {
if ( character & KEYMAP_CTRL ) {
mapped &= CTRL_MASK;
} else if ( character & KEYMAP_CAPSLOCK ) {
mapped ^= CASE_TOGGLE;
}
}
/* Clear flags */
mapped &= ASCII_MASK;
DBGC2 ( &keymap_current, "KEYMAP mapped %04x => %02x\n",
character, mapped );
return mapped;
}
/**
* Find keyboard map by name
*
* @v name Keyboard map name
* @ret keymap Keyboard map, or NULL if not found
*/
struct keymap * keymap_find ( const char *name ) {
struct keymap *keymap;
/* Find matching keyboard map */
for_each_table_entry ( keymap, KEYMAP ) {
if ( strcmp ( keymap->name, name ) == 0 )
return keymap;
}
return NULL;
}
/**
* Set keyboard map
*
* @v keymap Keyboard map, or NULL to use default
*/
void keymap_set ( struct keymap *keymap ) {
/* Use default keymap if none specified */
if ( ! keymap )
keymap = keymap_start;
/* Set new keyboard map */
if ( keymap != keymap_current )
DBGC ( &keymap_current, "KEYMAP using \"%s\"\n", keymap->name );
keymap_current = keymap;
}

View File

@ -411,8 +411,9 @@ struct settings * find_settings ( const char *name ) {
/**
* Apply all settings
*
* @ret rc Return status code
*/
static void apply_settings ( void ) {
static int apply_settings ( void ) {
struct settings_applicator *applicator;
int rc;
@ -421,9 +422,11 @@ static void apply_settings ( void ) {
if ( ( rc = applicator->apply() ) != 0 ) {
DBG ( "Could not apply settings using applicator "
"%p: %s\n", applicator, strerror ( rc ) );
/* Continue to apply remaining settings */
return rc;
}
}
return 0;
}
/**
@ -523,6 +526,10 @@ void unregister_settings ( struct settings *settings ) {
DBGC ( settings, "Settings %p (\"%s\") unregistered\n",
settings, settings_name ( settings ) );
/* Do nothing more if settings are already unregistered */
if ( ! settings->parent )
return;
/* Remove from list of settings */
ref_put ( settings->parent->refcnt );
settings->parent = NULL;
@ -641,7 +648,8 @@ int store_setting ( struct settings *settings, const struct setting *setting,
*/
for ( ; settings ; settings = settings->parent ) {
if ( settings == &settings_root ) {
apply_settings();
if ( ( rc = apply_settings() ) != 0 )
return rc;
break;
}
}

View File

@ -121,11 +121,6 @@ static void pci_read_bases ( struct pci_device *pci ) {
unsigned long bar;
int reg;
/* Clear any existing base addresses */
pci->ioaddr = 0;
pci->membase = 0;
/* Get first memory and I/O BAR addresses */
for ( reg = PCI_BASE_ADDRESS_0; reg <= PCI_BASE_ADDRESS_5; reg += 4 ) {
bar = pci_bar ( pci, reg );
if ( bar & PCI_BASE_ADDRESS_SPACE_IO ) {

View File

@ -25,12 +25,10 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/console.h>
#include <ipxe/keys.h>
#include <ipxe/keymap.h>
#include <ipxe/usb.h>
#include "usbkbd.h"
@ -71,7 +69,10 @@ static unsigned int usbkbd_map ( unsigned int keycode, unsigned int modifiers,
} else if ( keycode <= USBKBD_KEY_Z ) {
/* Alphabetic keys */
key = ( keycode - USBKBD_KEY_A + 'a' );
if ( modifiers & USBKBD_SHIFT ) {
if ( modifiers & USBKBD_CTRL ) {
key -= ( 'a' - CTRL_A );
} else if ( ( modifiers & USBKBD_SHIFT ) ||
( leds & USBKBD_LED_CAPS_LOCK ) ) {
key -= ( 'a' - 'A' );
}
} else if ( keycode <= USBKBD_KEY_0 ) {
@ -117,30 +118,10 @@ static unsigned int usbkbd_map ( unsigned int keycode, unsigned int modifiers,
};
key = keypad[ keycode - USBKBD_KEY_PAD_1 ];
};
} else if ( keycode == USBKBD_KEY_NON_US ) {
/* Non-US \ and | */
key = ( ( modifiers & USBKBD_SHIFT ) ?
( KEYMAP_PSEUDO | '|' ) : ( KEYMAP_PSEUDO | '\\' ) );
} else {
key = 0;
}
/* Remap key if applicable */
if ( ( keycode < USBKBD_KEY_CAPS_LOCK ) ||
( keycode == USBKBD_KEY_NON_US ) ) {
/* Apply modifiers */
if ( modifiers & USBKBD_CTRL )
key |= KEYMAP_CTRL;
if ( modifiers & USBKBD_ALT_RIGHT )
key |= KEYMAP_ALTGR;
if ( leds & USBKBD_LED_CAPS_LOCK )
key |= KEYMAP_CAPSLOCK;
/* Remap key */
key = key_remap ( key );
}
return key;
}

View File

@ -75,7 +75,6 @@ enum usb_keycode {
USBKBD_KEY_PAD_ENTER = 0x58,
USBKBD_KEY_PAD_1 = 0x59,
USBKBD_KEY_PAD_DOT = 0x63,
USBKBD_KEY_NON_US = 0x64,
};
/** USB keyboard LEDs */

View File

@ -10,11 +10,10 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "al" basic remapping */
static struct keymap_key al_basic[] = {
/** "al" keyboard mapping */
struct key_mapping al_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x1c, 0x1d }, /* 0x1c => 0x1d */
{ 0x22, 0x7b }, /* '"' => '{' */
{ 0x27, 0x5b }, /* '\'' => '[' */
{ 0x3c, 0x3b }, /* '<' => ';' */
@ -30,29 +29,4 @@ static struct keymap_key al_basic[] = {
{ 0x7c, 0x7d }, /* '|' => '}' */
{ 0x7d, 0x27 }, /* '}' => '\'' */
{ 0x7e, 0x7c }, /* '~' => '|' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "al" AltGr remapping */
static struct keymap_key al_altgr[] = {
{ 0x21, 0x7e }, /* '!' => '~' */
{ 0x26, 0x60 }, /* '&' => '`' */
{ 0x29, 0x7e }, /* ')' => '~' */
{ 0x30, 0x7e }, /* '0' => '~' */
{ 0x31, 0x7e }, /* '1' => '~' */
{ 0x34, 0x7e }, /* '4' => '~' */
{ 0x37, 0x60 }, /* '7' => '`' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x56, 0x60 }, /* 'V' => '`' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0, 0 }
};
/** "al" keyboard map */
struct keymap al_keymap __keymap = {
.name = "al",
.basic = al_basic,
.altgr = al_altgr,
};

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

@ -10,21 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "by" basic remapping */
static struct keymap_key by_basic[] = {
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "by" AltGr remapping */
static struct keymap_key by_altgr[] = {
{ 0, 0 }
};
/** "by" keyboard map */
struct keymap by_keymap __keymap = {
.name = "by",
.basic = by_basic,
.altgr = by_altgr,
/** "by" keyboard mapping */
struct key_mapping by_mapping[] __keymap = {
};

View File

@ -10,43 +10,15 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "cf" basic remapping */
static struct keymap_key cf_basic[] = {
{ 0x22, 0x60 }, /* '"' => '`' */
/** "cf" keyboard mapping */
struct key_mapping cf_mapping[] __keymap = {
{ 0x23, 0x2f }, /* '#' => '/' */
{ 0x27, 0x60 }, /* '\'' => '`' */
{ 0x3c, 0x27 }, /* '<' => '\'' */
{ 0x3e, 0x2e }, /* '>' => '.' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5b, 0x5e }, /* '[' => '^' */
{ 0x5c, 0x3c }, /* '\\' => '<' */
{ 0x5e, 0x3f }, /* '^' => '?' */
{ 0x60, 0x23 }, /* '`' => '#' */
{ 0x7b, 0x5e }, /* '{' => '^' */
{ 0x7c, 0x3e }, /* '|' => '>' */
{ 0x7e, 0x7c }, /* '~' => '|' */
{ 0, 0 }
};
/** "cf" AltGr remapping */
static struct keymap_key cf_altgr[] = {
{ 0x22, 0x7b }, /* '"' => '{' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3b, 0x7e }, /* ';' => '~' */
{ 0x5c, 0x7d }, /* '\\' => '}' */
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x7b, 0x5b }, /* '{' => '[' */
{ 0x7c, 0x7d }, /* '|' => '}' */
{ 0x7d, 0x5d }, /* '}' => ']' */
{ 0x7e, 0x5c }, /* '~' => '\\' */
{ 0, 0 }
};
/** "cf" keyboard map */
struct keymap cf_keymap __keymap = {
.name = "cf",
.basic = cf_basic,
.altgr = cf_altgr,
};

View File

@ -10,87 +10,18 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "cz" basic remapping */
static struct keymap_key cz_basic[] = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x1f, 0x1c }, /* 0x1f => 0x1c */
{ 0x21, 0x31 }, /* '!' => '1' */
{ 0x22, 0x21 }, /* '"' => '!' */
{ 0x23, 0x33 }, /* '#' => '3' */
{ 0x24, 0x34 }, /* '$' => '4' */
{ 0x25, 0x35 }, /* '%' => '5' */
{ 0x26, 0x37 }, /* '&' => '7' */
{ 0x28, 0x39 }, /* '(' => '9' */
{ 0x29, 0x30 }, /* ')' => '0' */
{ 0x2a, 0x38 }, /* '*' => '8' */
{ 0x2b, 0x5e }, /* '+' => '^' */
/** "cz" keyboard mapping */
struct key_mapping cz_mapping[] __keymap = {
{ 0x21, 0x2b }, /* '!' => '+' */
{ 0x2d, 0x3d }, /* '-' => '=' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x31, 0x2b }, /* '1' => '+' */
{ 0x3a, 0x22 }, /* ':' => '"' */
{ 0x3c, 0x3f }, /* '<' => '?' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x32 }, /* '@' => '2' */
{ 0x59, 0x5a }, /* 'Y' => 'Z' */
{ 0x5a, 0x59 }, /* 'Z' => 'Y' */
{ 0x3c, 0x2c }, /* '<' => ',' */
{ 0x3e, 0x2e }, /* '>' => '.' */
{ 0x3f, 0x2d }, /* '?' => '-' */
{ 0x5d, 0x29 }, /* ']' => ')' */
{ 0x5e, 0x36 }, /* '^' => '6' */
{ 0x5f, 0x25 }, /* '_' => '%' */
{ 0x5f, 0x3d }, /* '_' => '=' */
{ 0x60, 0x3b }, /* '`' => ';' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
{ 0x7b, 0x2f }, /* '{' => '/' */
{ 0x7c, 0x27 }, /* '|' => '\'' */
{ 0x7d, 0x28 }, /* '}' => '(' */
{ 0x7e, 0x60 }, /* '~' => '`' */
{ 0, 0 }
};
/** "cz" AltGr remapping */
static struct keymap_key cz_altgr[] = {
{ 0x21, 0x7e }, /* '!' => '~' */
{ 0x24, 0x7e }, /* '$' => '~' */
{ 0x28, 0x7b }, /* '(' => '{' */
{ 0x29, 0x7e }, /* ')' => '~' */
{ 0x2c, 0x3c }, /* ',' => '<' */
{ 0x2e, 0x3e }, /* '.' => '>' */
{ 0x2f, 0x2a }, /* '/' => '*' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x33, 0x23 }, /* '3' => '#' */
{ 0x34, 0x24 }, /* '4' => '$' */
{ 0x37, 0x26 }, /* '7' => '&' */
{ 0x38, 0x2a }, /* '8' => '*' */
{ 0x39, 0x7b }, /* '9' => '{' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3b, 0x24 }, /* ';' => '$' */
{ 0x41, 0x7e }, /* 'A' => '~' */
{ 0x42, 0x7b }, /* 'B' => '{' */
{ 0x43, 0x26 }, /* 'C' => '&' */
{ 0x46, 0x5b }, /* 'F' => '[' */
{ 0x47, 0x5d }, /* 'G' => ']' */
{ 0x4b, 0x26 }, /* 'K' => '&' */
{ 0x56, 0x40 }, /* 'V' => '@' */
{ 0x58, 0x3e }, /* 'X' => '>' */
{ 0x5a, 0x3c }, /* 'Z' => '<' */
{ 0x61, 0x7e }, /* 'a' => '~' */
{ 0x62, 0x7b }, /* 'b' => '{' */
{ 0x63, 0x26 }, /* 'c' => '&' */
{ 0x66, 0x5b }, /* 'f' => '[' */
{ 0x67, 0x5d }, /* 'g' => ']' */
{ 0x6e, 0x7d }, /* 'n' => '}' */
{ 0x76, 0x40 }, /* 'v' => '@' */
{ 0x78, 0x23 }, /* 'x' => '#' */
{ 0x7b, 0x5b }, /* '{' => '[' */
{ 0x7d, 0x5d }, /* '}' => ']' */
{ 0, 0 }
};
/** "cz" keyboard map */
struct keymap cz_keymap __keymap = {
.name = "cz",
.basic = cz_basic,
.altgr = cz_altgr,
{ 0x7d, 0x29 }, /* '}' => ')' */
{ 0x7e, 0x3b }, /* '~' => ';' */
};

View File

@ -10,25 +10,29 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "de" basic remapping */
static struct keymap_key de_basic[] = {
/** "de" keyboard mapping */
struct key_mapping de_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x1c, 0x23 }, /* 0x1c => '#' */
{ 0x1d, 0x1e }, /* 0x1d => 0x1e */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
{ 0x22, 0x7d }, /* '"' => '}' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x27, 0x5d }, /* '\'' => ']' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3a, 0x7b }, /* ':' => '{' */
{ 0x3b, 0x5b }, /* ';' => '[' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x3d, 0x27 }, /* '=' => '\'' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x59, 0x5a }, /* 'Y' => 'Z' */
{ 0x5a, 0x59 }, /* 'Z' => 'Y' */
{ 0x5b, 0x40 }, /* '[' => '@' */
{ 0x5c, 0x23 }, /* '\\' => '#' */
{ 0x5d, 0x2b }, /* ']' => '+' */
{ 0x5e, 0x26 }, /* '^' => '&' */
@ -36,39 +40,7 @@ static struct keymap_key de_basic[] = {
{ 0x60, 0x5e }, /* '`' => '^' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
{ 0x7b, 0x5c }, /* '{' => '\\' */
{ 0x7c, 0x27 }, /* '|' => '\'' */
{ 0x7d, 0x2a }, /* '}' => '*' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "de" AltGr remapping */
static struct keymap_key de_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3b, 0x7e }, /* ';' => '~' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0x7d, 0x7e }, /* '}' => '~' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};
/** "de" keyboard map */
struct keymap de_keymap __keymap = {
.name = "de",
.basic = de_basic,
.altgr = de_altgr,
};

View File

@ -10,10 +10,8 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "dk" basic remapping */
static struct keymap_key dk_basic[] = {
{ 0x1c, 0x27 }, /* 0x1c => '\'' */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
/** "dk" keyboard mapping */
struct key_mapping dk_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
@ -30,38 +28,4 @@ static struct keymap_key dk_basic[] = {
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0x7d, 0x5e }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "dk" AltGr remapping */
static struct keymap_key dk_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2b, 0x7c }, /* '+' => '|' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x34, 0x24 }, /* '4' => '$' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3d, 0x7c }, /* '=' => '|' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5c, 0x7e }, /* '\\' => '~' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0xfc, 0x5c }, /* Pseudo-'|' => '\\' */
{ 0, 0 }
};
/** "dk" keyboard map */
struct keymap dk_keymap __keymap = {
.name = "dk",
.basic = dk_basic,
.altgr = dk_altgr,
};

View File

@ -10,10 +10,8 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "es" basic remapping */
static struct keymap_key es_basic[] = {
{ 0x1c, 0x1d }, /* 0x1c => 0x1d */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
/** "es" keyboard mapping */
struct key_mapping es_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
@ -24,54 +22,8 @@ static struct keymap_key es_basic[] = {
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5b, 0x60 }, /* '[' => '`' */
{ 0x5d, 0x2b }, /* ']' => '+' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7b, 0x5e }, /* '{' => '^' */
{ 0x7d, 0x2a }, /* '}' => '*' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "es" AltGr remapping */
static struct keymap_key es_altgr[] = {
{ 0x21, 0x7c }, /* '!' => '|' */
{ 0x22, 0x7b }, /* '"' => '{' */
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2b, 0x7e }, /* '+' => '~' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x31, 0x7c }, /* '1' => '|' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x33, 0x23 }, /* '3' => '#' */
{ 0x34, 0x7e }, /* '4' => '~' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x3b, 0x7e }, /* ';' => '~' */
{ 0x3d, 0x7e }, /* '=' => '~' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5c, 0x7d }, /* '\\' => '}' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7b, 0x5b }, /* '{' => '[' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0x7e, 0x5c }, /* '~' => '\\' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};
/** "es" keyboard map */
struct keymap es_keymap __keymap = {
.name = "es",
.basic = es_basic,
.altgr = es_altgr,
};

View File

@ -10,13 +10,12 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "et" basic remapping */
static struct keymap_key et_basic[] = {
/** "et" keyboard mapping */
struct key_mapping et_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
@ -26,34 +25,6 @@ static struct keymap_key et_basic[] = {
{ 0x5c, 0x27 }, /* '\\' => '\'' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x5e }, /* '`' => '^' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "et" AltGr remapping */
static struct keymap_key et_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x34, 0x24 }, /* '4' => '$' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};
/** "et" keyboard map */
struct keymap et_keymap __keymap = {
.name = "et",
.basic = et_basic,
.altgr = et_altgr,
{ 0x7f, 0x1b }, /* 0x7f => 0x1b */
};

View File

@ -10,51 +10,29 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "fi" basic remapping */
static struct keymap_key fi_basic[] = {
/** "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 }, /* ';' => '|' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x3d, 0x27 }, /* '=' => '\'' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5b, 0x7d }, /* '[' => '}' */
{ 0x5c, 0x27 }, /* '\\' => '\'' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7b, 0x5d }, /* '{' => ']' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0x7d, 0x5e }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "fi" AltGr remapping */
static struct keymap_key fi_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x34, 0x24 }, /* '4' => '$' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x49, 0x7c }, /* 'I' => '|' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0x7d, 0x7e }, /* '}' => '~' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};
/** "fi" keyboard map */
struct keymap fi_keymap __keymap = {
.name = "fi",
.basic = fi_basic,
.altgr = fi_altgr,
};

View File

@ -10,22 +10,19 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "fr" basic remapping */
static struct keymap_key fr_basic[] = {
/** "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 */
{ 0x1c, 0x2a }, /* 0x1c => '*' */
{ 0x1d, 0x24 }, /* 0x1d => '$' */
{ 0x1e, 0x1c }, /* 0x1e => 0x1c */
{ 0x1f, 0x1d }, /* 0x1f => 0x1d */
{ 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' */
@ -33,16 +30,21 @@ static struct keymap_key fr_basic[] = {
{ 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' */
{ 0x3c, 0x2e }, /* '<' => '.' */
{ 0x3e, 0x2f }, /* '>' => '/' */
{ 0x3f, 0x5c }, /* '?' => '\\' */
{ 0x40, 0x32 }, /* '@' => '2' */
{ 0x41, 0x51 }, /* 'A' => 'Q' */
{ 0x4d, 0x3f }, /* 'M' => '?' */
@ -53,44 +55,14 @@ static struct keymap_key fr_basic[] = {
{ 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' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "fr" AltGr remapping */
static struct keymap_key fr_altgr[] = {
{ 0x25, 0x5b }, /* '%' => '[' */
{ 0x26, 0x60 }, /* '&' => '`' */
{ 0x29, 0x40 }, /* ')' => '@' */
{ 0x2a, 0x5c }, /* '*' => '\\' */
{ 0x2b, 0x7d }, /* '+' => '}' */
{ 0x2d, 0x5d }, /* '-' => ']' */
{ 0x30, 0x40 }, /* '0' => '@' */
{ 0x33, 0x23 }, /* '3' => '#' */
{ 0x34, 0x7b }, /* '4' => '{' */
{ 0x35, 0x5b }, /* '5' => '[' */
{ 0x36, 0x7c }, /* '6' => '|' */
{ 0x37, 0x60 }, /* '7' => '`' */
{ 0x38, 0x5c }, /* '8' => '\\' */
{ 0x3d, 0x7d }, /* '=' => '}' */
{ 0x41, 0x40 }, /* 'A' => '@' */
{ 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x5e, 0x7c }, /* '^' => '|' */
{ 0x5f, 0x5d }, /* '_' => ']' */
{ 0x61, 0x40 }, /* 'a' => '@' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};
/** "fr" keyboard map */
struct keymap fr_keymap __keymap = {
.name = "fr",
.basic = fr_basic,
.altgr = fr_altgr,
{ 0x7b, 0x3c }, /* '{' => '<' */
{ 0x7c, 0x23 }, /* '|' => '#' */
{ 0x7d, 0x3e }, /* '}' => '>' */
};

View File

@ -10,21 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "gr" basic remapping */
static struct keymap_key gr_basic[] = {
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "gr" AltGr remapping */
static struct keymap_key gr_altgr[] = {
{ 0, 0 }
};
/** "gr" keyboard map */
struct keymap gr_keymap __keymap = {
.name = "gr",
.basic = gr_basic,
.altgr = gr_altgr,
/** "gr" keyboard mapping */
struct key_mapping gr_mapping[] __keymap = {
};

View File

@ -10,11 +10,10 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "hu" basic remapping */
static struct keymap_key hu_basic[] = {
/** "hu" keyboard mapping */
struct key_mapping hu_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
{ 0x21, 0x27 }, /* '!' => '\'' */
{ 0x23, 0x2b }, /* '#' => '+' */
{ 0x24, 0x21 }, /* '$' => '!' */
@ -32,60 +31,4 @@ static struct keymap_key hu_basic[] = {
{ 0x60, 0x30 }, /* '`' => '0' */
{ 0x79, 0x7a }, /* 'y' => 'z' */
{ 0x7a, 0x79 }, /* 'z' => 'y' */
{ 0, 0 }
};
/** "hu" AltGr remapping */
static struct keymap_key hu_altgr[] = {
{ 0x21, 0x7e }, /* '!' => '~' */
{ 0x23, 0x5e }, /* '#' => '^' */
{ 0x24, 0x7e }, /* '$' => '~' */
{ 0x26, 0x60 }, /* '&' => '`' */
{ 0x29, 0x7e }, /* ')' => '~' */
{ 0x2c, 0x3b }, /* ',' => ';' */
{ 0x2e, 0x3e }, /* '.' => '>' */
{ 0x2f, 0x2a }, /* '/' => '*' */
{ 0x30, 0x7e }, /* '0' => '~' */
{ 0x31, 0x7e }, /* '1' => '~' */
{ 0x32, 0x5e }, /* '2' => '^' */
{ 0x33, 0x5e }, /* '3' => '^' */
{ 0x34, 0x7e }, /* '4' => '~' */
{ 0x37, 0x60 }, /* '7' => '`' */
{ 0x3a, 0x24 }, /* ':' => '$' */
{ 0x3b, 0x24 }, /* ';' => '$' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x40, 0x5e }, /* '@' => '^' */
{ 0x42, 0x7b }, /* 'B' => '{' */
{ 0x43, 0x26 }, /* 'C' => '&' */
{ 0x46, 0x5b }, /* 'F' => '[' */
{ 0x47, 0x5d }, /* 'G' => ']' */
{ 0x4b, 0x26 }, /* 'K' => '&' */
{ 0x4d, 0x3c }, /* 'M' => '<' */
{ 0x51, 0x5c }, /* 'Q' => '\\' */
{ 0x56, 0x40 }, /* 'V' => '@' */
{ 0x57, 0x7c }, /* 'W' => '|' */
{ 0x58, 0x3e }, /* 'X' => '>' */
{ 0x5a, 0x3c }, /* 'Z' => '<' */
{ 0x62, 0x7b }, /* 'b' => '{' */
{ 0x63, 0x26 }, /* 'c' => '&' */
{ 0x66, 0x5b }, /* 'f' => '[' */
{ 0x67, 0x5d }, /* 'g' => ']' */
{ 0x6d, 0x3c }, /* 'm' => '<' */
{ 0x6e, 0x7d }, /* 'n' => '}' */
{ 0x71, 0x5c }, /* 'q' => '\\' */
{ 0x76, 0x40 }, /* 'v' => '@' */
{ 0x77, 0x7c }, /* 'w' => '|' */
{ 0x78, 0x23 }, /* 'x' => '#' */
{ 0x7a, 0x3e }, /* 'z' => '>' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "hu" keyboard map */
struct keymap hu_keymap __keymap = {
.name = "hu",
.basic = hu_basic,
.altgr = hu_altgr,
};

View File

@ -10,39 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "il" basic remapping */
static struct keymap_key il_basic[] = {
{ 0x1d, 0x1b }, /* 0x1d => 0x1b */
{ 0x27, 0x2c }, /* '\'' => ',' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x28 }, /* ')' => '(' */
{ 0x2f, 0x2e }, /* '/' => '.' */
{ 0x3c, 0x3e }, /* '<' => '>' */
{ 0x3e, 0x3c }, /* '>' => '<' */
{ 0x5b, 0x5d }, /* '[' => ']' */
{ 0x5d, 0x5b }, /* ']' => '[' */
{ 0x60, 0x3b }, /* '`' => ';' */
{ 0x7b, 0x7d }, /* '{' => '}' */
{ 0x7d, 0x7b }, /* '}' => '{' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "il" AltGr remapping */
static struct keymap_key il_altgr[] = {
{ 0x22, 0x27 }, /* '"' => '\'' */
{ 0x3f, 0x2f }, /* '?' => '/' */
{ 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x71, 0x2f }, /* 'q' => '/' */
{ 0x77, 0x27 }, /* 'w' => '\'' */
{ 0x7c, 0x60 }, /* '|' => '`' */
{ 0, 0 }
};
/** "il" keyboard map */
struct keymap il_keymap __keymap = {
.name = "il",
.basic = il_basic,
.altgr = il_altgr,
/** "il" keyboard mapping */
struct key_mapping il_mapping[] __keymap = {
};

View File

@ -10,9 +10,8 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "it" basic remapping */
static struct keymap_key it_basic[] = {
{ 0x1e, 0x36 }, /* 0x1e => '6' */
/** "it" keyboard mapping */
struct key_mapping it_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
@ -30,40 +29,4 @@ static struct keymap_key it_basic[] = {
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x7d, 0x2a }, /* '}' => '*' */
{ 0x7e, 0x7c }, /* '~' => '|' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "it" AltGr remapping */
static struct keymap_key it_altgr[] = {
{ 0x22, 0x23 }, /* '"' => '#' */
{ 0x23, 0x7e }, /* '#' => '~' */
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x27, 0x23 }, /* '\'' => '#' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2d, 0x60 }, /* '-' => '`' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x40 }, /* ':' => '@' */
{ 0x3b, 0x40 }, /* ';' => '@' */
{ 0x3d, 0x7e }, /* '=' => '~' */
{ 0x40, 0x7e }, /* '@' => '~' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x5f, 0x60 }, /* '_' => '`' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0, 0 }
};
/** "it" keyboard map */
struct keymap it_keymap __keymap = {
.name = "it",
.basic = it_basic,
.altgr = it_altgr,
};

View File

@ -10,24 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "lt" basic remapping */
static struct keymap_key lt_basic[] = {
{ 0, 0 }
};
/** "lt" AltGr remapping */
static struct keymap_key lt_altgr[] = {
{ 0x22, 0x5e }, /* '"' => '^' */
{ 0x27, 0x5e }, /* '\'' => '^' */
{ 0x4b, 0x26 }, /* 'K' => '&' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0, 0 }
};
/** "lt" keyboard map */
struct keymap lt_keymap __keymap = {
.name = "lt",
.basic = lt_basic,
.altgr = lt_altgr,
/** "lt" keyboard mapping */
struct key_mapping lt_mapping[] __keymap = {
};

View File

@ -10,21 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "mk" basic remapping */
static struct keymap_key mk_basic[] = {
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "mk" AltGr remapping */
static struct keymap_key mk_altgr[] = {
{ 0, 0 }
};
/** "mk" keyboard map */
struct keymap mk_keymap __keymap = {
.name = "mk",
.basic = mk_basic,
.altgr = mk_altgr,
/** "mk" keyboard mapping */
struct key_mapping mk_mapping[] __keymap = {
};

View File

@ -10,34 +10,11 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "mt" basic remapping */
static struct keymap_key mt_basic[] = {
{ 0x1c, 0x1e }, /* 0x1c => 0x1e */
/** "mt" keyboard mapping */
struct key_mapping mt_mapping[] __keymap = {
{ 0x22, 0x40 }, /* '"' => '@' */
{ 0x23, 0x04 }, /* '#' => Ctrl-D */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x23 }, /* '\\' => '#' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0, 0 }
};
/** "mt" AltGr remapping */
static struct keymap_key mt_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x5c, 0x60 }, /* '\\' => '`' */
{ 0x7e, 0x60 }, /* '~' => '`' */
{ 0, 0 }
};
/** "mt" keyboard map */
struct keymap mt_keymap __keymap = {
.name = "mt",
.basic = mt_basic,
.altgr = mt_altgr,
};

View File

@ -10,12 +10,8 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "nl" basic remapping */
static struct keymap_key nl_basic[] = {
{ 0x1c, 0x3c }, /* 0x1c => '<' */
{ 0x1d, 0x1c }, /* 0x1d => 0x1c */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
{ 0x22, 0x60 }, /* '"' => '`' */
/** "nl" keyboard mapping */
struct key_mapping nl_mapping[] __keymap = {
{ 0x26, 0x5f }, /* '&' => '_' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x27 }, /* ')' => '\'' */
@ -33,26 +29,6 @@ static struct keymap_key nl_basic[] = {
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x40 }, /* '`' => '@' */
{ 0x7b, 0x5e }, /* '{' => '^' */
{ 0x7c, 0x3e }, /* '|' => '>' */
{ 0x7d, 0x7c }, /* '}' => '|' */
{ 0xdc, 0x5d }, /* Pseudo-'\\' => ']' */
{ 0xfc, 0x5b }, /* Pseudo-'|' => '[' */
{ 0, 0 }
};
/** "nl" AltGr remapping */
static struct keymap_key nl_altgr[] = {
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x38, 0x7b }, /* '8' => '{' */
{ 0x39, 0x7d }, /* '9' => '}' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0, 0 }
};
/** "nl" keyboard map */
struct keymap nl_keymap __keymap = {
.name = "nl",
.basic = nl_basic,
.altgr = nl_altgr,
};

View File

@ -10,9 +10,8 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "no-latin1" basic remapping */
static struct keymap_key no_latin1_basic[] = {
{ 0x1d, 0x1e }, /* 0x1d => 0x1e */
/** "no-latin1" keyboard mapping */
struct key_mapping no_latin1_mapping[] __keymap = {
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
@ -32,32 +31,4 @@ static struct keymap_key no_latin1_basic[] = {
{ 0x60, 0x7c }, /* '`' => '|' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0x7d, 0x5e }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "no-latin1" AltGr remapping */
static struct keymap_key no_latin1_altgr[] = {
{ 0x22, 0x5b }, /* '"' => '[' */
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x5b, 0x7d }, /* '[' => '}' */
{ 0x7b, 0x5d }, /* '{' => ']' */
{ 0, 0 }
};
/** "no-latin1" keyboard map */
struct keymap no_latin1_keymap __keymap = {
.name = "no-latin1",
.basic = no_latin1_basic,
.altgr = no_latin1_altgr,
};

View File

@ -10,57 +10,96 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "no" basic remapping */
static struct keymap_key no_basic[] = {
{ 0x1c, 0x27 }, /* 0x1c => '\'' */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
/** "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 }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x2e, 0x76 }, /* '.' => 'v' */
{ 0x2f, 0x7a }, /* '/' => 'z' */
{ 0x3a, 0x53 }, /* ':' => 'S' */
{ 0x3b, 0x73 }, /* ';' => 's' */
{ 0x3c, 0x57 }, /* '<' => 'W' */
{ 0x3d, 0x5c }, /* '=' => '\\' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x3e, 0x56 }, /* '>' => 'V' */
{ 0x3f, 0x5a }, /* '?' => 'Z' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x27 }, /* '\\' => '\'' */
{ 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 }, /* '`' => '|' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 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 }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "no" AltGr remapping */
static struct keymap_key no_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x34, 0x24 }, /* '4' => '$' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x3a, 0x7e }, /* ':' => '~' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5c, 0x7e }, /* '\\' => '~' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0, 0 }
};
/** "no" keyboard map */
struct keymap no_keymap __keymap = {
.name = "no",
.basic = no_basic,
.altgr = no_altgr,
};

View File

@ -10,21 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "pl" basic remapping */
static struct keymap_key pl_basic[] = {
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "pl" AltGr remapping */
static struct keymap_key pl_altgr[] = {
{ 0, 0 }
};
/** "pl" keyboard map */
struct keymap pl_keymap __keymap = {
.name = "pl",
.basic = pl_basic,
.altgr = pl_altgr,
/** "pl" keyboard mapping */
struct key_mapping pl_mapping[] __keymap = {
};

View File

@ -10,53 +10,20 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "pt" basic remapping */
static struct keymap_key pt_basic[] = {
{ 0x1c, 0x7e }, /* 0x1c => '~' */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2d, 0x27 }, /* '-' => '\'' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5b, 0x2b }, /* '[' => '+' */
{ 0x5c, 0x7e }, /* '\\' => '~' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x60, 0x5c }, /* '`' => '\\' */
{ 0x7b, 0x2a }, /* '{' => '*' */
{ 0x7c, 0x5e }, /* '|' => '^' */
{ 0x7d, 0x60 }, /* '}' => '`' */
{ 0x7e, 0x7c }, /* '~' => '|' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "pt" AltGr remapping */
static struct keymap_key pt_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0, 0 }
};
/** "pt" keyboard map */
struct keymap pt_keymap __keymap = {
.name = "pt",
.basic = pt_basic,
.altgr = pt_altgr,
/** "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

@ -10,19 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "ro" basic remapping */
static struct keymap_key ro_basic[] = {
{ 0, 0 }
};
/** "ro" AltGr remapping */
static struct keymap_key ro_altgr[] = {
{ 0, 0 }
};
/** "ro" keyboard map */
struct keymap ro_keymap __keymap = {
.name = "ro",
.basic = ro_basic,
.altgr = ro_altgr,
/** "ro" keyboard mapping */
struct key_mapping ro_mapping[] __keymap = {
};

View File

@ -10,22 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "ru" basic remapping */
static struct keymap_key ru_basic[] = {
{ 0x0d, 0x0a }, /* Ctrl-M => Ctrl-J */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "ru" AltGr remapping */
static struct keymap_key ru_altgr[] = {
{ 0, 0 }
};
/** "ru" keyboard map */
struct keymap ru_keymap __keymap = {
.name = "ru",
.basic = ru_basic,
.altgr = ru_altgr,
/** "ru" keyboard mapping */
struct key_mapping ru_mapping[] __keymap = {
};

View File

@ -1,64 +0,0 @@
/** @file
*
* "se" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "se" basic remapping */
static struct keymap_key se_basic[] = {
{ 0x1c, 0x27 }, /* 0x1c => '\'' */
{ 0x1e, 0x36 }, /* 0x1e => '6' */
{ 0x26, 0x2f }, /* '&' => '/' */
{ 0x28, 0x29 }, /* '(' => ')' */
{ 0x29, 0x3d }, /* ')' => '=' */
{ 0x2a, 0x28 }, /* '*' => '(' */
{ 0x2b, 0x60 }, /* '+' => '`' */
{ 0x2d, 0x2b }, /* '-' => '+' */
{ 0x2f, 0x2d }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 0x3e, 0x3a }, /* '>' => ':' */
{ 0x3f, 0x5f }, /* '?' => '_' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x27 }, /* '\\' => '\'' */
{ 0x5e, 0x26 }, /* '^' => '&' */
{ 0x5f, 0x3f }, /* '_' => '?' */
{ 0x7c, 0x2a }, /* '|' => '*' */
{ 0x7d, 0x5e }, /* '}' => '^' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "se" AltGr remapping */
static struct keymap_key se_altgr[] = {
{ 0x26, 0x7b }, /* '&' => '{' */
{ 0x28, 0x5d }, /* '(' => ']' */
{ 0x29, 0x7d }, /* ')' => '}' */
{ 0x2a, 0x5b }, /* '*' => '[' */
{ 0x2d, 0x5c }, /* '-' => '\\' */
{ 0x30, 0x7d }, /* '0' => '}' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x34, 0x24 }, /* '4' => '$' */
{ 0x37, 0x7b }, /* '7' => '{' */
{ 0x38, 0x5b }, /* '8' => '[' */
{ 0x39, 0x5d }, /* '9' => ']' */
{ 0x51, 0x40 }, /* 'Q' => '@' */
{ 0x5d, 0x7e }, /* ']' => '~' */
{ 0x5f, 0x5c }, /* '_' => '\\' */
{ 0x71, 0x40 }, /* 'q' => '@' */
{ 0xdc, 0x7c }, /* Pseudo-'\\' => '|' */
{ 0, 0 }
};
/** "se" keyboard map */
struct keymap se_keymap __keymap = {
.name = "se",
.basic = se_basic,
.altgr = se_altgr,
};

View File

@ -10,8 +10,8 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "sg" basic remapping */
static struct keymap_key sg_basic[] = {
/** "sg" keyboard mapping */
struct key_mapping sg_mapping[] __keymap = {
{ 0x19, 0x1a }, /* Ctrl-Y => Ctrl-Z */
{ 0x1a, 0x19 }, /* Ctrl-Z => Ctrl-Y */
{ 0x21, 0x2b }, /* '!' => '+' */
@ -38,32 +38,4 @@ static struct keymap_key sg_basic[] = {
{ 0x7a, 0x79 }, /* 'z' => 'y' */
{ 0x7c, 0x24 }, /* '|' => '$' */
{ 0x7d, 0x21 }, /* '}' => '!' */
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "sg" AltGr remapping */
static struct keymap_key sg_altgr[] = {
{ 0x22, 0x7b }, /* '"' => '{' */
{ 0x26, 0x7c }, /* '&' => '|' */
{ 0x27, 0x7b }, /* '\'' => '{' */
{ 0x2b, 0x7e }, /* '+' => '~' */
{ 0x32, 0x40 }, /* '2' => '@' */
{ 0x33, 0x23 }, /* '3' => '#' */
{ 0x37, 0x7c }, /* '7' => '|' */
{ 0x3d, 0x7e }, /* '=' => '~' */
{ 0x5c, 0x7d }, /* '\\' => '}' */
{ 0x7b, 0x5b }, /* '{' => '[' */
{ 0x7c, 0x7d }, /* '|' => '}' */
{ 0x7d, 0x5d }, /* '}' => ']' */
{ 0xfc, 0x5c }, /* Pseudo-'|' => '\\' */
{ 0, 0 }
};
/** "sg" keyboard map */
struct keymap sg_keymap __keymap = {
.name = "sg",
.basic = sg_basic,
.altgr = sg_altgr,
};

View File

@ -1,30 +0,0 @@
/** @file
*
* "sr-latin" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "sr-latin" basic remapping */
static struct keymap_key sr_latin_basic[] = {
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "sr-latin" AltGr remapping */
static struct keymap_key sr_latin_altgr[] = {
{ 0, 0 }
};
/** "sr-latin" keyboard map */
struct keymap sr_latin_keymap __keymap = {
.name = "sr-latin",
.basic = sr_latin_basic,
.altgr = sr_latin_altgr,
};

View File

@ -0,0 +1,35 @@
/** @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 }, /* '/' => '-' */
{ 0x3c, 0x3b }, /* '<' => ';' */
{ 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,15 @@
/** @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 = {
};

View File

@ -10,21 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "ua" basic remapping */
static struct keymap_key ua_basic[] = {
{ 0xdc, 0x3c }, /* Pseudo-'\\' => '<' */
{ 0xfc, 0x3e }, /* Pseudo-'|' => '>' */
{ 0, 0 }
};
/** "ua" AltGr remapping */
static struct keymap_key ua_altgr[] = {
{ 0, 0 }
};
/** "ua" keyboard map */
struct keymap ua_keymap __keymap = {
.name = "ua",
.basic = ua_basic,
.altgr = ua_altgr,
/** "ua" keyboard mapping */
struct key_mapping ua_mapping[] __keymap = {
};

View File

@ -10,23 +10,10 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "uk" basic remapping */
static struct keymap_key uk_basic[] = {
/** "uk" keyboard mapping */
struct key_mapping uk_mapping[] __keymap = {
{ 0x22, 0x40 }, /* '"' => '@' */
{ 0x40, 0x22 }, /* '@' => '"' */
{ 0x5c, 0x23 }, /* '\\' => '#' */
{ 0x7c, 0x7e }, /* '|' => '~' */
{ 0, 0 }
};
/** "uk" AltGr remapping */
static struct keymap_key uk_altgr[] = {
{ 0, 0 }
};
/** "uk" keyboard map */
struct keymap uk_keymap __keymap = {
.name = "uk",
.basic = uk_basic,
.altgr = uk_altgr,
};

View File

@ -10,19 +10,6 @@ FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "us" basic remapping */
static struct keymap_key us_basic[] = {
{ 0, 0 }
};
/** "us" AltGr remapping */
static struct keymap_key us_altgr[] = {
{ 0, 0 }
};
/** "us" keyboard map */
struct keymap us_keymap __keymap_default = {
.name = "us",
.basic = us_basic,
.altgr = us_altgr,
/** "us" keyboard mapping */
struct key_mapping us_mapping[] __keymap = {
};

View File

@ -0,0 +1,55 @@
/** @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' */
{ 0x3c, 0x2e }, /* '<' => '.' */
{ 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 }, /* '~' => '%' */
};

View File

@ -17,6 +17,9 @@ struct cached_dhcp_packet;
extern struct cached_dhcp_packet cached_dhcpack;
extern struct cached_dhcp_packet cached_proxydhcp;
extern struct cached_dhcp_packet cached_pxebs;
extern struct generic_settings cachedhcp_generic;
#define cachedhcp_settings cachedhcp_generic.settings
extern int cachedhcp_record ( struct cached_dhcp_packet *cache, userptr_t data,
size_t max_len );

View File

@ -395,7 +395,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define ERRFILE_efi_cachedhcp ( ERRFILE_OTHER | 0x00550000 )
#define ERRFILE_linux_sysfs ( ERRFILE_OTHER | 0x00560000 )
#define ERRFILE_linux_acpi ( ERRFILE_OTHER | 0x00570000 )
#define ERRFILE_dynkeymap ( ERRFILE_OTHER | 0x00580000 )
/** @} */

View File

@ -13,67 +13,18 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <ipxe/tables.h>
/** A remapped key
*
* Represents a mapping from an ASCII character (as interpreted from a
* keyboard scancode by the US-only keyboard driver provided by the
* BIOS) to the appropriate ASCII value for the keyboard layout.
*/
struct keymap_key {
/** A keyboard mapping */
struct key_mapping {
/** Character read from keyboard */
uint8_t from;
/** Character to be used instead */
uint8_t to;
} __attribute__ (( packed ));
/** A keyboard mapping */
struct keymap {
/** Name */
const char *name;
/** Basic remapping table (zero-terminated) */
struct keymap_key *basic;
/** AltGr remapping table (zero-terminated) */
struct keymap_key *altgr;
};
/** Keyboard mapping table */
#define KEYMAP __table ( struct keymap, "keymap" )
/** Define a default keyboard mapping */
#define __keymap_default __table_entry ( KEYMAP, 01 )
#define KEYMAP __table ( struct key_mapping, "keymap" )
/** Define a keyboard mapping */
#define __keymap __table_entry ( KEYMAP, 02 )
/** Mappable character mask */
#define KEYMAP_MASK 0xff
/** Pseudo key flag */
#define KEYMAP_PSEUDO 0x80
/** Ctrl key flag */
#define KEYMAP_CTRL 0x0100
/** CapsLock key flag */
#define KEYMAP_CAPSLOCK 0x0200
/** Undo CapsLock key flag
*
* Used when the keyboard driver has already interpreted the CapsLock
* key, in which case the effect needs to be undone before remapping
* in order to correctly handle keyboard mappings that swap alphabetic
* and non-alphabetic keys.
*/
#define KEYMAP_CAPSLOCK_UNDO 0x0400
/** Undo and redo CapsLock key flags */
#define KEYMAP_CAPSLOCK_REDO ( KEYMAP_CAPSLOCK | KEYMAP_CAPSLOCK_UNDO )
/** AltGr key flag */
#define KEYMAP_ALTGR 0x0800
extern unsigned int key_remap ( unsigned int character );
extern struct keymap * keymap_find ( const char *name );
extern void keymap_set ( struct keymap *keymap );
#define __keymap __table_entry ( KEYMAP, 01 )
#endif /* _IPXE_KEYMAP_H */

View File

@ -252,17 +252,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
__attribute__ (( unused )); \
__table_entries; } )
/**
* Declare start of linker table entries
*
* @v entries Start of entries
* @v table Linker table
* @v idx Sub-table index
*/
#define __TABLE_ENTRIES( entries, table, idx ) \
__table_type ( table ) entries[0] \
__table_entry ( table, idx )
/**
* Get start of linker table
*
@ -281,14 +270,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#define table_start( table ) __table_entries ( table, 00 )
/**
* Declare start of linker table
*
* @v start Start of linker table
* @v table Linker table
*/
#define TABLE_START( start, table ) __TABLE_ENTRIES ( start, table, 00 )
/**
* Get end of linker table
*
@ -307,14 +288,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#define table_end( table ) __table_entries ( table, 99 )
/**
* Declare end of linker table
*
* @v end End of linker table
* @v table Linker table
*/
#define TABLE_END( end, table ) __TABLE_ENTRIES ( end, table, 99 )
/**
* Get number of entries in linker table
*

View File

@ -29,6 +29,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/image.h>
#include <ipxe/init.h>
#include <ipxe/in.h>
#include <ipxe/settings.h>
#include <ipxe/cachedhcp.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_autoexec.h>
#include <ipxe/efi/Protocol/PxeBaseCode.h>
@ -184,15 +186,15 @@ static int efi_autoexec_tftp ( EFI_HANDLE device ) {
void *interface;
EFI_PXE_BASE_CODE_PROTOCOL *pxe;
} u;
EFI_PXE_BASE_CODE_MODE *mode;
EFI_PXE_BASE_CODE_PACKET *packet;
union {
struct in_addr in;
EFI_IP_ADDRESS ip;
} server;
size_t filename_max;
struct settings *settings;
size_t filename_len;
char *filename;
char *sep;
int len;
UINT64 size;
VOID *data;
EFI_STATUS efirc;
@ -210,58 +212,30 @@ static int efi_autoexec_tftp ( EFI_HANDLE device ) {
goto err_pxe;
}
/* Do not attempt to parse DHCPv6 packets */
mode = u.pxe->Mode;
if ( mode->UsingIpv6 ) {
rc = -ENOTSUP;
DBGC ( device, "EFI %s has IPv6 PXE base code\n",
efi_handle_name ( device ) );
goto err_ipv6;
}
/* Identify relevant reply packet */
if ( mode->PxeReplyReceived &&
mode->PxeReply.Dhcpv4.BootpBootFile[0] ) {
/* Use boot filename if present in PXE reply */
DBGC ( device, "EFI %s using PXE reply filename\n",
efi_handle_name ( device ) );
packet = &mode->PxeReply;
} else if ( mode->DhcpAckReceived &&
mode->DhcpAck.Dhcpv4.BootpBootFile[0] ) {
/* Otherwise, use boot filename if present in DHCPACK */
DBGC ( device, "EFI %s using DHCPACK filename\n",
efi_handle_name ( device ) );
packet = &mode->DhcpAck;
} else if ( mode->ProxyOfferReceived &&
mode->ProxyOffer.Dhcpv4.BootpBootFile[0] ) {
/* Otherwise, use boot filename if present in ProxyDHCPOFFER */
DBGC ( device, "EFI %s using ProxyDHCPOFFER filename\n",
efi_handle_name ( device ) );
packet = &mode->ProxyOffer;
} else {
/* No boot filename available */
rc = -ENOENT;
DBGC ( device, "EFI %s has no PXE boot filename\n",
efi_handle_name ( device ) );
goto err_packet;
/* Identify settings block containing cached filename, if any */
len = fetch_setting ( &cachedhcp_settings, &filename_setting,
&settings, NULL, NULL, 0 );
if ( len < 0 ) {
rc = len;
DBGC ( device, "EFI %s has no PXE boot filename: %s\n",
efi_handle_name ( device ), strerror ( rc ) );
goto err_settings;
}
/* Allocate filename */
filename_max = ( sizeof ( packet->Dhcpv4.BootpBootFile )
+ ( sizeof ( efi_autoexec_name ) - 1 /* NUL */ )
filename_len = ( len + ( sizeof ( efi_autoexec_name ) - 1 /* NUL */ )
+ 1 /* NUL */ );
filename = zalloc ( filename_max );
filename = malloc ( filename_len );
if ( ! filename ) {
rc = -ENOMEM;
goto err_filename;
}
/* Extract next-server address and boot filename */
/* Fetch filename and TFTP server address */
fetch_string_setting ( settings, &filename_setting, filename,
filename_len );
memset ( &server, 0, sizeof ( server ) );
memcpy ( &server.in, packet->Dhcpv4.BootpSiAddr,
sizeof ( server.in ) );
memcpy ( filename, packet->Dhcpv4.BootpBootFile,
sizeof ( packet->Dhcpv4.BootpBootFile ) );
fetch_ipv4_setting ( settings, &next_server_setting, &server.in );
/* Update filename to autoexec script name */
sep = strrchr ( filename, '/' );
@ -333,8 +307,7 @@ static int efi_autoexec_tftp ( EFI_HANDLE device ) {
err_size:
free ( filename );
err_filename:
err_packet:
err_ipv6:
err_settings:
bs->CloseProtocol ( device, &efi_pxe_base_code_protocol_guid,
efi_image_handle, device );
err_pxe:

View File

@ -27,7 +27,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/efi/Protocol/ConsoleControl/ConsoleControl.h>
#include <ipxe/ansiesc.h>
#include <ipxe/console.h>
#include <ipxe/keymap.h>
#include <ipxe/init.h>
#include <config/console.h>
@ -55,6 +54,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define ATTR_DEFAULT ATTR_FCOL_WHITE
#define CTRL_MASK 0x1f
/* Set default console usage if applicable */
#if ! ( defined ( CONSOLE_EFI ) && CONSOLE_EXPLICIT ( CONSOLE_EFI ) )
#undef CONSOLE_EFI
@ -284,9 +285,6 @@ static int efi_getchar ( void ) {
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *conin = efi_systab->ConIn;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *conin_ex = efi_conin_ex;
const char *ansi_seq;
unsigned int character;
unsigned int shift;
unsigned int toggle;
EFI_KEY_DATA key;
EFI_STATUS efirc;
int rc;
@ -319,38 +317,17 @@ static int efi_getchar ( void ) {
key.KeyState.KeyToggleState, key.Key.UnicodeChar,
key.Key.ScanCode );
/* If key has a Unicode representation, remap and return it.
* There is unfortunately no way to avoid remapping the
* numeric keypad, since EFI destroys the scan code
* information that would allow us to differentiate between
* main keyboard and numeric keypad.
*/
if ( ( character = key.Key.UnicodeChar ) != 0 ) {
/* Apply shift state */
shift = key.KeyState.KeyShiftState;
if ( shift & EFI_SHIFT_STATE_VALID ) {
if ( shift & ( EFI_LEFT_CONTROL_PRESSED |
EFI_RIGHT_CONTROL_PRESSED ) ) {
character |= KEYMAP_CTRL;
}
if ( shift & EFI_RIGHT_ALT_PRESSED ) {
character |= KEYMAP_ALTGR;
}
}
/* Apply toggle state */
toggle = key.KeyState.KeyToggleState;
if ( toggle & EFI_TOGGLE_STATE_VALID ) {
if ( toggle & EFI_CAPS_LOCK_ACTIVE ) {
character |= KEYMAP_CAPSLOCK_REDO;
}
}
/* Remap and return key */
return key_remap ( character );
/* Translate Ctrl-<key> */
if ( ( key.KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID ) &&
( key.KeyState.KeyShiftState & ( EFI_LEFT_CONTROL_PRESSED |
EFI_RIGHT_CONTROL_PRESSED ) ) ) {
key.Key.UnicodeChar &= CTRL_MASK;
}
/* If key has a Unicode representation, return it */
if ( key.Key.UnicodeChar )
return key.Key.UnicodeChar;
/* Otherwise, check for a special key that we know about */
if ( ( ansi_seq = scancode_to_ansi_seq ( key.Key.ScanCode ) ) ) {
/* Start of escape sequence: return ESC (0x1b) */

View File

@ -870,7 +870,6 @@ static int xsmp_rx_xve_modify ( struct xsigo_manager *xcm,
* erroneously transmitted as little-endian.
*/
mtu = ntohs ( msg->mtu );
memset ( &tca, 0, sizeof ( tca ) );
tca.qpn = ntohl ( msg->tca.data );
tca.qkey = ntohs ( msg->tca.qkey );
tca.gid_present = 1;

View File

@ -87,6 +87,9 @@ static struct dns_server dns6;
/** Total number of DNS servers */
static unsigned int dns_count;
/** Current DNS server index */
static unsigned int dns_index;
/** The DNS search list */
static struct dns_name dns_search;
@ -486,8 +489,6 @@ struct dns_request {
size_t offset;
/** Search list */
struct dns_name search;
/** Server index */
unsigned int index;
/** Recursion counter */
unsigned int recursion;
};
@ -605,7 +606,7 @@ static int dns_send_packet ( struct dns_request *dns ) {
DBGC ( dns, "DNS %p lost DNS servers mid query\n", dns );
return -EINVAL;
}
index = ( dns->index % dns_count );
index = ( dns_index % dns_count );
if ( index < dns6.count ) {
nameserver.sin6.sin6_family = AF_INET6;
memcpy ( &nameserver.sin6.sin6_addr, &dns6.in6[index],
@ -650,7 +651,7 @@ static void dns_timer_expired ( struct retry_timer *timer, int fail ) {
/* Move to next DNS server if this is a retransmission */
if ( dns->buf.query.id )
dns->index++;
dns_index++;
/* Send DNS query */
dns_send_packet ( dns );

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

@ -0,0 +1,238 @@
#!/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., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, 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
if ( $keysym & 0xf000 ) {
warn "Unexpected keysym ".sprintf ( "0x%04x", $keysym )."\n";
return;
}
# 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;
my $new_map = ( ! exists $map->{$from_ascii} );
my $update_map =
( $new_map || ( $keycode < $map->{$from_ascii}->{keycode} ) );
if ( ( $verbosity > 1 ) &&
( ( $from_ascii != $to_ascii ) ||
( $update_map && ! $new_map ) ) ) {
printf STDERR "In keymap %d: %s => %s%s\n", $keymap,
ascii_to_name ( $from_ascii ), ascii_to_name ( $to_ascii ),
( $update_map ? ( $new_map ? "" : " (override)" )
: " (ignored)" );
}
if ( $update_map ) {
$map->{$from_ascii} = {
to_ascii => $to_ascii,
keycode => $keycode,
};
}
}
}
return { map { $_ => $map->{$_}->{to_ascii} } keys %$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";

View File

@ -1,451 +0,0 @@
#!/usr/bin/env python3
#
# Copyright (C) 2022 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., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
"""Generate iPXE keymaps"""
from __future__ import annotations
import argparse
from collections import UserDict
from collections.abc import Sequence, Mapping, MutableMapping
from dataclasses import dataclass
from enum import Flag, IntEnum
import re
import subprocess
from struct import Struct
import textwrap
from typing import ClassVar, Optional
BACKSPACE = chr(0x7f)
"""Backspace character"""
class KeyType(IntEnum):
"""Key types"""
LATIN = 0
FN = 1
SPEC = 2
PAD = 3
DEAD = 4
CONS = 5
CUR = 6
SHIFT = 7
META = 8
ASCII = 9
LOCK = 10
LETTER = 11
SLOCK = 12
DEAD2 = 13
BRL = 14
UNKNOWN = 0xf0
class DeadKey(IntEnum):
"""Dead keys"""
GRAVE = 0
CIRCUMFLEX = 2
TILDE = 3
class KeyModifiers(Flag):
"""Key modifiers"""
NONE = 0
SHIFT = 1
ALTGR = 2
CTRL = 4
ALT = 8
SHIFTL = 16
SHIFTR = 32
CTRLL = 64
CTRLR = 128
@property
def complexity(self) -> int:
"""Get complexity value of applied modifiers"""
if self == self.NONE:
return 0
if self == self.SHIFT:
return 1
if self == self.CTRL:
return 2
return 3 + bin(self.value).count('1')
@dataclass(frozen=True)
class Key:
"""A single key definition"""
keycode: int
"""Opaque keycode"""
keysym: int
"""Key symbol"""
modifiers: KeyModifiers
"""Applied modifiers"""
ASCII_TYPES: ClassVar[set[KeyType]] = {KeyType.LATIN, KeyType.ASCII,
KeyType.LETTER}
"""Key types with direct ASCII values"""
DEAD_KEYS: ClassVar[Mapping[int, str]] = {
DeadKey.GRAVE: '`',
DeadKey.CIRCUMFLEX: '^',
DeadKey.TILDE: '~',
}
"""Dead key replacement ASCII values"""
@property
def keytype(self) -> Optional[KeyType]:
"""Key type"""
try:
return KeyType(self.keysym >> 8)
except ValueError:
return None
@property
def value(self) -> int:
"""Key value"""
return self.keysym & 0xff
@property
def ascii(self) -> Optional[str]:
"""ASCII character"""
keytype = self.keytype
value = self.value
if keytype in self.ASCII_TYPES:
char = chr(value)
if value and char.isascii():
return char
if keytype == KeyType.DEAD:
return self.DEAD_KEYS.get(value)
return None
class KeyLayout(UserDict[KeyModifiers, Sequence[Key]]):
"""A keyboard layout"""
BKEYMAP_MAGIC: ClassVar[bytes] = b'bkeymap'
"""Magic signature for output produced by 'loadkeys -b'"""
MAX_NR_KEYMAPS: ClassVar[int] = 256
"""Maximum number of keymaps produced by 'loadkeys -b'"""
NR_KEYS: ClassVar[int] = 128
"""Number of keys in each keymap produced by 'loadkeys -b'"""
KEY_BACKSPACE: ClassVar[int] = 14
"""Key code for backspace
Keyboard maps seem to somewhat arbitrarily pick an interpretation
for the backspace key and its various modifiers, according to the
personal preference of the keyboard map transcriber.
"""
KEY_NON_US: ClassVar[int] = 86
"""Key code 86
Key code 86 is somewhat bizarre. It doesn't physically exist on
most US keyboards. The database used by "loadkeys" defines it as
"<>", while most other databases either define it as a duplicate
"\\|" or omit it entirely.
"""
FIXUPS: ClassVar[Mapping[str, Mapping[KeyModifiers,
Sequence[tuple[int, int]]]]] = {
'us': {
# Redefine erroneous key 86 as generating "\\|"
KeyModifiers.NONE: [(KEY_NON_US, ord('\\'))],
KeyModifiers.SHIFT: [(KEY_NON_US, ord('|'))],
# Treat Ctrl-Backspace as producing Backspace rather than Ctrl-H
KeyModifiers.CTRL: [(KEY_BACKSPACE, ord(BACKSPACE))],
},
'il': {
# Redefine some otherwise unreachable ASCII characters
# using the closest available approximation
KeyModifiers.ALTGR: [(0x28, ord('\'')), (0x2b, ord('`')),
(0x35, ord('/'))],
},
'mt': {
# Redefine erroneous key 86 as generating "\\|"
KeyModifiers.NONE: [(KEY_NON_US, ord('\\'))],
KeyModifiers.SHIFT: [(KEY_NON_US, ord('|'))],
},
}
"""Fixups for erroneous keymappings produced by 'loadkeys -b'"""
@property
def unshifted(self):
"""Basic unshifted keyboard layout"""
return self[KeyModifiers.NONE]
@property
def shifted(self):
"""Basic shifted keyboard layout"""
return self[KeyModifiers.SHIFT]
@classmethod
def load(cls, name: str) -> KeyLayout:
"""Load keymap using 'loadkeys -b'"""
bkeymap = subprocess.check_output(["loadkeys", "-u", "-b", name])
if not bkeymap.startswith(cls.BKEYMAP_MAGIC):
raise ValueError("Invalid bkeymap magic signature")
bkeymap = bkeymap[len(cls.BKEYMAP_MAGIC):]
included = bkeymap[:cls.MAX_NR_KEYMAPS]
if len(included) != cls.MAX_NR_KEYMAPS:
raise ValueError("Invalid bkeymap inclusion list")
bkeymap = bkeymap[cls.MAX_NR_KEYMAPS:]
keys = {}
for modifiers in map(KeyModifiers, range(cls.MAX_NR_KEYMAPS)):
if included[modifiers.value]:
fmt = Struct('<%dH' % cls.NR_KEYS)
bkeylist = bkeymap[:fmt.size]
if len(bkeylist) != fmt.size:
raise ValueError("Invalid bkeymap map %#x" %
modifiers.value)
keys[modifiers] = [
Key(modifiers=modifiers, keycode=keycode, keysym=keysym)
for keycode, keysym in enumerate(fmt.unpack(bkeylist))
]
bkeymap = bkeymap[len(bkeylist):]
if bkeymap:
raise ValueError("Trailing bkeymap data")
for modifiers, fixups in cls.FIXUPS.get(name, {}).items():
for keycode, keysym in fixups:
keys[modifiers][keycode] = Key(modifiers=modifiers,
keycode=keycode, keysym=keysym)
return cls(keys)
@property
def inverse(self) -> MutableMapping[str, Key]:
"""Construct inverse mapping from ASCII value to key"""
return {
key.ascii: key
# Give priority to simplest modifier for a given ASCII code
for modifiers in sorted(self.keys(), reverse=True,
key=lambda x: (x.complexity, x.value))
# Give priority to lowest keycode for a given ASCII code
for key in reversed(self[modifiers])
# Ignore keys with no ASCII value
if key.ascii
}
class BiosKeyLayout(KeyLayout):
"""Keyboard layout as used by the BIOS
To allow for remappings of the somewhat interesting key 86, we
arrange for our keyboard drivers to generate this key as "\\|"
with the high bit set.
"""
KEY_PSEUDO: ClassVar[int] = 0x80
"""Flag used to indicate a fake ASCII value"""
KEY_NON_US_UNSHIFTED: ClassVar[str] = chr(KEY_PSEUDO | ord('\\'))
"""Fake ASCII value generated for unshifted key code 86"""
KEY_NON_US_SHIFTED: ClassVar[str] = chr(KEY_PSEUDO | ord('|'))
"""Fake ASCII value generated for shifted key code 86"""
@property
def inverse(self) -> MutableMapping[str, Key]:
inverse = super().inverse
assert len(inverse) == 0x7f
inverse[self.KEY_NON_US_UNSHIFTED] = self.unshifted[self.KEY_NON_US]
inverse[self.KEY_NON_US_SHIFTED] = self.shifted[self.KEY_NON_US]
assert all(x.modifiers in {KeyModifiers.NONE, KeyModifiers.SHIFT,
KeyModifiers.CTRL}
for x in inverse.values())
return inverse
class KeymapKeys(UserDict[str, Optional[str]]):
"""An ASCII character remapping"""
@classmethod
def ascii_name(cls, char: str) -> str:
"""ASCII character name"""
if char == '\\':
name = "'\\\\'"
elif char == '\'':
name = "'\\\''"
elif ord(char) & BiosKeyLayout.KEY_PSEUDO:
name = "Pseudo-%s" % cls.ascii_name(
chr(ord(char) & ~BiosKeyLayout.KEY_PSEUDO)
)
elif char.isprintable():
name = "'%s'" % char
elif ord(char) <= 0x1a:
name = "Ctrl-%c" % (ord(char) + 0x40)
else:
name = "0x%02x" % ord(char)
return name
@property
def code(self):
"""Generated source code for C array"""
return '{\n' + ''.join(
'\t{ 0x%02x, 0x%02x },\t/* %s => %s */\n' % (
ord(source), ord(target),
self.ascii_name(source), self.ascii_name(target)
)
for source, target in self.items()
if target
and ord(source) & ~BiosKeyLayout.KEY_PSEUDO != ord(target)
) + '\t{ 0, 0 }\n}'
@dataclass
class Keymap:
"""An iPXE keyboard mapping"""
name: str
"""Mapping name"""
source: KeyLayout
"""Source keyboard layout"""
target: KeyLayout
"""Target keyboard layout"""
@property
def basic(self) -> KeymapKeys:
"""Basic remapping table"""
# Construct raw mapping from source ASCII to target ASCII
raw = {source: self.target[key.modifiers][key.keycode].ascii
for source, key in self.source.inverse.items()}
# Eliminate any identity mappings, or mappings that attempt to
# remap the backspace key
table = {source: target for source, target in raw.items()
if source != target
and source != BACKSPACE
and target != BACKSPACE}
# Recursively delete any mappings that would produce
# unreachable alphanumerics (e.g. the "il" keymap, which maps
# away the whole lower-case alphabet)
while True:
unreachable = set(table.keys()) - set(table.values())
delete = {x for x in unreachable if x.isascii() and x.isalnum()}
if not delete:
break
table = {k: v for k, v in table.items() if k not in delete}
# Sanity check: ensure that all numerics are reachable using
# the same shift state
digits = '1234567890'
unshifted = ''.join(table.get(x) or x for x in '1234567890')
shifted = ''.join(table.get(x) or x for x in '!@#$%^&*()')
if digits not in (shifted, unshifted):
raise ValueError("Inconsistent numeric remapping %s / %s" %
(unshifted, shifted))
return KeymapKeys(dict(sorted(table.items())))
@property
def altgr(self) -> KeymapKeys:
"""AltGr remapping table"""
# Construct raw mapping from source ASCII to target ASCII
raw = {
source: next((self.target[x][key.keycode].ascii
for x in (key.modifiers | KeyModifiers.ALTGR,
KeyModifiers.ALTGR, key.modifiers)
if x in self.target
and self.target[x][key.keycode].ascii), None)
for source, key in self.source.inverse.items()
}
# Identify printable keys that are unreachable via the basic map
basic = self.basic
unmapped = set(x for x in basic.keys()
if x.isascii() and x.isprintable())
remapped = set(basic.values())
unreachable = unmapped - remapped
# Eliminate any mappings for unprintable characters, or
# mappings for characters that are reachable via the basic map
table = {source: target for source, target in raw.items()
if source.isprintable()
and target in unreachable}
# Check that all characters are now reachable
unreachable -= set(table.values())
if unreachable:
raise ValueError("Unreachable characters: %s" % ', '.join(
KeymapKeys.ascii_name(x) for x in sorted(unreachable)
))
return KeymapKeys(dict(sorted(table.items())))
def cname(self, suffix: str) -> str:
"""C variable name"""
return re.sub(r'\W', '_', (self.name + '_' + suffix))
@property
def code(self) -> str:
"""Generated source code"""
keymap_name = self.cname("keymap")
basic_name = self.cname("basic")
altgr_name = self.cname("altgr")
attribute = "__keymap_default" if self.name == "us" else "__keymap"
code = textwrap.dedent(f"""
/** @file
*
* "{self.name}" keyboard mapping
*
* This file is automatically generated; do not edit
*
*/
FILE_LICENCE ( PUBLIC_DOMAIN );
#include <ipxe/keymap.h>
/** "{self.name}" basic remapping */
static struct keymap_key {basic_name}[] = %s;
/** "{self.name}" AltGr remapping */
static struct keymap_key {altgr_name}[] = %s;
/** "{self.name}" keyboard map */
struct keymap {keymap_name} {attribute} = {{
\t.name = "{self.name}",
\t.basic = {basic_name},
\t.altgr = {altgr_name},
}};
""").strip() % (self.basic.code, self.altgr.code)
return code
if __name__ == '__main__':
# Parse command-line arguments
parser = argparse.ArgumentParser(description="Generate iPXE keymaps")
parser.add_argument('--verbose', '-v', action='count', default=0,
help="Increase verbosity")
parser.add_argument('layout', help="Target keyboard layout")
args = parser.parse_args()
# Load source and target keyboard layouts
source = BiosKeyLayout.load('us')
target = KeyLayout.load(args.layout)
# Construct keyboard mapping
keymap = Keymap(name=args.layout, source=source, target=target)
# Output generated code
print(keymap.code)