irda-utils/irda.init

80 lines
1.5 KiB
Bash

#!/bin/sh
#
# irda This shell script takes care of starting and stopping
# IrDA support
#
# chkconfig: - 45 24
# description: IrDA(TM) (Infrared Data Association) is an industry standard \
# for wireless, infrared communication between devices. IrDA speeds range \
# from 9600 bps to 4 Mbps, and IrDA can be used by many modern devices \
# including laptops, LAN adapters, PDAs, printers, and mobile phones.
#
# Source function library.
. /etc/rc.d/init.d/functions
# Source IrDA networking configuration.
. /etc/sysconfig/irda
# Check that irda is up.
[ ${IRDA} = "no" ] && exit 6
[ -f /usr/sbin/irattach ] || exit 5
args=
[ -n "$DONGLE" ] && args="$args -d $DONGLE"
[ "$DISCOVERY" = "yes" ] && args="$args -s"
RETVAL=0
start() {
echo -n $"Starting IrDA: "
/sbin/modprobe ircomm-tty 2>/dev/null
/sbin/modprobe irtty-sir 2>/dev/null
/sbin/modprobe irnet 2>/dev/null
daemon /usr/sbin/irattach ${DEVICE} ${args}
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/irda
echo
}
stop() {
echo -n $"Shutting down IrDA: "
killproc irattach
RETVAL=$?
rm -f /var/lock/subsys/irda
echo
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status irattach
RETVAL=$?
;;
restart|reload|force-reload)
restart
;;
condrestart|try-restart)
[ -f /var/lock/subsys/irda ] && restart
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
exit 3
esac
exit $RETVAL