blob: 8cbf0664c998ee3d11f247875d79addcc6558b13 (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/sbin/runscript
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2
# $Header: /var/cvsroot/gentoo-x86/net-wireless/irda-utils/files/irda.initd,v 1.1 2008/03/22 18:34:11 sbriesen Exp $
# Hint: We don't use start-stop-daemon, because pidfile is the same
# for every irattach instance. So it isn't reliable if we have more
# than one IrDA device (i.e. with IrDA-USB).
depend() {
use serial
}
checkconfig() {
if [ -z "${DEVICE}" ]; then
DEVICE="/dev/ttyS1"
fi
if [ -z "${DONGLE}" -o "${DONGLE}" = "none" ]; then
DONGLE=""
else
DONGLE="-d ${DONGLE}"
fi
if [ "${DISCOVERY}" = "yes" ]; then
DISCOVERY="-s"
else
DISCOVERY=""
fi
NET_IRDA_OPTS=""
# Set maximum baud rate for IrDA
if [ -n "${MAX_BAUD_RATE}" ]; then
NET_IRDA_OPTS="${NET_IRDA_OPTS} net.irda.max_baud_rate=${MAX_BAUD_RATE}"
fi
# Disable discovery (enabling is done automatically by irattach)
if [ -z "${DISCOVERY}" ]; then
NET_IRDA_OPTS="${NET_IRDA_OPTS} net.irda.discovery=0"
fi
# Ensure that SIR driver is loaded (needed for pmac_zilog)
case "${DEVICE}" in
/dev/ttyS*) LOAD_MODULES="${LOAD_MODULES} irtty-sir";;
esac
}
start() {
checkconfig
ebegin "Starting IrDA"
# Needed for some machines in FIR-mode
[ -n "${SETSERIAL}" ] && /bin/setserial ${SETSERIAL} uart none port 0x0 irq 0
# Load IrDA modules
/sbin/modprobe -sqa ircomm-tty ${LOAD_MODULES}
# Set IrDA options
[ -n "${NET_IRDA_OPTS}" ] && /sbin/sysctl -e -q -w ${NET_IRDA_OPTS}
# Finally, attach IrDA device
/usr/sbin/irattach ${DEVICE} ${DONGLE} ${DISCOVERY}
eend ${?}
}
stop() {
ebegin "Shutting down IrDA"
/usr/bin/pkill -f "^/usr/sbin/irattach ${DEVICE} ?"
eend ${?} || return 0 # never fail
}
|