Support BTN_* codes with btn_ prefix and keys with KEY_ prefix
optionally removed.
# KEYBOARD_KEY_<hex scan code>=<key code identifier>
# The scan code should be expressed in hex lowercase. The key codes
# are retrieved and normalized from the kernel input API header.
# KEYBOARD_KEY_<hex scan code>=<key code identifier>
# The scan code should be expressed in hex lowercase. The key codes
# are retrieved and normalized from the kernel input API header.
+# Keycodes are either KEY_* defines in lowercase with the key_ prefix
+# optionally removed or BTN_ defines in lowercase with btn_ preserved.
#
# An '!' as the first character of the key identifier string
# will add the scan code to the AT keyboard's list of scan codes
#
# An '!' as the first character of the key identifier string
# will add the scan code to the AT keyboard's list of scan codes
if value != '!' and ecodes is not None:
key = 'KEY_' + value.upper()
if key not in ecodes:
if value != '!' and ecodes is not None:
key = 'KEY_' + value.upper()
if key not in ecodes:
- error('Keycode {} unknown', key)
+ key = value.upper()
+ if key not in ecodes:
+ error('Keycode {} unknown', key)
def check_properties(groups):
grammar = property_grammar()
def check_properties(groups):
grammar = property_grammar()
}
/^KEY_/ { print tolower(substr($1 ,5)) ", " $1 }
}
/^KEY_/ { print tolower(substr($1 ,5)) ", " $1 }
+ { print tolower($1) ", " $1 }
#!/bin/sh -eu
$1 -dM -include linux/input.h - </dev/null | \
#!/bin/sh -eu
$1 -dM -include linux/input.h - </dev/null | \
- awk '/^#define[ \t]+KEY_[^ ]+[ \t]+[0-9K]/ { if ($2 != "KEY_MAX") { print $2 } }'
+ awk '/^#define[ \t]+(KEY|BTN)_[^ ]+[ \t]+[0-9BK]/ { if ($2 != "KEY_MAX") { print $2 } }'