Little fix.
[irreco.git] / lirc-0.8.4a / contrib / irman2lirc
blob225d1925185634afd1bba279de31dba3306f0f6f
1 #! /bin/sh
3 progname=irman2lirc
5 if [ "$1" = "--help" ]; then
6 echo "${progname}: converts irman.conf to lirc config file"
7 echo
8 echo "usage: ${progname} [file]"
9 echo " where \`file' is the full file name of your irman.conf"
10 echo " (default /usr/local/etc/irman.conf)"
11 exit 0
14 irmanconf=${1:-/usr/local/etc/irman.conf}
15 if [ ! -f ${irmanconf} ]; then
16 echo "cannot find ${irmanconf}. try ${progname} --help"
17 exit 1;
20 echo "# lircd.conf automatically generated by ${progname}"
21 cat <<EOF
23 # brand: Irman
24 # model: All models
25 EOF
27 echo "# devices: remotes from ${irmanconf}"
28 grep bind ${irmanconf} | sed 's/^[ \t]*bind[ \t]\+\([^- \t]\+-[^-]\+\)-.*$/\1/' |
29 sort | uniq | sed 's/^/# /'
31 cat <<EOF
34 begin remote
36 name irman
37 bits 48
38 flags SPACE_ENC
39 eps 30
40 aeps 100
41 one 1024 3072
42 zero 1024 2048
43 ptrail 1024
44 pre_data_bits 16
45 pre_data 0xffff
46 post_data_bits 0
47 post_data 0x0
48 gap 65536
49 repeat_bit 0
51 begin codes
53 EOF
55 IFS=" "
56 grep '^[ ]*bind' ${irmanconf} |
57 while
58 read bind name code
60 if [ "x$bind" = "xbind" -a -n "$code" -a -n "$name" ]; then
61 code=`echo "${code}000000000000" | cut -c1-12`
62 echo " ${name} 0x0000${code}"
64 done
66 cat <<EOF
68 end codes
70 end remote
71 EOF