summaryrefslogtreecommitdiffstats
path: root/meta/packages/irda-utils/files
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/irda-utils/files')
-rwxr-xr-xmeta/packages/irda-utils/files/init72
1 files changed, 72 insertions, 0 deletions
diff --git a/meta/packages/irda-utils/files/init b/meta/packages/irda-utils/files/init
new file mode 100755
index 0000000000..9becfcc0ed
--- /dev/null
+++ b/meta/packages/irda-utils/files/init
@@ -0,0 +1,72 @@
1#! /bin/sh
2
3module_id() {
4 awk 'BEGIN { FS=": " } /Hardware/ { print $2 } ' </proc/cpuinfo
5}
6
7if [ ! -f /etc/sysconfig/irda ]; then
8
9 case `module_id` in
10 "HP iPAQ H2200" | "HP iPAQ HX4700")
11 IRDA=yes
12 DEVICE=/dev/ttyS2
13 DONGLE=
14 DISCOVERY=
15 ;;
16 *)
17 IRDA=yes
18 DEVICE=/dev/ttyS1
19 DONGLE=
20 DISCOVERY=
21 ;;
22 esac
23
24 mkdir -p /etc/sysconfig
25 echo "IRDA=$IRDA" > /etc/sysconfig/irda
26 if [ $IRDA = "yes" ]; then
27 echo "DEVICE=$DEVICE" >> /etc/sysconfig/irda
28 echo "DONGLE=$DONGLE" >> /etc/sysconfig/irda
29 echo "DISCOVERY=$DISCOVERY" >> /etc/sysconfig/irda
30 fi
31fi
32
33. /etc/sysconfig/irda
34
35# Check that irda is up.
36[ ${IRDA} = "no" ] && exit 0
37
38[ -f /usr/sbin/irattach ] || exit 0
39
40ARGS=
41if [ $DONGLE ]; then
42 ARGS="$ARGS -d $DONGLE"
43fi
44if [ "$DISCOVERY" = "yes" ];then
45 ARGS="$ARGS -s"
46fi
47
48case "$1" in
49 start)
50 echo -n "Starting IrDA: "
51 irattach ${DEVICE} ${ARGS} > /dev/null 2>&1 &
52 echo "$NAME."
53 ;;
54 stop)
55 echo -n "Stopping IrDA: "
56 killall irattach > /dev/null 2>&1
57 echo "$NAME."
58 ;;
59 restart|force-reload)
60 echo -n "Restarting IrDA: "
61 irattach ${DEVICE} ${ARGS} > /dev/null 2>&1 &
62 sleep 1
63 killall irattach > /dev/null 2>&1
64 echo "$NAME."
65 ;;
66 *)
67 N=/etc/init.d/$NAME
68 echo "Usage: $N {start|stop|restart|force-reload}" >&2
69 exit 1
70 ;;
71esac
72