5G中繼調試記錄
1./work/AP22_LSDK/lsdk-9.5.5.36/linux/kernels/mips-linux-2.6.31 // kernel path
2.tuboot // uboot bin
3.mi124_f1e-jffs2 // rootfs bin
4.build.sh // by myself edit build project
5.mkjffs2.sh // pack of rootfs
6.ar9342的熱點發射不需要使用hostapd ,使用wlanconfig 工具創建的vap,設置參數後啓動即可。
7.wifi的sta模式也是需要創建vap 不過是sta模式,使用wpa_supplicant工具來連接wifi
8.11n有兩種頻帶模式:HT(High Throughput)20 和 HT40 頻道帶寬不一樣,一個區域內存在11b/g信號,爲了減少干擾,需設置成HT20,減少頻帶的重疊。HT40 需要40M帶寬最好在5G使用。
9. 登陸名: root ,密碼: ar9342-qual 。
10.rcS 文件運行 /etc/rc.d/rc.network 啓動了ifconfig $LAN_IF up ( export LAN_IF=eth1)
/etc/rc.d/rc.bridge 創建了br0 , /etc/rc.d/rc.network 和/etc/rc.d/rc.bridge 和wifi 沒有關係
wifi 啓動腳本/etc/ath/apup
/etc/rc.d/rc.wlan 加載內核驅動
ap_startmode repeater-ind
makeVAP ap-wds-ind Atheros_XSpan_2G 0:RF:6:11NGHT20
makeVAP sta-wds-ind [essid] 0:RF:6:11NGHT20
MODE= ap SUB_MODE=wds ind 0 6 11NGHT20
ap:
iwpriv ${APNAME} bgscan 0
sta:
iwpriv ${APNAME} bgscan 0
- 原廠登陸 root , 密碼 5up
- WDS 無線分佈式系統 ,可以進行橋接和中繼 。
橋接不等於中繼
A B C 三臺路由器
A 和 B 進行橋接 , B 和 C 進行橋接 , A C 不能橋接
A 和 B 中繼 ,B和C 中繼 A和C 可以中繼
iwlist ath0 scan | grep -A 5 WiFi-1080P-141D06 | grep Channel | awk ‘/[0-9][0-9]+/{ print $4}’
13 awk -F " " ‘{if(NR==3) print $4 }’ ./awk_test.txt | grep -oE “[0-9]+” 取得通道號 , 板子不支持 -oE。
awk -F ‘:’ ‘{if (NR==1) print $2}’ ./awk_test.txt 取得wifi名
cat awk_test.txt | tail -n 1 取得最後一行
book@book-virtual-machine:/work/AP22_LSDK/lsdk-9.5.5.36$ cat awk_test.txt
ESSID:“WiFi-1080P-GPS-1434EC”
Mode:Master
Frequency:5.18 GHz (Channel 36)
Quality=94/94 Signal level=-42 dBm Noise level=-95 dBm
14 sed -r ‘s/[^0-9.]+//g’ 查找數字
iwlist ath0 scan | grep -A 2 “WiFi-1080P-GPS” | sed -n ‘1,3p’ > iwlist.txt 取第一次匹配的三行
cat iwlist.txt | tail -n 1 | sed -r ‘s/^.*Channel//g’ | sed -r ‘s/[^0-9.]+//g’ 取得通道號 。
grep “WiFi-1080P-GPS” ./iwlist.txt | sed -r ‘s/.*ESSID://g’ 取得wifi名
sed -i ‘s/ ssid=.*/ ssid=“WiFi-1080P-GPS-1434EC”/g’ /etc/wpa.conf 替換wifi名
15 shell 死循環
while [ 1 -eq 1 ]
do
if [ $? -eq 0 ]
then
echo “==0”
else
break
fi
done
獲取行數
wc /tmp/.iwlist.txt -l | sed -r ‘s/[0-9]+//g’
刪除掉字符串最後面-和後面的字符,並拼接-R-
ap_name= “WiFi-1080P-GPS-1434EC”
local_ap=`echo ${ap_name%-*}"-R-"`
local_ap 等於 WiFi-1080P-GPS-R-
16 排序
grep “Signal level” /tmp/.iwlist.txt | sed -r ‘s/.*Signal level//g’ | sort -n
17
6 cmdlinepart partitions found on MTD device ath-nor0
Creating 6 MTD partitions on "ath-nor0":
0x000000000000-0x000000008000 : "u-boot1"
mtd: partition "u-boot1" doesn't end on an erase block -- force read-only
0x000000008000-0x000000010000 : "u-boot2"
mtd: partition "u-boot2" doesn't start on an erase block boundary -- force read-only
0x000000010000-0x000000300000 : "rootfs"
0x000000300000-0x0000003e0000 : "uImage"
0x0000003e0000-0x0000003f0000 : "mib0"
0x0000003f0000-0x000000400000 : "ART"
setenv ipaddr 192.168.10.1;setenv serverip 192.168.10.157;tftp 0x80060000 mi124_f1e-jffs2;erase 0x9f000000 +0x70000;cp.b $fileaddr 0x9f000000 0x7e0000
setenv ipaddr 192.168.10.1;setenv serverip 192.168.10.157;tftp 0x80060000 mi124_f1e-jffs2;erase 0x9f010000 +0x7e0000;cp.b $fileaddr 0x9f010000 0x7e0000
tftp 0x80060000 ${dir}tuboot_mi124_f1e.bin&&erase 0x9f000000 +0x10000&&cp.b $fileaddr 0x9f000000 0x10000
18
/etc/rc.d # cat sta_connect.sh
#dd if=/dev/mtdblock5 of=/tmp/mac skip=4098 bs=1 count=6
#hexdump /tmp/mac > /tmp/mac_ascii
MAC_SUFFIX2=`sed -n '1p' /tmp/mac_ascii | cut -f3 -d' ' | cut -c3-4`
MAC_SUFFIX3=`sed -n '1p' /tmp/mac_ascii | cut -f4 -d' '`
while [ 1 -eq 1 ]
do
iwlist ath0 scan | grep -A 3 "WiFi-1080P-GPS" > /tmp/.iwlist.txt
if [ $? -eq 0 ]
then
singal_level=`grep "Signal level" /tmp/.iwlist.txt | sed -r 's/.*Signal level//g' | sort -n | awk -F "Noise" '{ if(NR==1) print $1}'`
grep -B 3 "$singal_level" /tmp/.iwlist.txt > /tmp/.iwlist.tmp
rm /tmp/.iwlist.txt
sed -n '1,3p' /tmp/.iwlist.tmp > /tmp/iwlist.txt
channel=`cat /tmp/iwlist.txt | tail -n 1 | sed -r 's/^.*Channel//g' | sed -r 's/[^0-9.]+//g'`
ap_name=`grep "ESSID" /tmp/iwlist.txt | sed -r 's/.*ESSID://g'`
echo $channel $ap_name
local_ap=`echo ${ap_name%-*}"-R-"`
echo $local_ap
iwconfig ath0 essid $local_ap$MAC_SUFFIX2$MAC_SUFFIX3
cp /etc/wpa.conf /tmp/wpa.conf
sed -i "s/ ssid=.*/ ssid=$ap_name/g" /tmp/wpa.conf
iwconfig ath0 channel $channel
if [ 161 -eq $channel ]
then
echo "161 is us"
iwpriv wifi0 setCountry US
else if [ 36 -eq $channel ]
then
echo "36 is JP"
iwpriv wifi0 setCountry JP
fi
fi
wpa_supplicant -i ath1 -b br0 -c /tmp/wpa.conf &
break;
else
echo "continue scan "
fi
sleep 5
done