summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/runit-scripts-mv/runitscripts/services/lircd/run
blob: ceda8dbd842ac7d1b8be5be1a08aaa1bc65e6147 (plain)
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
#!/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
                DEVICE="/dev/usb/hiddev0"
  fi
}

function imon_detect {
if [ -e /dev/lirc_imon ]
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
}



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
        ;;
	*) 

		DEVICE=`ls  /dev/lirc[0-9] 2>/dev/null |sort |sed '/./,$!d'|head -n 1 `
		imon_detect
		dvico_detect
	;;
esac

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