hwdb: weed out key defines which do not designate events
authorMichal Suchanek <msuchanek@suse.de>
Thu, 15 Jun 2017 10:50:05 +0000 (12:50 +0200)
committerMichal Suchanek <msuchanek@suse.de>
Tue, 27 Jun 2017 11:29:02 +0000 (13:29 +0200)
The defines

KEY_MAX
KEY_CNT
KEY_MIN_INTERESTING
BTN_MISC
BTN_MOUSE
BTN_JOYSTICK
BTN_GAMEPAD
BTN_DIGI
BTN_WHEEL
BTN_TRIGGER_HAPPY

mark start/end of key blocks and do not designate events.

Exclude them from the list of recognized key events.

src/udev/generate-keyboard-keys-list.sh

index 83bf4a9..7a74e0d 100755 (executable)
@@ -1,4 +1,6 @@
 #!/bin/sh -eu
 
-$1 -dM -include linux/input.h - </dev/null | \
-        awk '/^#define[ \t]+(KEY|BTN)_[^ ]+[ \t]+[0-9BK]/ { if ($2 != "KEY_MAX") { print $2 } }'
+$1 -dM -include linux/input.h - </dev/null | awk '
+        /\<(KEY_(MAX|MIN_INTERESTING))|(BTN_(MISC|MOUSE|JOYSTICK|GAMEPAD|DIGI|WHEEL|TRIGGER_HAPPY))\>/  { next }
+        /^#define[ \t]+(KEY|BTN)_[^ ]+[ \t]+[0-9BK]/                                                    { print $2 }
+'