#!/system/bin/sh

#Load driver
echo "ASD WIFI TESTING..." AP_NAME="default"
num=0
FLAG=0 busybox cp /system/etc/wifi/pre_supplicant.conf /data/misc/wifi/wpa_supplicant.conf
busybox chmod 666 /data/misc/wifi/pre_supplicant.conf
busybox chmod 666 /data/misc/wifi/wpa_supplicant.conf
busybox chmod 777 /dev/rfkill #insmod /system/lib/dhd.ko firmware_path=/system/etc/wifi/40183/ nvram_path=/system/etc/wifi/40183/nvram.txt
insmod /system/lib/dhd.ko firmware_path=/etc/wifi/40181/fw_bcm40181a2.bin nvram_path=/etc/wifi/40181/nvram.txt sleep 5 busybox ifconfig wlan0 up
sleep 5
#/system/bin/wpa_supplicant_ye -Dwext -C/data/misc/wifi/wlan0 -iwlan0 -c/data/misc/wifi/pre_supplicant.conf &
wpa_supplicant -Dnl80211 -C/data/misc/wifi/wlan0 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf & sleep 2 while busybox test $num -lt 5 # Test num with test command
do
#Scan
/system/bin/wpa_cli_ye -p/data/misc/wifi/wlan0 -iwlan0 scan sleep 2 /system/bin/wpa_cli_ye -p/data/misc/wifi/wlan0 -iwlan0 scan_results | busybox grep '[0-9a-zA-Z][0-9a-zA-Z]:[0-9a-zA-Z][0-9a-zA-Z]:[0-9a-zA-Z][0-9a-zA-Z]:[0-9a-zA-Z][0-9a-zA-Z]:[0-9a-zA-Z][0-9a-zA-Z]:[0-9a-zA-Z][0-9a-zA-Z]' if busybox test $? -eq 0
then
busybox sed -i "s/wifi_state = [0-9],[0-9]/wifi_state = 1,1/g" /system/bin/pretest_state
echo "WIFI OK"
FLAG=1
break
else
busybox sed -i "s/wifi_state = [0-9],[0-9]/wifi_state = 0,2/g" /system/bin/pretest_state
echo "scanning..."
fi
num=`busybox expr $num + 1` # Increment num
done if busybox test $num = 5
then
busybox sed -i "s/wifi_state = [0-9],[0-9]/wifi_state = 0,0/g" /system/bin/pretest_state
echo "WIFI FAILED"
exit 0
fi
busybox rm /data/misc/wifi/pre_supplicant.conf
rmmod /system/lib/dhd.ko
exit 0

test_wifi的更多相关文章

  1. python开发_tarfile_文档归档压缩|解压缩

    ''' python中的tarfile模块实现文档的归档压缩和解压缩 功能: 把工作空间下面的所有文件,打包生成一个tar文件 同时提供一个方法把该tar文件中的一些文件解压缩到 指定的目录中 ''' ...

  2. Linux 使用wpa_supplicant手动配置连接wifi

    Linux 使用wpa_supplicant手动配置连接wifi wpa_supplicant 简介 wpa_supplicant是Linux BSD, Mac OSX和Windows的WPA的服务, ...

随机推荐

  1. java记事本

    新知识点 1.撤销 textArea添加一个实现监听接口的类(添加了之后可以一直监视着添加的删除的情况,以便来撤销 textArea.getDocument().addUndoableEditList ...

  2. Qt中widget重新setParent需要注意的问题

    有时候需要在widget中重新setParent,但会发现setParent有时候会出现问题,比如子窗口不在刷出来等等. 其实,有一点是需要注意的,就是Qt文档里说的,如果你当前widget重新设置了 ...

  3. bash shell学习-shell script基础 (笔记)

    A chain no stronger than its weakest link. "一着不慎,满盘皆输" 参考资料:鸟哥的Linux私房菜 基础学习篇(第三版)  Linux ...

  4. [jQuery编程挑战]003 克隆一个页面元素及其相关事件

    挑战: a) 绑定一个点击方法到这个div,点击后此元素会淡出消失 b) 同时克隆一个新的div元素到页面,元素内容是前面div文字内容反向书写(即,sgatbg olleh),同样也具有上面的点击事 ...

  5. 小tip:我是如何初体验uglifyjs压缩JS的

    by zhangxinxu from http://www.zhangxinxu.com本文地址:http://www.zhangxinxu.com/wordpress/?p=2946 一.故事总有其 ...

  6. python运维开发之第五天

    一.模块五大部分 定义,导入方法,import本质(路径搜索),导入优化,模块的分类 1.定义: 模块是用来从逻辑上组织python代码(变量,函数,类,逻辑实现一个功能),本质就是.py结尾的pyt ...

  7. Python新手学习基础之函数-可变参数**

    可变参数( ** ) 讲好了一颗*,那如果函数的最后一个参数带有 ** 前缀: 所有正常参数之外的其他的关键字参数都将被放置在一个字典中传递给函数. 要好好理解* 和 ** 两种可变参数哦~ 看个** ...

  8. 黑马程序员—C语言的函数、数组、字符串

    ------Java培训.Android培训.iOS培训..Net培训.期待与您交流! ------- 一.函数 定义:函数是代码复用的一种机制. 函数的基本语法: 返回类型 函数名 ( 参数类型 参 ...

  9. uva 10820 (筛法构造欧拉函数)

    send a table When participating in programming contests, you sometimes face the following problem: Y ...

  10. codevs 1709 钉子和小球

    1709 钉子和小球 1999年NOI全国竞赛 时间限制: 2 s 空间限制: 128000 KB 题目等级 : 大师 Master 题解 查看运行结果题目描述 Description有一个三角形木板 ...