blob: bdae3d160a6f93feaab5631c620717ac0c7c7d70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/bin/bash
set -e
INPUT_HEADER="/usr/include/linux/input.h"
LOCAL_INPUT_HEADER="linux-input.h"
OUTPUT_MAPH="linux-input-keycodes.h"
SKIP="KEY_MIN_INTERESTING KEY_MAX KEY_CNT"
if [ ! -e "$LOCAL_INPUT_HEADER" ]; then
if [ ! -e "$INPUT_HEADER" ]; then
echo "Can't find input header: $INPUT_HEADER" >&2
exit 1
fi
cp "$INPUT_HEADER" "$LOCAL_INPUT_HEADER"
fi
cat > "$OUTPUT_MAPH" <<EOF
/* AUTOGENERATED: DO NOT EDIT */
EOF
cat "$LOCAL_INPUT_HEADER" | grep "^#define[[:space:]]*KEY_" | while read DEF NAME VALUE COMMENTS; do
for WORD in $SKIP; do
if [ "$NAME" = "$WORD" ]; then
continue
fi
done
if [ "${VALUE##KEY_}" != "$VALUE" ]; then
ALIAS="true"
else
ALIAS="false"
fi
echo " { \"$NAME\", $NAME, $ALIAS, NULL }," >> "$OUTPUT_MAPH"
done
cat >> "$OUTPUT_MAPH" << EOF
{ NULL, 0, false, NULL }
EOF
exit 0
|