blob: b453605631c7dc4a36c608e1e567f30d2a2ffd35 (
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
#!/system/bin/sh
module_path_bcmdhd=/pcba/lib/modules/rkwifi/bcmdhd/bcmdhd.ko
module_path_8188eu=/pcba/lib/modules/rtl8188eu/8188eu.ko
module_path_8723bu=/pcba/lib/modules/rtl8723bu/8723bu.ko
module_path_8723bs=/pcba/lib/modules/rtl8723bs/8723bs.ko
module_path_8723cs=/pcba/lib/modules/rtl8723cs/8723cs.ko
module_path_8723ds=/pcba/lib/modules/rtl8723ds/8723ds.ko
module_path_8188fu=/pcba/lib/modules/rtl8188fu/8188fu.ko
module_path_8822bs=/pcba/lib/modules/rtl8822bs/8822bs.ko
module_path_8189es=/pcba/lib/modules/rtl8189es/8189es.ko
module_path_8189fs=/pcba/lib/modules/rtl8189fs/8189fs.ko
result_file=/data/scan_result.txt
result_file2=/data/scan_result2.txt
chip_type_path=/data/wifi_chip
driver_node=/sys/class/rkwifi/driver
pcba_node=/sys/class/rkwifi/pcba
version_path=/proc/version
module_path=$module_path_wlan
chip_broadcom=false
driver_buildin=false
interface_up=true
version=.3.0.36+
mt5931_kitkat=false
android_kitkat=false
jmax=3
if cat $chip_type_path | grep AP; then
module_path=$module_path_bcmdhd
chip_broadcom=true
echo 1 > $pcba_node
fi
if cat $chip_type_path | grep RTL8188EU; then
jmax=6
module_path=$module_path_8188eu
fi
if cat $chip_type_path | grep RTL8723AU; then
module_path=$module_path_8723bu
fi
if cat $chip_type_path | grep RTL8723BS; then
module_path=$module_path_8723bs
fi
if cat $chip_type_path | grep RTL8723CS; then
module_path=$module_path_8723cs
fi
if cat $chip_type_path | grep RTL8723DS; then
module_path=$module_path_8723ds
fi
if cat $chip_type_path | grep RTL8188FU; then
jmax=6
module_path=$module_path_8188fu
fi
if cat $chip_type_path | grep RTL8822BS; then
module_path=$module_path_8822bs
fi
if cat $chip_type_path | grep RTL8189ES; then
module_path=$module_path_8189es
fi
if cat $chip_type_path | grep RTL8189FS; then
module_path=$module_path_8189fs
fi
if cat $version_path | grep 3.0.36+; then
echo "kernel version 3.0.36+"
if [ -e $module_path$version ]; then
module_path=$module_path$version
fi
fi
if ls /dev/wmtWifi | grep wmtWifi; then
echo "mt5931_kitkat=true"
mt5931_kitkat=true
fi
if ifconfig wlan0; then
echo "android_kitkat=true"
android_kitkat=true
fi
#if ls $driver_node; then
# echo "wifi driver is buildin"
# driver_buildin=true
#fi
echo "touch $result_file"
touch $result_file
j=0
echo "get scan results"
while [ $j -lt $jmax ];
do
echo "insmod wifi driver"
if [ $mt5931_kitkat = "true" ]; then
echo "echo 1 > /dev/wmtWifi"
echo 1 > /dev/wmtWifi
else
if [ $android_kitkat = "false" ]; then
if [ $driver_buildin = "true" ]; then
echo "echo 1 > $driver_node"
echo 1 > "$driver_node"
else
echo "insmod $module_path"
insmod "$module_path"
fi
fi
fi
if [ $? -ne 0 ]; then
echo "insmod failed"
exit 0
fi
echo "sleep 3s"
sleep 3
if ifconfig wlan0; then
if [ $interface_up = "true" ]; then
ifconfig wlan0 up
fi
#if [ $? -ne 0 ]; then
# echo "ifconfig wlan0 up failed"
# exit 0
#fi
iwlist wlan0 scanning > $result_file
if [ $chip_broadcom = "true" ]; then
echo "sleep 3s"
sleep 3
fi
iwlist wlan0 scanning last | grep SSID > $result_file
cat $result_file
iwlist wlan0 scanning last | grep "Signal level" > $result_file2
cat $result_file2
echo "success"
exit 1
fi
echo "remove wifi driver"
if [ $mt5931_kitkat = "true" ]; then
echo "echo 0 > /dev/wmtWifi"
echo 0 > /dev/wmtWifi
else
if [ $android_kitkat = "false" ]; then
if [ $driver_buildin = "true" ]; then
echo "echo 0 > $driver_node"
echo 0 > "$driver_node"
else
echo "rmmod wlan"
rmmod wlan
fi
fi
fi
sleep 1
j=$((j+1))
done
echo "wlan test failed"
exit 0
|