aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/keymap.h
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2022-02-14 16:31:08 +0000
committerMichael Brown <mcb30@ipxe.org>2022-02-15 11:58:50 +0000
commitf2a59d5973da2041f93264609698b9b3f4ec101b (patch)
treed74210c67817a2bc8ddbf92514c18608566317ed /src/include/ipxe/keymap.h
parent871dd236d4aff66e871c25addcf522fe75a4ccd7 (diff)
downloadipxe-f2a59d5973da2041f93264609698b9b3f4ec101b.tar.gz
[console] Centralise handling of key modifiers
Handle Ctrl and CapsLock key modifiers within key_remap(), to provide consistent behaviour across different console types. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/keymap.h')
-rw-r--r--src/include/ipxe/keymap.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/include/ipxe/keymap.h b/src/include/ipxe/keymap.h
index a64ab9cd4..3da25190b 100644
--- a/src/include/ipxe/keymap.h
+++ b/src/include/ipxe/keymap.h
@@ -40,9 +40,30 @@ struct keymap {
/** Define a keyboard mapping */
#define __keymap __table_entry ( KEYMAP, 01 )
+/** 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 )
+
extern unsigned int key_remap ( unsigned int character );
#endif /* _IPXE_KEYMAP_H */