diff options
author | James Meyer <james.meyer@operamail.com> | 2012-04-23 21:12:08 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2012-04-23 21:12:08 (GMT) |
commit | 4bc7351abd5eae587f2f01dc349329ac29fd8b17 (patch) | |
tree | b3c8eec80ccb1e73e9a15ebf7be3f79a44083e50 /abs/core/runit-scripts/runitscripts/services/remotes | |
parent | df3c3c139d7eedad4ab8be383c66a5518322157c (diff) | |
parent | 8c0d396181e43158de3f54c479456ca7ed052248 (diff) | |
download | linhes_pkgbuild-4bc7351abd5eae587f2f01dc349329ac29fd8b17.zip linhes_pkgbuild-4bc7351abd5eae587f2f01dc349329ac29fd8b17.tar.gz linhes_pkgbuild-4bc7351abd5eae587f2f01dc349329ac29fd8b17.tar.bz2 |
Merge branch 'testing' of git@linhes.org:linhes_pkgbuild into testing
Diffstat (limited to 'abs/core/runit-scripts/runitscripts/services/remotes')
-rwxr-xr-x | abs/core/runit-scripts/runitscripts/services/remotes/finish | 8 | ||||
-rwxr-xr-x | abs/core/runit-scripts/runitscripts/services/remotes/run | 173 |
2 files changed, 87 insertions, 94 deletions
diff --git a/abs/core/runit-scripts/runitscripts/services/remotes/finish b/abs/core/runit-scripts/runitscripts/services/remotes/finish index ac04a33..c1a5554 100755 --- a/abs/core/runit-scripts/runitscripts/services/remotes/finish +++ b/abs/core/runit-scripts/runitscripts/services/remotes/finish @@ -4,6 +4,9 @@ export TERM=linux . /etc/rc.d/functions . /usr/MythVantage/bin/install_functions.sh +LOG=/tmp/remotes.log +echo "`date` --- finish started" >> $LOG + killall -9 lircd 2>/dev/null rm -f /var/run/lirc*.pid [ -e /etc/sv/remotes/.runtime ] || mkdir -p /etc/sv/remotes/.runtime @@ -12,10 +15,11 @@ numfiles=`/usr/bin/file_time_offset.py -s4 -d/etc/sv/remotes/.runtime ` if [ $numfiles -gt 3 ] then rm -f /etc/sv/remotes/.runtime/* 2>/dev/null - sv stop remotes + sv stop remotes >> $LOG printhl " remotes is not able to start, disabling it" + echo " remotes is not able to start, disabling it" >> $LOG fi - +echo "Enable in kernel remote driver" >> $LOG in_kernel_support "enable" diff --git a/abs/core/runit-scripts/runitscripts/services/remotes/run b/abs/core/runit-scripts/runitscripts/services/remotes/run index d32b09e..35d3f80 100755 --- a/abs/core/runit-scripts/runitscripts/services/remotes/run +++ b/abs/core/runit-scripts/runitscripts/services/remotes/run @@ -14,112 +14,101 @@ then rm -f $LOG fi +echo "`date` --- run started" >> $LOG +. /etc/systemconfig +stat_runit "Starting remotes" +[ -e /etc/sv/remotes/.runtime ] || mkdir -p /etc/sv/remotes/.runtime +[ -e /var/run/lirc ] || mkdir -p /var/run/lirc -#What is done in this file may not be enough to start your specific remote -#If that is true of your remote place your remote startup commands in: -# /etc/remotes.sh -#Anything in that file will be used and the rest of this file is ignored +num_lirc=`ls -la /dev/lirc[0-9] 2>/dev/null |wc -l ` +num_lirc=$((num_lirc-1)) -if [ -f /etc/remotes.sh ] +serial_port="" + +if [ x$ReceiverType = xSerial ] +then + serial_port=$ReceiverSerialport +elif [ x$HostBlasterType = xSerial ] then - #program must not terminate. + serial_port=$HostSerialPort_blasterlirc +fi - stat_runit "Starting remotes from /etc/remotes.sh" +if [ -n "$serial_port" ] +then + #/dev/ttyS0 (COM1), port 0x3f8, irq 4 + #/dev/ttyS1 (COM2), port 0x2f8, irq 3 + #/dev/ttyS2 (COM3), port 0x3e8, irq 4 + #/dev/ttyS3 (COM4), port 0x2e8, irq 3 + + case $serial_port in + ttyS0) + FLAGS="io=0x3f8 irq=4" + ;; + ttyS1) + FLAGS="io=0x2f8 irq=3" + ;; + ttyS2) + FLAGS="io=0x3e8 irq=4" + ;; + ttyS3) + FLAGS="io=0x2e8 irq=3" + ;; + esac + /usr/bin/setserial /dev/$serial_port uart none + sleep 0.5 + /sbin/modprobe lirc_serial $FLAGS + sleep 0.5 +fi - /etc/remotes.sh +if [ x$HostBlasterType = xCommandIR -o x$ReceiverType = xCommandIR ] +then + CMD="/usr/sbin/lircd -r -n --driver=commandir" + printhl " Using commandir" + echo $CMD >>$LOG + exec $CMD >>$LOG 2>>$LOG +elif [ x$HostBlasterType = xiguanaIR-usb -o x$ReceiverType = xiguanaIR-usb ] +then + sv start igdaemon + CMD="/usr/sbin/lircd -r -n --driver=iguanaIR" + printhl " Using iguanaIR usb" + echo $CMD >>$LOG + exec $CMD >>$LOG 2>>$LOG +elif [ x$ReceiverType = "xSiliconDust_HDHR" ] +then + # if using the SiliconDust_HDHR as an I/R Receiver + CMD="/usr/sbin/lircd -H udp -d 5000 -n" + printhl " Using SiliconDust on port 5000" + echo $CMD >>$LOG + exec $CMD >>$LOG 2>>$LOG else - . /etc/systemconfig - stat_runit "Starting remotes" - - [ -e /etc/sv/remotes/.runtime ] || mkdir -p /etc/sv/remotes/.runtime - [ -e /var/run/lirc ] || mkdir -p /var/run/lirc - - num_lirc=`ls -la /dev/lirc[0-9] 2>/dev/null |wc -l ` - num_lirc=$((num_lirc-1)) + LASTCMD="" - serial_port="" + for i in `seq 1 $num_lirc` + do + CMD="/usr/sbin/lircd -r -d /dev/lirc$i --output=/var/run/lirc/lircd$i --pidfile=/var/run/lircd$i.pid --listen=876$i" + printhl " Device $i" + echo $CMD >>$LOG + exec $CMD >>$LOG 2>>$LOG + LASTCMD="--connect=localhost:876$i $LASTCMD " + done - if [ x$ReceiverType = xSerial ] - then - serial_port=$ReceiverSerialport - elif [ x$HostBlasterType = xSerial ] - then - serial_port=$HostSerialPort_blasterlirc - fi + echo $LASTCMD >>$LOG - if [ -n "$serial_port" ] + if [ -f /etc/remote.run ] then - #/dev/ttyS0 (COM1), port 0x3f8, irq 4 - #/dev/ttyS1 (COM2), port 0x2f8, irq 3 - #/dev/ttyS2 (COM3), port 0x3e8, irq 4 - #/dev/ttyS3 (COM4), port 0x2e8, irq 3 - - case $serial_port in - ttyS0) - FLAGS="io=0x3f8 irq=4" - ;; - ttyS1) - FLAGS="io=0x2f8 irq=3" - ;; - ttyS2) - FLAGS="io=0x3e8 irq=4" - ;; - ttyS3) - FLAGS="io=0x2e8 irq=3" - ;; - esac - /usr/bin/setserial /dev/$serial_port uart none - sleep 0.5 - /sbin/modprobe lirc_serial $FLAGS - sleep 0.5 - fi + #program must not terminate. - if [ x$HostBlasterType = xCommandIR -o x$ReceiverType = xCommandIR ] - then - CMD="/usr/sbin/lircd -r -n --driver=commandir" - printhl " Using commandir" - $CMD >>$LOG 2>>$LOG - #echo $CMD - elif [ x$HostBlasterType = xiguanaIR-usb -o x$ReceiverType = xiguanaIR-usb ] - then - sv start igdaemon - CMD="/usr/sbin/lircd -r -n --driver=iguanaIR" - printhl " Using iguanaIR usb" - #echo $CMD - $CMD >>$LOG 2>>$LOG - elif [ x$ReceiverType = "xSiliconDust_HDHR" ] - then - # if using the SiliconDust_HDHR as an I/R Receiver - printhl " Using SiliconDust on port 5000" - CMD="/usr/sbin/lircd -H udp -d 5000 -n" - exec $CMD >>$LOG 2>>$LOG + stat_runit "Starting remotes from /etc/remote.run" + echo "Starting remotes from /etc/remote.run" >>$LOG + exec /etc/remote.run $LASTCMD >>$LOG 2>>$LOG else - LASTCMD="" - - for i in `seq 1 $num_lirc` - do - CMD="/usr/sbin/lircd -r -d /dev/lirc$i --output=/var/run/lirc/lircd$i --pidfile=/var/run/lircd$i.pid --listen=876$i" - printhl " Device $i" - #echo $CMD - $CMD >>$LOG 2>>$LOG - LASTCMD="--connect=localhost:876$i $LASTCMD " - done - - if [ -f /etc/remote.run ] - then - #program must not terminate. - - stat_runit "Starting remotes from /etc/remote.run" - - /etc/remote.run - else - in_kernel_support "disable" - LCMD="/usr/sbin/lircd -r -n -d /dev/lirc0 --output /var/run/lirc/lircd $LASTCMD" - #echo $LCMD - exec $LCMD >>$LOG 2>>$LOG - fi + echo "Disable in kernel remote driver" >>$LOG + in_kernel_support "disable" + LCMD="/usr/sbin/lircd -r -n -d /dev/lirc0 --output /var/run/lirc/lircd $LASTCMD" + echo $LCMD >>$LOG + exec $LCMD >>$LOG 2>>$LOG fi fi |