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








Logo

更多推荐