zoukankan      html  css  js  c++  java
  • test_wifi

    #!/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


  • 相关阅读:
    JS文本框下拉提示效果
    JS动态添加删除表格行
    JS验证 数字 电话号码 传真 邮箱 手机号码 邮编 日期
    TreeView 中CheckBox级联选中问题
    HashTable Dictionary
    JS操作Frame对象
    Winfrom 中怎样在回车时设置焦点
    Word 操作(未完待续)
    HTML5特性——prefetching预加载功能
    10个实用的 jQuery Mobile 插件推荐
  • 原文地址:https://www.cnblogs.com/zfyouxi/p/4003263.html
Copyright © 2011-2022 走看看