summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/init
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/init')
-rwxr-xr-xmeta/recipes-connectivity/irda-utils/irda-utils-0.9.18/init78
1 files changed, 78 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/init b/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/init
new file mode 100755
index 0000000..6f29e9c
--- /dev/null
+++ b/meta/recipes-connectivity/irda-utils/irda-utils-0.9.18/init
@@ -0,0 +1,78 @@
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides: irda
4# Required-Start: $network $remote_fs
5# Required-Stop: $network $remote_fs
6# Default-Start: 2 3 4 5
7# Default-Stop: 0 1 6
8# Short-Description: Infrared port support
9### END INIT INFO
10
11NAME="irattach"
12test -x "$IRDA_DAEMON" || IRDA_DAEMON=/usr/sbin/irattach
13test -z "$IRATTACH_PID" && IRATTACH_PID=/var/run/irattach.pid
14
15# Source function library.
16. /etc/init.d/functions
17
18module_id() {
19 awk 'BEGIN { FS=": " } /Hardware/ { print $2 } ' </proc/cpuinfo
20}
21
22if [ ! -f /etc/sysconfig/irda ]; then
23 case `module_id` in
24 "HP iPAQ H2200" | "HP iPAQ HX4700" | "HTC Universal")
25 IRDA=yes
26 DEVICE=/dev/ttyS2
27 DONGLE=
28 DISCOVERY=
29 ;;
30 *)
31 IRDA=yes
32 DEVICE=/dev/ttyS1
33 DONGLE=
34 DISCOVERY=
35 ;;
36 esac
37else
38 . /etc/sysconfig/irda
39fi
40
41# Check that irda is up.
42[ ${IRDA} = "no" ] && exit 0
43
44[ -f /usr/sbin/irattach ] || exit 0
45
46ARGS=
47if [ $DONGLE ]; then
48 ARGS="$ARGS -d $DONGLE"
49fi
50if [ "$DISCOVERY" = "yes" ];then
51 ARGS="$ARGS -s"
52fi
53
54case "$1" in
55 start)
56 echo -n "Starting IrDA: $NAME"
57 start-stop-daemon --start --quiet --exec "$IRDA_DAEMON" ${DEVICE} ${ARGS} --pidfile "$IRATTACH_PID"
58 sleep 1
59 [ -f /var/run/irattach.pid ] && echo " done" || echo " fail"
60 ;;
61 stop)
62 echo "Stopping IrDA: $NAME"
63 start-stop-daemon --stop --quiet --exec "$IRDA_DAEMON" --pidfile "$IRATTACH_PID"
64 ;;
65 restart|force-reload)
66 $0 stop
67 $0 start
68 ;;
69 status)
70 status irattach
71 exit $?
72 ;;
73 *)
74 N=/etc/init.d/$NAME
75 echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
76 exit 1
77 ;;
78esac