5 # "/usr/include/linux/input.h
7 our (%strs, %checkunique, %tabaliases, %evtypes);
20 foreach $t (qw(EV BUS)) {
23 foreach $t (qw(KEY REL ABS MSC LED)) {
26 $tabaliases{'BTN'}= 'KEY';
28 our ($tab,$str,$val,$s);
31 if (m/^\#define (\w+)_(\w+)\s+(0|[1-9]\d+|0x[0-9a-f]+)\s*$/) {
32 ($tab,$str,$val)=($1,$2, eval $3);
33 next if "${tab}_${str}" =~
34 m/^BTN_(?:MISC|MOUSE|JOYSTICK|GAMEPAD|DIGI)$|^EV_VERSION$/;
35 next if $str eq 'MAX';
36 $t= $tabaliases{$tab} || $tab;
39 die "$tab $str $val" if defined $s->[$val];
40 $s->[$val]= [ $tab, $str ];
42 die "$tab $str $val" if $checkunique{$t}{"$tab $str"}++;
46 our ($i,$iesis,$ien,$n,$si);
50 const char *prefix, *main;
51 } InputEventStringInfo;
55 const InputEventStringInfo *strings;
56 InputEventState **states;
63 printf " /* %4d %#6x */ ", $i,$i or die $!;
66 for $t (sort keys %strs) {
73 static const int \L$ien\E= $n;
74 static const InputEventStringInfo ${iesis}[$ien] = {
77 for ($i=0; $i<@$s; $i++) {
81 printf " { %10s %-25s },\n", "\"$si->[0]\",", "\"$si->[1]\""
93 static InputEventState *iess_\L$t\E[$ien];
96 if exists $evtypes{$t};
99 for $tab (sort keys %tabaliases) {
100 $t= $tabaliases{$tab};
102 #define IEN_${tab} IEN_${t}
103 #define iesis_\L${tab} iesis_${t}
104 #define iess_\L${tab} iess_${t}
112 static const InputEventTypeInfo ietis[IETIN]= {
118 for ($i=0; $i<@$s; $i++) {
120 $tab= defined $si ? $si->[1] : undef;
121 $tab= $tab && exists $evtypes{$tab} ? $tab : undef;
122 @sip= $tab ? ("IEN_$tab", "iesis_\L$tab", "iess_\L$tab") : (-1, 0, 0);
124 printf " { %-16s %-15s %-15s },\n", "$sip[0],", "$sip[1],", $sip[2],