-
Notifications
You must be signed in to change notification settings - Fork 4
/
quantenna.init
63 lines (51 loc) · 1.19 KB
/
quantenna.init
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
#!/bin/sh /etc/rc.common
START=99
QCS_CALL="/usr/bin/call_qcsapi_sockrpc --host 1.1.1.2"
LED_GREEN="/sys/class/leds/h500-s:green:wifi/brightness"
check_qtn_ready(){
local is_startprod_done iter
iter=0
is_startprod_done=`$QCS_CALL is_startprod_done`
while [[ "$is_startprod_done" != "1" ]] ; do
is_startprod_done=`$QCS_CALL is_startprod_done`
if [[ "$is_startprod_done" == "0" ]] ; then
echo "start Quantenna wifi"
$QCS_CALL startprod
fi
if [ $iter == 30 ]; then
echo "QTN SoC is not ready yet..."
sleep $iter
else
sleep 2
iter=$((iter+1))
fi
done
}
check_rf_ready(){
local is_rf_done iter
iter=0
is_rf_done=`$QCS_CALL rfstatus`
while [[ "$is_rf_done" != "On" ]] ; do
is_rf_done=`$QCS_CALL rfstatus`
sleep 1
if [[ "$is_rf_done" == "Turning off" ]] ; then
echo "wifi disable"
$QCS_CALL rfenable 0
sleep 2
elif [[ "$is_rf_done" == "Off" ]] ; then
echo "wifi enable"
$QCS_CALL rfenable 1
sleep 3
fi
done
}
start() {
check_qtn_ready
check_rf_ready
/bin/echo 1 > $LED_GREEN
$QCS_CALL set_channel wifi0 44
echo "Quantenna job done"
}
stop() {
$QCS_CALL do_system_action reboot
}