@@ -33,45 +33,7 @@ sync-with-kernel:
exit 1; \
fi
@echo generating $(srcdir)/parse.h
- @printf "struct parse_event {\n\tchar *name;\n\tunsigned int value;\n};\n" > $(srcdir)/parse.h
-
- @printf "struct parse_event events_type[] = {\n" >> $(srcdir)/parse.h
- @more $(KERNEL_DIR)/usr/include/linux/input-event-codes.h | perl -n \
- -e 'if (m/^\#define\s+(EV_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \
- -e '{ printf "\t{\"%s\", %s},\n",$$1,$$2 if ($$1 ne "EV_VERSION"); }' \
- >> $(srcdir)/parse.h
- @printf "\t{ NULL, 0}\n};\n" >> $(srcdir)/parse.h
-
- @printf "struct parse_event msc_events[] = {\n" >> $(srcdir)/parse.h
- @more $(KERNEL_DIR)/usr/include/linux/input-event-codes.h | perl -n \
- -e 'if (m/^\#define\s+(MSC_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \
- -e '{ printf "\t{\"%s\", %s},\n",$$1,$$2; }' \
- >> $(srcdir)/parse.h
- @printf "\t{ NULL, 0}\n};\n" >> $(srcdir)/parse.h
-
- @printf "struct parse_event key_events[] = {\n" >> $(srcdir)/parse.h
- @more $(KERNEL_DIR)/usr/include/linux/input-event-codes.h | perl -n \
- -e 'if (m/^\#define\s+(KEY_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \
- -e '{ printf "\t{\"%s\", %s},\n",$$1,$$2; }' \
- -e 'if (m/^\#define\s+(BTN_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \
- -e '{ printf "\t{\"%s\", %s},\n",$$1,$$2; }' \
- >> $(srcdir)/parse.h
- @printf "\t{ NULL, 0}\n};\n" >> $(srcdir)/parse.h
-
- @printf "struct parse_event rel_events[] = {\n" >> $(srcdir)/parse.h
- @more $(KERNEL_DIR)/usr/include/linux/input-event-codes.h | perl -n \
- -e 'if (m/^\#define\s+(REL_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \
- -e '{ printf "\t{\"%s\", %s},\n",$$1,$$2; }' \
- >> $(srcdir)/parse.h
- @printf "\t{ NULL, 0}\n};\n" >> $(srcdir)/parse.h
-
- @printf "struct parse_event abs_events[] = {\n" >> $(srcdir)/parse.h
- @more $(KERNEL_DIR)/usr/include/linux/input-event-codes.h | perl -n \
- -e 'if (m/^\#define\s+(ABS_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \
- -e '{ printf "\t{\"%s\", %s},\n",$$1,$$2; }' \
- >> $(srcdir)/parse.h
- @printf "\t{ NULL, 0}\n};\n" >> $(srcdir)/parse.h
-
+ @./gen_input_events.pl < $(KERNEL_DIR)/usr/include/linux/input-event-codes.h > $(srcdir)/parse.h
@-mkdir -p $(srcdir)/rc_keymaps
@-rm $(srcdir)/rc_keymaps/*
@echo storing existing keymaps at $(srcdir)/rc_keymaps/
new file mode 100755
@@ -0,0 +1,92 @@
+#!/usr/bin/perl
+use strict;
+
+my @ev;
+my @msc;
+my @key;
+my @key;
+my @rel;
+my @abs;
+
+my %key_hash;
+
+while (<>) {
+ if (m/^\#define\s+(EV_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) {
+ next if ($1 eq "EV_VERSION");
+ my @e = ($1, $2);
+ push(@ev, \@e);
+ }
+
+ if (m/^\#define\s+(MSC_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) {
+ my @e = ($1, $2);
+ push(@msc, \@e);
+ }
+
+ if (m/^\#define\s+(KEY_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) {
+ $key_hash{$1} = $2;
+ my @e = ($1, $2);
+ push(@key, \@e);
+ }
+
+ if (m/^\#define\s+(KEY_[^\s]+)\s+(KEY_[^\s]+)/) {
+ my @e = ($1, $key_hash{$2});
+ push(@key, \@e);
+ }
+
+ if (m/^\#define\s+(BTN_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) {
+ my @e = ($1, $2);
+ push(@key, \@e);
+ }
+
+ if (m/^\#define\s+(REL_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) {
+ my @e = ($1, $2);
+ push(@rel, \@e);
+ }
+
+ if (m/^\#define\s+(ABS_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) {
+ my @e = ($1, $2);
+ push(@abs, \@e);
+ }
+}
+
+print "struct parse_event {\n\tchar *name;\n\tunsigned int value;\n};\n";
+print "struct parse_event events_type[] = {\n";
+for my $e (@ev) {
+ my $name = @$e[0];
+ my $val = @$e[1];
+ print "\t{\"$name\", $val},\n";
+}
+print "\t{ NULL, 0}\n};\n";
+
+print "struct parse_event msc_events[] = {\n";
+for my $e (@msc) {
+ my $name = @$e[0];
+ my $val = @$e[1];
+ print "\t{\"$name\", $val},\n";
+}
+print "\t{ NULL, 0}\n};\n";
+
+print "struct parse_event key_events[] = {\n";
+for my $e (@key) {
+ my $name = @$e[0];
+ my $val = @$e[1];
+ print "\t{\"$name\", $val},\n";
+}
+print "\t{ NULL, 0}\n};\n";
+
+print "struct parse_event rel_events[] = {\n";
+for my $e (@rel) {
+ my $name = @$e[0];
+ my $val = @$e[1];
+ print "\t{\"$name\", $val},\n";
+}
+print "\t{ NULL, 0}\n};\n";
+
+print "struct parse_event abs_events[] = {\n";
+for my $e (@abs) {
+ my $name = @$e[0];
+ my $val = @$e[1];
+ print "\t{\"$name\", $val},\n";
+}
+print "\t{ NULL, 0}\n};\n";
+
@@ -151,6 +151,7 @@ struct parse_event key_events[] = {
{"KEY_SCALE", 120},
{"KEY_KPCOMMA", 121},
{"KEY_HANGEUL", 122},
+ {"KEY_HANGUEL", 122},
{"KEY_HANJA", 123},
{"KEY_YEN", 124},
{"KEY_LEFTMETA", 125},
@@ -181,7 +182,9 @@ struct parse_event key_events[] = {
{"KEY_WWW", 150},
{"KEY_MSDOS", 151},
{"KEY_COFFEE", 152},
+ {"KEY_SCREENLOCK", 152},
{"KEY_ROTATE_DISPLAY", 153},
+ {"KEY_DIRECTION", 153},
{"KEY_CYCLEWINDOWS", 154},
{"KEY_MAIL", 155},
{"KEY_BOOKMARKS", 156},
@@ -268,8 +271,10 @@ struct parse_event key_events[] = {
{"KEY_VIDEO_PREV", 242},
{"KEY_BRIGHTNESS_CYCLE", 243},
{"KEY_BRIGHTNESS_AUTO", 244},
+ {"KEY_BRIGHTNESS_ZERO", 244},
{"KEY_DISPLAY_OFF", 245},
{"KEY_WWAN", 246},
+ {"KEY_WIMAX", 246},
{"KEY_RFKILL", 247},
{"KEY_MICMUTE", 248},
{"BTN_MISC", 0x100},
@@ -363,9 +368,11 @@ struct parse_event key_events[] = {
{"KEY_SUBTITLE", 0x172},
{"KEY_ANGLE", 0x173},
{"KEY_FULL_SCREEN", 0x174},
+ {"KEY_ZOOM", 0x174},
{"KEY_MODE", 0x175},
{"KEY_KEYBOARD", 0x176},
{"KEY_ASPECT_RATIO", 0x177},
+ {"KEY_SCREEN", 0x177},
{"KEY_PC", 0x178},
{"KEY_TV", 0x179},
{"KEY_TV2", 0x17a},
@@ -422,6 +429,7 @@ struct parse_event key_events[] = {
{"KEY_ADDRESSBOOK", 0x1ad},
{"KEY_MESSENGER", 0x1ae},
{"KEY_DISPLAYTOGGLE", 0x1af},
+ {"KEY_BRIGHTNESS_TOGGLE", 0x1af},
{"KEY_SPELLCHECK", 0x1b0},
{"KEY_LOGOFF", 0x1b1},
{"KEY_DOLLAR", 0x1b2},
@@ -582,6 +590,7 @@ struct parse_event key_events[] = {
{"BTN_TRIGGER_HAPPY38", 0x2e5},
{"BTN_TRIGGER_HAPPY39", 0x2e6},
{"BTN_TRIGGER_HAPPY40", 0x2e7},
+ {"KEY_MIN_INTERESTING", 113},
{"KEY_MAX", 0x2ff},
{ NULL, 0}
};
The input-event-codes.h now contains lines like: Ensure these parsed correctly. Signed-off-by: Sean Young <sean@mess.org> --- utils/keytable/Makefile.am | 40 +------------ utils/keytable/gen_input_events.pl | 92 ++++++++++++++++++++++++++++++ utils/keytable/parse.h | 9 +++ 3 files changed, 102 insertions(+), 39 deletions(-) create mode 100755 utils/keytable/gen_input_events.pl