iPXE
keymap.h
Go to the documentation of this file.
1#ifndef _IPXE_KEYMAP_H
2#define _IPXE_KEYMAP_H
3
4/**
5 * @file
6 *
7 * Keyboard mappings
8 *
9 */
10
11FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
12FILE_SECBOOT ( PERMITTED );
13
14#include <stdint.h>
15#include <ipxe/tables.h>
16
17/** A remapped key
18 *
19 * Represents a mapping from an ASCII character (as interpreted from a
20 * keyboard scancode by the US-only keyboard driver provided by the
21 * BIOS) to the appropriate ASCII value for the keyboard layout.
22 */
23struct keymap_key {
24 /** Character read from keyboard */
26 /** Character to be used instead */
28} __attribute__ (( packed ));
29
30/** A keyboard mapping */
31struct keymap {
32 /** Name */
33 const char *name;
34 /** Basic remapping table (zero-terminated) */
36 /** AltGr remapping table (zero-terminated) */
38};
39
40/** Keyboard mapping table */
41#define KEYMAP __table ( struct keymap, "keymap" )
42
43/** Define a default keyboard mapping */
44#define __keymap_default __table_entry ( KEYMAP, 01 )
45
46/** Define a keyboard mapping */
47#define __keymap __table_entry ( KEYMAP, 02 )
48
49/** Mappable character mask */
50#define KEYMAP_MASK 0xff
51
52/** Pseudo key flag */
53#define KEYMAP_PSEUDO 0x80
54
55/** Ctrl key flag */
56#define KEYMAP_CTRL 0x01000000
57
58/** CapsLock key flag */
59#define KEYMAP_CAPSLOCK 0x02000000
60
61/** Undo CapsLock key flag
62 *
63 * Used when the keyboard driver has already interpreted the CapsLock
64 * key, in which case the effect needs to be undone before remapping
65 * in order to correctly handle keyboard mappings that swap alphabetic
66 * and non-alphabetic keys.
67 */
68#define KEYMAP_CAPSLOCK_UNDO 0x04000000
69
70/** Undo and redo CapsLock key flags */
71#define KEYMAP_CAPSLOCK_REDO ( KEYMAP_CAPSLOCK | KEYMAP_CAPSLOCK_UNDO )
72
73/** AltGr key flag */
74#define KEYMAP_ALTGR 0x08000000
75
76extern unsigned int key_remap ( unsigned int character );
77extern struct keymap * keymap_find ( const char *name );
78extern void keymap_set ( struct keymap *keymap );
79
80#endif /* _IPXE_KEYMAP_H */
unsigned char uint8_t
Definition stdint.h:10
const char * name
Definition ath9k_hw.c:1986
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
#define __attribute__(x)
Definition compiler.h:10
void keymap_set(struct keymap *keymap)
Set keyboard map.
Definition keymap.c:122
unsigned int key_remap(unsigned int character)
Remap a key.
Definition keymap.c:62
struct keymap * keymap_find(const char *name)
Find keyboard map by name.
Definition keymap.c:105
A remapped key.
Definition keymap.h:23
uint8_t from
Character read from keyboard.
Definition keymap.h:25
uint8_t to
Character to be used instead.
Definition keymap.h:27
A keyboard mapping.
Definition keymap.h:31
const char * name
Name.
Definition keymap.h:33
struct keymap_key * altgr
AltGr remapping table (zero-terminated)
Definition keymap.h:37
struct keymap_key * basic
Basic remapping table (zero-terminated)
Definition keymap.h:35
Linker tables.