【小叙】
想不到事隔半年后,又在项目中使用了驱动mt7601的网卡,一直不知道它的性能是不是真的好,只是使用起来的时候比其他的网卡驱动用起来都麻烦。
而且说明文档和使用文档感觉都不到位,反正这次使用的时候会比第一次使用能够更快的解决麻烦,记录一下过程好了。
使用驱动为DPA_MT7601U_LinuxSTA_3.0.0.4_20130916.tgz,下载地址http://download.csdn.net/detail/diandianyangyi/6979117
【驱动编译】
先跳过 ,后续补充
【错误一】
中途接手mt7601网卡的调试工作,也不知道之前的人做了多少,使用的并不是很顺利。
驱动编译和加载上了,也识别出了网卡wlan0(为何不是ra0,慢会再说),然后简单的使用启用雷凌网卡的命令,都遭到了拒绝。
# ifconfig wlan0 up
unlink cmd rsp urb
ifconfig: SIOCSIFFLAGS: Operation not permitted
这个问题是因为没有将驱动中的文件RT2870STA.dat拷贝到开发板的/etc/Wireless/RT2870STA/RT2870STA.dat 而发生的。
【错误二】
虽然改正了一个错误,但是仍然不能使用。
这次爆出的错误如下,不支持命令。
# wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf &
# 0x1300 = 00064300
ifconfig wTrying to associate with 20:dc:e6:e6:a5:24 (SSID='abc' freq=2412 MHz)
ioctl[SIOCSIWGENIE]: Operation not supported
Association request to the driver failed
Authentication with 20:dc:e6:e6:a5:24 timed out.
搜索信息得到如下说明
wpa Supplicant Don't Works With Rt73 Untill You Patch Wpa Sup Itself
you Must Use The Iwpriv Commands
Search Iv Posted Them Many Times !!!!
I Closed This One Just Search The Answer Is Here !!!
即不能够使用wpa_supplicant 的命令来配置mt7601除非打上补丁。
又看了一遍README_STA_usb,发现自己看漏了。
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
这里明确说明了对wpa_supplicant 的支持和使用,自己原先没有配置上。
【其他】
修改ralink的wifi的驱动,更名ra0为wlan0
在驱动的头文件中位置 MODULE\include\rtmp_def.h 有如下定义
#ifdef ANDROID_SUPPORT
#define INF_MAIN_DEV_NAME "wlan"
#define INF_MBSSID_DEV_NAME "wlan"
#else
#define INF_MAIN_DEV_NAME "ra"
#define INF_MBSSID_DEV_NAME "ra"
根据这个,看来只要配置了ANDROID_SUPPORT这个宏,就默认的为wlan网卡了。
在驱动的目录中修改config.mk这个文件,将下面一条改为y,就好了。
#Support ANDROID_SUPPORT
HAS_ANDROID_SUPPORT=y
【iwpriv配置】
配置部分来自以下两个链接。
http://blog.csdn.net/baggio1006/article/details/8838626
http://blog.sina.com.cn/s/blog_b09739ab01016mif.html
在驱动代码里MODULE/iwpriv_usage.txt里头也有说明,摘抄部分。
a> Config STA to link with AP which is OPEN/NONE(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=OPEN
3. iwpriv ra0 set EncrypType=NONE
4. iwpriv ra0 set SSID="AP's SSID"
b> Config STA to link with AP which is SHARED/WEP(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=SHARED
3. iwpriv ra0 set EncrypType=WEP
4. iwpriv ra0 set DefaultKeyID=1
5. iwpriv ra0 set Key1="AP's wep key"
6. iwpriv ra0 set SSID="AP's SSID"
c> Config STA to link with AP which is WPAPSK/TKIP(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=WPAPSK
3. iwpriv ra0 set EncrypType=TKIP
4. iwpriv ra0 set SSID="AP's SSID"
5. iwpriv ra0 set WPAPSK="AP's wpa-preshared key"
6. iwpriv ra0 set SSID="AP's SSID"
d> Config STA to link with AP which is WPAPSK/AES(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=WPAPSK
3. iwpriv ra0 set EncrypType=AES
4. iwpriv ra0 set SSID="AP's SSID"
5. iwpriv ra0 set WPAPSK="AP's wpa-preshared key"
6. iwpriv ra0 set SSID="AP's SSID"
e> Config STA to link with AP which is WPA2PSK/TKIP(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=WPA2PSK
3. iwpriv ra0 set EncrypType=TKIP
4. iwpriv ra0 set SSID="AP's SSID"
5. iwpriv ra0 set WPAPSK=12345678
6. iwpriv ra0 set SSID="AP's SSID"
f> Config STA to create/link as adhoc mode, which is OPEN/NONE(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Adhoc
2. iwpriv ra0 set AuthMode=OPEN
3. iwpriv ra0 set EncrypType=NONE
4. iwpriv ra0 set SSID="Adhoc's SSID"
g> Config STA to create/link as adhoc mode, which is WPANONE/TKIP(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Adhoc
2. iwpriv ra0 set AuthMode=WPANONE
3. iwpriv ra0 set EncrypType=TKIP
4. iwpriv ra0 set SSID="AP's SSID"
5. iwpriv ra0 set WPAPSK=12345678
6. iwpriv ra0 set SSID="AP's SSID"