From 1a13bb8bdc2d9f727201113e234eecfd868eda03 Mon Sep 17 00:00:00 2001
From: Greg Frost <gregfrost1@bigpond.com>
Date: Sun, 19 Jul 2009 14:34:33 +0930
Subject: runit-scripts: unbork and add Dvico dual4 rev2 support

---
 abs/core-testing/runit-scripts/PKGBUILD            |  2 +-
 .../runit-scripts/runitscripts/services/lircd/run  | 56 +++++++++++++---------
 2 files changed, 35 insertions(+), 23 deletions(-)

diff --git a/abs/core-testing/runit-scripts/PKGBUILD b/abs/core-testing/runit-scripts/PKGBUILD
index 4c84b82..aa26834 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=92
+pkgrel=93
 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 3473fa6..7067b90 100755
--- a/abs/core-testing/runit-scripts/runitscripts/services/lircd/run
+++ b/abs/core-testing/runit-scripts/runitscripts/services/lircd/run
@@ -30,7 +30,7 @@ else
     [ -e /etc/sv/lircd/.runtime ] || mkdir -p /etc/sv/lircd/.runtime
 
     function dvico_detect {
-        if [ x$Remotetype = "xdvico" ]
+        if [ x$Remotetype = "xdvico" ] || [ x$Remotetype = "xDvico-Dual-Digital4-rev2" ]
         then
             RunDvico=true
         else
@@ -46,7 +46,7 @@ else
     if [ x$ReceiverType = xSerial ]
     then
         serial_port=$ReceiverSerialport
-    elid [ x$HostBlasterType = xSerial ]
+    elif [ x$HostBlasterType = xSerial ]
     then
         serial_port=$HostSerialPort_blasterlirc
     fi
@@ -85,11 +85,13 @@ else
         CMD="/usr/sbin/lircd -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 -n  --driver=iguanaIR"
 	printhl "       Using iguanaIR usb"
+echo $CMD
         $CMD >>$LOG 2>>$LOG
     else
         LASTCMD=""
@@ -98,29 +100,39 @@ else
         do
             CMD="/usr/sbin/lircd -d /dev/lirc$i --output=/dev/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 [ $RunDvico = "true" -a $num_lirc -lt 0 ]
-        then
-	    #only run Dvico
-	    LCMD="/usr/sbin/lircd -n -d /dev/usb/dvicoIR --driver=dvico  --output /dev/lircd"
-	    printhl "	Device Dvicio"
-	    exec $LCMD >>$LOG 2>>$LOG
-        elif [ $RunDvico = true -a $num_lirc -gt -1  ]
-        then
-            # Chain them together.
-            i=$((i+1))
-            CMD="/usr/sbin/lircd -d /dev/usb/dvicoIR --driver=dvico  --output=/dev/lircd$i --pidfile=/var/run/lircd$i.pid --listen=876$i"
-            $CMD >> $LOG
-            LASTCMD="--connect=localhost:876$i   $LASTCMD    "
-	    printhl "	Device Dvicio"
-		
-            /usr/sbin/lircd -n -d /dev/lirc0 --output /dev/lircd  $LASTCMD  >>$LOG 2>>$LOG
-        else
-            LCMD="/usr/sbin/lircd -n -d /dev/lirc0 --output /dev/lircd  $LASTCMD"
-            exec $LCMD >>$LOG 2>>$LOG
-        fi
+	if [ $RunDvico = "true" ]
+	then
+	    if [ x$Remotetype = "xdvico" ]
+            then
+                LCMD="/usr/sbin/lircd -n -d /dev/usb/dvicoIR --driver=dvico  --output /dev/lircd"
+            else
+                LCMD="/usr/sbin/lircd -n -d /dev/input/irremote --driver=devinput  --output /dev/lircd"
+            fi
+
+	    if [ $num_lirc -lt 0 ]
+	    then
+		# Only run Dvico
+		printhl "   Device $Remotetype"
+echo $LCMD
+            	exec $LCMD >>$LOG 2>>$LOG
+	    elif [ $num_lirc -gt -1  ]
+	    then
+                i=$((i+1))
+                CMD="$LCMD --output=/dev/lircd$i --pidfile=/var/run/lircd$i.pid --listen=876$i"
+                $CMD >> $LOG
+                LASTCMD="--connect=localhost:876$i   $LASTCMD    "
+	        printhl "	Device Dvico"
+		/usr/sbin/lircd -n -d /dev/lirc0 --output /dev/lircd  $LASTCMD  >>$LOG 2>>$LOG
+	    fi
+	else
+	    LCMD="/usr/sbin/lircd -n -d /dev/lirc0 --output /dev/lircd  $LASTCMD"
+echo $LCMD
+     	    exec $LCMD >>$LOG 2>>$LOG
+	fi
     fi
 fi
-- 
cgit v0.12