aboutsummaryrefslogtreecommitdiffstats
path: root/lirc.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lirc.sh')
-rwxr-xr-xlirc.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/lirc.sh b/lirc.sh
index 2aec1fd..ec0aa1d 100755
--- a/lirc.sh
+++ b/lirc.sh
@@ -1,6 +1,14 @@
#!/bin/sh
-INPUT="/usr/include/linux/input.h"
-cat <<EOF
+
+OUT="${1-lircd.conf}"
+
+if test -f "/usr/include/linux/input-event-codes.h"
+then
+ INPUT="/usr/include/linux/input-event-codes.h"
+else
+ INPUT="/usr/include/linux/input.h"
+fi
+cat <<EOF > "$OUT"
begin remote
name linux-input-layer
bits 32
@@ -12,8 +20,8 @@ awk "
/#define (KEY|BTN)_/ { gsub(/KEY_/,\"\",\$2);
printf(\"\t\t%-20s 0x%04x\n\",
\$2,0x10000+strtonum(\$3)) }
-" < $INPUT
-cat <<EOF
+" < $INPUT >> "$OUT"
+cat <<EOF >> "$OUT"
end codes
end remote
EOF