summaryrefslogtreecommitdiffstats
path: root/abs/core/runit/runitscripts/services/lircd/run
blob: 4457b376d5523899445469c23210d9df472c4ab2 (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
#!/bin/bash
exec 2>&1
run_lircd2=false
. /etc/systemconfig
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	
	;;

	*) 

		DEVICE=`ls  /dev/lirc[0-9] 2>/dev/null |sort |sed '/./,$!d'|head -n 1 `
		imon_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