]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
hwdb: support pressing buttons on a keyboard
authorMichal Suchanek <msuchanek@suse.de>
Wed, 7 Jun 2017 13:28:18 +0000 (15:28 +0200)
committerMichal Suchanek <msuchanek@suse.de>
Tue, 27 Jun 2017 11:28:07 +0000 (13:28 +0200)
Support BTN_* codes with btn_ prefix and keys with KEY_ prefix
optionally removed.

hwdb/60-keyboard.hwdb
hwdb/parse_hwdb.py
src/udev/generate-keyboard-keys-gperf.sh
src/udev/generate-keyboard-keys-list.sh

index e8be567166cf1a73decd6f5d41923cdb0ebad50d..43cb23da3299411bf82aacde6cb36ad268402f28 100644 (file)
@@ -58,6 +58,8 @@
 #   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
index 23809a9f1fc3fc6d1f0a744497f43edcab635839..c7b49b83df66ac32cff6f39b695ed8abd581b21c 100755 (executable)
@@ -172,7 +172,9 @@ def check_one_keycode(prop, value):
     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()
index 36ce0bd6cc297fcc5e3b7928944dd486c472cc48..5724e4e3dc5e25b684678d47fada9dc061f53736 100755 (executable)
@@ -6,4 +6,5 @@ awk '   BEGIN {
         }
 
         /^KEY_/ { print tolower(substr($1 ,5)) ", " $1 }
+                { print tolower($1) ", " $1 }
 ' < "$1"
index 479e49318264342b01070f146ddb3b5ac1a26014..83bf4a97d22791d9409e838400d99d54ff4151e7 100755 (executable)
@@ -1,4 +1,4 @@
 #!/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 } }'