MT7601U
聯發科的産品,u表示的是usb口通信;可在聯發科官網找到原始驅動并修改獲得hi3518e可用的.ko驅動;
1 編譯驅動使支援hi3518e
詳細檔案在:DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/README_STA_usb
1> $tar -xvzf DPB_RT2870_Linux_STA_x.x.x.x.tgz
go to "./DPB_RT2870_Linux_STA_x.x.x.x" directory.
2> In Makefile
set the " MODE = STA" in Makefile and chose the TARGET to Linux by set " TARGET = LINUX"
define the linux kernel source include file path LINUX_SRC
modify to meet your need.
3> In os/linux/config.mk
define the GCC and LD of the target machine
define the compiler flags CFLAGS
modify to meet your need.
** Build for being controlled by NetworkManager or wpa_supplicant wext functions
Please set ' HAS_WPA_SUPPLICANT=y' and ' HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y'.
=> #>cd wpa_supplicant-x.x
=> #>./wpa_supplicant -Dwext -ira0 -c wpa_supplicant.conf -d
** Build for being controlled by WpaSupplicant with Ralink Driver
Please set 'HAS_WPA_SUPPLICANT=y' and 'HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n'.
=> #>cd wpa_supplicant-0.5.7
=> #>./wpa_supplicant -Dralink -ira0 -c wpa_supplicant.conf -d
我的情況是要将os/linux/config.mk做如下修改:
改為:# Support Wpa_Supplicant # i.e. wpa_supplicant -Dralink HAS_WPA_SUPPLICANT=y # Support Native WpaSupplicant for Network Maganger # i.e. wpa_supplicant -Dwext HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y #Support Net interface block while Tx-Sw queue full HAS_BLOCK_NET_IF=n
# Support Wpa_Supplicant # i.e. wpa_supplicant -Dralink HAS_WPA_SUPPLICANT=n # Support Native WpaSupplicant for Network Maganger # i.e. wpa_supplicant -Dwext HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n #Support Net interface block while Tx-Sw queue full HAS_BLOCK_NET_IF=y
4> $make
# compile driver source code
# To fix "error: too few arguments to function ˉiwe_stream_add_event"
=> $patch -i os/linux/sta_ioctl.c.patch os/linux/sta_ioctl.c
5> $cp RT2870STA.dat /etc/Wireless/RT2870STA/RT2870STA.dat //預設配置檔案:裡面有要連接配接的wifi的名字和密碼;
6> load driver, go to "os/linux/" directory.
#[kernel 2.4]
# $/sbin/insmod rt2870sta.o
# $/sbin/ifconfig ra0 inet YOUR_IP up
#[kernel 2.6]
# $/sbin/insmod rt2870sta.ko
# $/sbin/ifconfig ra0 inet YOUR_IP up
7> unload driver
$/sbin/ifconfig ra0 down
$/sbin/rmmod rt2870sta
2 配置檔案
RT2870 driver can be configured via following interfaces,
i.e. (i)"iwconfig" command, (ii)"iwpriv" command, (iii) configuration file
i) iwconfig comes with kernel.
ii) iwpriv usage, please refer to file "iwpriv_usage.txt" for details.
見:/sample/Mt7601STA/start.sh //我的wifi配置檔案
iii)modify configuration file "RT2870STA.dat" in /etc/Wireless/RT2870STA/RT2870STA.dat.
3 配置ip位址
連接配接成功後配置ra0的IP位址
動态擷取ip
udhcpc -i ra0
手動設定ip
ifconfig ra0 192.168.1.67
4 sta模式連接配接wifi流程
貌似要先關閉有限網卡;
insmod rt2870sta.ko //加載驅動 可lsmod檢視結果
ifconfig eth0 down //先關閉有線網絡
ifconfig ra0 up //打開wifi設定網絡
iwlist ra0 scanning //掃描無線路由器的節點資訊,會将周邊無線路由器的節點資訊輸出
流程:
ifconfig eth0 down
ifconfig ra0 up
iwpriv ra0 set NetworkType=Infra
iwpriv ra0 set AuthMode=WPA2PSK
iwpriv ra0 set EncrypType=AES
iwpriv ra0 set SSID="wyb"
iwpriv ra0 set WPAPSK="12345678" //無線路由器的密碼
注意:擷取連接配接wifi時,所要連接配接的wifi必須是打開的否則會報錯;
連接配接成功後配置ra0的IP位址:
動态擷取ip
udhcpc -i ra0
從Busybox的examples/udhcp/下copy simple.script檔案到開發闆/usr/share/udhcpc/下,并重命名為default.script,然後更改檔案default.script的權限, chmod a+x default.script。(如果你沒有在開發闆上修改權限的話,是不能擷取ip的,錯誤可能是這樣的) >: udhcpc -i wlan0 udhcpc (v1.20.2) started Sending discover... Sending select for 192.168.1.110... Lease of 192.168.1.110 obtained, lease time 7200 後邊啥都沒了。。。。。。然而這并不是正确的!
手動設定ip
ifconfig ra0 192.168.1.67
ping 192.168.1.1 //測試網絡是否通,請ping 客戶wifi路由器的ip,連接配接上來就可以ping通路由器
注:實測用官方下載下傳的驅動包;經過上面的配置;編譯是可以通過的,驅動是可以正常加載并ping同的;
注釋:韋東山怎麼使用wifi的:
1 參看linux核心支援哪種wifi晶片:在https://wireless.wiki.kernel.org/en/users/drivers/mediatek 網站中檢視;
主要看自己wifi裝置的ID,如(Atheros : VID 0x13D3 PID 0x3327 (成品型号 AR9271));
2 編譯核心是相應的wifi驅動編譯如核心;
cd drivers/net/wireless/
grep "0x3327" * -nR //查找哪個檔案中有打開同目錄的makefile 确定配置項CONFIG_ATH9K_HTC,
make menuconfig, /CONFIG_ATH9K_HTC 得到下面資訊 / 斜杠表示搜尋 改為y:編輯進核心
這時開機應該就可以顯示支援了,有的要在核心檔案系統的固定目錄下,放置固件;
3 使用wifi網卡:iw、wpa_supplicant、dhcp這幾個指令是需要的,要編譯這幾個指令,編譯好後放入檔案系統中;
20171118更新:
開啟ra0顯示錯誤:
RTUSB_VendorRequest failed(-110),TxFlags=0x0, ReqType=IN, Req=0x7, Idx=0x1710,pAd->Flags=0x31000002
原因:./load3518e 腳本調用lowpower.sh (該腳本關閉了USB電源)
#關閉USB PHY的總電源:0x20050080 [12]bit配置為0 himm 0x20050080 0x000121a8 #關閉USB PHY的模拟電源:0x20050084 [22]bit配置為1 himm 0x20050084 0x005d2188
解決:
注釋掉這兩個寫寄存器的操作:#關閉USB PHY的總電源:0x20050080 [12]bit配置為0 #himm 0x20050080 0x000121a8 #關閉USB PHY的模拟電源:0x20050084 [22]bit配置為1 #himm 0x20050084 0x005d2188