diff options
Diffstat (limited to 'abs/core-testing/runit-scripts')
-rwxr-xr-x | abs/core-testing/runit-scripts/PKGBUILD | 2 | ||||
-rwxr-xr-x | abs/core-testing/runit-scripts/runitscripts/services/lircd/run | 138 |
2 files changed, 93 insertions, 47 deletions
diff --git a/abs/core-testing/runit-scripts/PKGBUILD b/abs/core-testing/runit-scripts/PKGBUILD index 619cfcf..4364e15 100755 --- a/abs/core-testing/runit-scripts/PKGBUILD +++ b/abs/core-testing/runit-scripts/PKGBUILD @@ -1,6 +1,6 @@ pkgname=runit-scripts pkgver=1.8.0 -pkgrel=39 +pkgrel=40 pkgdesc="collection of startup scripts for runit" url="http://smarden.org/runit/" license="BSD" diff --git a/abs/core-testing/runit-scripts/runitscripts/services/lircd/run b/abs/core-testing/runit-scripts/runitscripts/services/lircd/run index 46b850d..242dcb3 100755 --- a/abs/core-testing/runit-scripts/runitscripts/services/lircd/run +++ b/abs/core-testing/runit-scripts/runitscripts/services/lircd/run @@ -1,54 +1,100 @@ #!/bin/bash exec 2>&1 -run_lircd2=false -. /etc/systemconfig -[ -e /etc/sv/lircd/.runtime ] || mkdir -p /etc/sv/lircd/.runtime - -function dvico_detect { - - - if [ x$Remotetype = "xdvico" ] - then - #assume if using dvico remote then dvico receiver is used. - DEVICE="/dev/usb/hiddev0 --driver=dvico" - fi -} - -function imon_detect { -if [ -e /dev/lirc_imon ] +#since what we do may not be enough +#if your one of those people, this is where you place your stuff +if [ -f /etc/runit/lirc.sh ] then -lircd2_cmd="/usr/sbin/lircd -d /dev/lirc_imon --output=/dev/lircd --pidfile=/var/run/lircd2.pid --connect=localhost:8765" -run_lircd2=true -fi -} + #program must not terminate. + /etc/runit/lirc.sh +else + . /etc/systemconfig + [ -e /etc/sv/lircd/.runtime ] || mkdir -p /etc/sv/lircd/.runtime + function dvico_detect { + if [ x$Remotetype = "xdvico" ] + then + RunDvico=true + else + RunDvico=false + fi + } + num_lirc=`ls -la /dev/lirc[0-9] |wc -l` + num_lirc=$((num_lirc-1)) + echo $num_lirc -case $ReceiverType in - Serial) - /usr/bin/setserial /dev/$ReceiverSerialport uart none - /sbin/modprobe lirc_serial - DEVICE=`ls /dev/lirc[0-9] 2>/dev/null |sort |sed '/./,$!d'|head -n 1 ` - imon_detect - ;; - Usb-imon) - DEVICE=/dev/lirc_imon - ;; - Hauppauge) - DEVICE=/dev/lirc3 - ;; - *) + #/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 + if [ x$ReceiverType = xSerial ] + then + case $ReceiverSerialport in + ttyS0) + FLAGS="io=0x3f8 irq=4" + ;; + ttyS1) + FLAGS="io=0x2f8 irq=3" + ;; + ttyS2) + FLAGS="io=0x3e8 irq=4" + ;; + ttyS3) + FLAGS="io=0x2f8 irq=3" + ;; + esac + /usr/bin/setserial /dev/$ReceiverSerialport uart none + /sbin/modprobe lirc_serial $FLAGS + fi + if [ x$HostBlasterType = xSerial ] + then + case $HostSerialPort_blasterlirc in + ttyS0) + FLAGS="io=0x3f8 irq=4" + ;; + ttyS1) + FLAGS="io=0x2f8 irq=3" + ;; + ttyS2) + FLAGS="io=0x3e8 irq=4" + ;; + ttyS3) + FLAGS="io=0x2f8 irq=3" + ;; + esac + /usr/bin/setserial /dev/$ReceiverSerialport uart none + /sbin/modprobe lirc_serial $FLAGS + fi - DEVICE=`ls /dev/lirc[0-9] 2>/dev/null |sort |sed '/./,$!d'|head -n 1 ` - imon_detect - dvico_detect - ;; -esac + dvico_detect -if [ "$run_lircd2" = "true" ] -then - $lircd2_cmd 2>/dev/null 1>/dev/null - exec /usr/sbin/lircd -n -d $DEVICE --output /dev/lircd1 --listen 2>/dev/null 1>/dev/null -else - exec /usr/sbin/lircd -n -d $DEVICE 2>/dev/null 1>/dev/null -fi + + LASTCMD="" + for i in `seq 1 $num_lirc` + do + CMD="/usr/sbin/lircd -d /dev/lirc$i --output=/dev/lircd$i --pidfile=/var/run/lircd$i.pid --listen=876$i" + echo $CMD + $CMD + LASTCMD="--connect=localhost:876$i $LASTCMD " + done + if [ $RunDvico = "true" -a $num_lirc -lt 0 ] + then + #only run dvicio + LCMD="/usr/sbin/lircd -n -d /dev/usb/hiddev0 --driver=dvico --output /dev/lircd" + echo $LCMD + exec $LCMD + elif [ $RunDvico = true -a $num_lirc -gt -1 ] + then + #chain them together + i=$((i+1)) + CMD="/usr/sbin/lircd -d /dev/usb/hiddev0 --driver=dvico --output=/dev/lircd$i --pidfile=/var/run/lircd$i.pid --listen=876$i" + echo $CMD + $CMD + LASTCMD="--connect=localhost:876$i $LASTCMD " + /usr/sbin/lircd -n -d /dev/lirc0 --output /dev/lircd $LASTCMD + else + LCMD="/usr/sbin/lircd -n -d /dev/lirc0 --output /dev/lircd $LASTCMD" + echo $LCMD + exec $LCMD + fi +fi
\ No newline at end of file |