/usr/bin/lirc-make-devinput is in lirc 0.9.4c-9.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | #!/usr/bin/env bash
function help()
{
cat << EOF
Usage: devinput.sh [-i] [input.h path] > outfile
devinput.sh parses a linux input.h header file and produces a
lircd.conf file for the devinput driver tailored for the local
system. Using the -i option, it produces an internal format
used when building lirc.
input.h path defaults to /usr/include/linux/input.h, often in
the kernel-headers package.
EOF
}
# Use gnu-sed on Macosx
if test "`uname`" = 'Darwin'; then
SED=gsed
else
SED=sed
fi
lirc_map=''
if [[ "$1" = '-h' || "$1" = '--help' ]]; then
help
exit 0
elif [[ "$1" = -i ]]; then
lirc_map="true"
shift
fi
readonly TYPES="KEY BTN"
if test -e "/usr/include/linux/input-event-codes.h"; then
readonly file=${1:-/usr/include/linux/input-event-codes.h}
else
readonly file=${1:-/usr/include/linux/input.h}
fi
tmpfile=$( mktemp )
if ! test -f $file; then
echo "Cannot access $file. Giving up" >&2
exit 1
fi
for type in $TYPES; do
grep "^#define ${type}_" < $file | \
sort | \
$SED -ne "s/^#define \([^ \t]*\)[ \t][ \t]*\([0-9][0-9a-fA-FxX]*\).*/{\"\1\", \2},/p"
done > $tmpfile
if test -n "$lirc_map"; then
cat $tmpfile
rm -f $tmpfile
exit 0
fi
echo "# Generated by $(basename $0) on $(uname -r)"
echo "# Date: $(date)"
cat <<EOF
begin remote
name devinput-64
bits 16
eps 30
aeps 100
pre_data_bits 16
pre_data 0x0001
post_data_bits 32
post_data 0x00000001
gap 132799
toggle_bit 0
driver devinput
begin codes
EOF
sed "s/^{\"\([^\"]*\)\", \(.*\)},/ \1 \2/" <$tmpfile
cat <<EOF
end codes
end remote
EOF
echo
echo "# generated by $(basename $0) (obsolete 32 bit version)"
cat <<EOF
begin remote
name devinput-32
bits 16
eps 30
aeps 100
pre_data_bits 16
pre_data 0x8001
gap 132799
toggle_bit 0
driver devinput
begin codes
EOF
sed "s/^{\"\([^\"]*\)\", \(.*\)},/ \1 \2/" < $tmpfile
cat <<EOF
end codes
end remote
EOF
rm -f $tmpfile
|