blob: b6c6e3728f8d91d74b0b52bfa02cc10bbf1962c2 (
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
#!/bin/bash
# Note that none of the INIT stuff below works in the current open-embedded.
### BEGIN INIT INFO
# Provides: rs9113
# Required-Start: mts-io
# Default-Start: S
# Default-Stop: 0 6
# X-Start-Before: networking
# Short-Description: load the rs9113 drivers
# Description: rs9113 drivers are used to provide access to Bluetooth
# and WiFi.
### END INIT INFO
CONFIG=${CONFIG:-/etc/default/rs9113}
MTS_IODIR=/sys/devices/platform/mts-io
RS9113_RESET=${MTS_IODIR}/wifi-bt-reset
RS9113_INT=${MTS_IODIR}/wifi-bt-int
RS9113_WKUP=${MTS_IODIR}/wifi-bt-lpwkup
[ -f $CONFIG ] || exit 1
. $CONFIG
function rs9113_reset {
for i in {1..5} ; do
if [[ -f $RS9113_RESET ]] ; then
break
fi
done
# Reset the RS9113 chip is ready, and
# wait for it to settle.
for i in {1..5} ; do
if [[ -f $RS9113_RESET ]] ; then
echo 1 >$RS9113_RESET
usleep $SLEEPTIME
echo 0 >$RS9113_RESET
usleep $SLEEPTIME
echo 1 >$RS9113_RESET
else
# No WiFi BT, so exit quietly
exit 0
fi
for j in {0..250} ; do
if /usr/bin/lsusb -d 1618:9113 ; then
break 2
fi
usleep 100000
done
if ((i > 1)) ; then
logger -t rs9113 -p error -s "RS9113 not found after $i resets"
/usr/bin/lsusb | logger -t rs9113 -p error -s
fi
done
}
case "$1" in
start)
if ((RS9113_LOAD == 0)) ; then
# We don't want the driver loaded.
exit 0
fi
rs9113_reset
/usr/bin/logger -t "rs9113" -p info -s "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE"
/usr/sbin/rs9113_load_modules.sh $CONFIG
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
echo "OK"
else
echo "FAIL"
fi
;;
stop)
/usr/bin/logger -t "rs9113" -p info -s "Unloading rs9113 modules"
/usr/sbin/rs9113_remove_modules.sh
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
echo "OK"
else
echo "FAIL"
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
for dir in /sys/class/net/rpine[0-9]* ; do
if [[ -d ${dir} ]] ; then
echo Driver is loaded
exit 0
fi
done
echo Driver is not loaded
exit 3
;;
reset)
rs9113_reset
;;
*)
"Usage: $0 {start|stop|status|restart|reset}"
exit 2
;;
esac
exit 0
|