aboutsummaryrefslogtreecommitdiffstats
path: root/openembedded/packages/irda-utils/files/init
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-05-09 18:38:19 +0000
committerRichard Purdie <richard@openedhand.com>2006-05-09 18:38:19 +0000
commitb4cb437c6595ff8ac13506e502fe04b1a60c4e04 (patch)
treef529de217094f1a49049f90c49d779a49e19cd7c /openembedded/packages/irda-utils/files/init
parent3baacb49c13a48798d45e30a0a0076ca0b8c9e6a (diff)
downloadopenembedded-core-b4cb437c6595ff8ac13506e502fe04b1a60c4e04.tar.gz
Merge packages changes from OE into poky.
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@386 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'openembedded/packages/irda-utils/files/init')
-rwxr-xr-xopenembedded/packages/irda-utils/files/init55
1 files changed, 49 insertions, 6 deletions
diff --git a/openembedded/packages/irda-utils/files/init b/openembedded/packages/irda-utils/files/init
index f644e59295..9becfcc0ed 100755
--- a/openembedded/packages/irda-utils/files/init
+++ b/openembedded/packages/irda-utils/files/init
@@ -1,21 +1,64 @@
#! /bin/sh
-DESC=irattach
+module_id() {
+ awk 'BEGIN { FS=": " } /Hardware/ { print $2 } ' </proc/cpuinfo
+}
+
+if [ ! -f /etc/sysconfig/irda ]; then
+
+ case `module_id` in
+ "HP iPAQ H2200" | "HP iPAQ HX4700")
+ IRDA=yes
+ DEVICE=/dev/ttyS2
+ DONGLE=
+ DISCOVERY=
+ ;;
+ *)
+ IRDA=yes
+ DEVICE=/dev/ttyS1
+ DONGLE=
+ DISCOVERY=
+ ;;
+ esac
+
+ mkdir -p /etc/sysconfig
+ echo "IRDA=$IRDA" > /etc/sysconfig/irda
+ if [ $IRDA = "yes" ]; then
+ echo "DEVICE=$DEVICE" >> /etc/sysconfig/irda
+ echo "DONGLE=$DONGLE" >> /etc/sysconfig/irda
+ echo "DISCOVERY=$DISCOVERY" >> /etc/sysconfig/irda
+ fi
+fi
+
+. /etc/sysconfig/irda
+
+# Check that irda is up.
+[ ${IRDA} = "no" ] && exit 0
+
+[ -f /usr/sbin/irattach ] || exit 0
+
+ARGS=
+if [ $DONGLE ]; then
+ ARGS="$ARGS -d $DONGLE"
+fi
+if [ "$DISCOVERY" = "yes" ];then
+ ARGS="$ARGS -s"
+fi
case "$1" in
start)
- echo -n "Starting $DESC: "
- irattach /dev/ttyS1 > /dev/null 2>&1 &
+ echo -n "Starting IrDA: "
+ irattach ${DEVICE} ${ARGS} > /dev/null 2>&1 &
echo "$NAME."
;;
stop)
- echo -n "Stopping $DESC: "
+ echo -n "Stopping IrDA: "
killall irattach > /dev/null 2>&1
echo "$NAME."
;;
restart|force-reload)
- echo -n "Restarting $DESC: "
- irattach /dev/ttyS1 > /dev/null 2>&1 &
+ echo -n "Restarting IrDA: "
+ irattach ${DEVICE} ${ARGS} > /dev/null 2>&1 &
sleep 1
killall irattach > /dev/null 2>&1
echo "$NAME."