Categories
Fedora

360 wifi 2 做无线网卡(Linux)

360 wifi刚出来的时候,抢购几次没拿到,后面需求也不是很大,公司、家里都有无线路由器。现在公司人多了,公用的wifi网络变得超级慢,而且mac pro的网线口好像坏了,无法直接插线。琢磨了一会,在我的PC机上装个 360 wifi做 AP。开始以为可以在Linux 虚拟机的xp系统里使用,但当装驱动时,系统崩溃,放弃。Google了 360 wifi linux,发现只有两篇个链接可参考:

360 wifi 2 硬件信息情况:
[deli@violet ~]$ lsusb
Bus 002 Device 009: ID 148f:7601 Ralink Technology, Corp.

$ lspci
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

得装驱动,从MTK网站下载

tar xvf DPO_MT7601U_LinuxSTA_3.0.0.4_20130913.tar.bz2
cd DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/
sudo make install
sudo modprobe mt7601Usta

su -
echo 148F 7601 > /sys/bus/usb/drivers/rt2870/new_id
exit

可以查看多了一个网卡口 ra0:

[deli@violet ~]$ ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:292 errors:0 dropped:0 overruns:0 frame:0
TX packets:292 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:22920 (22.3 KiB) TX bytes:22920 (22.3 KiB)

p2p1 Link encap:Ethernet HWaddr F4:6D:04:73:D4:A6
inet6 addr: fe80::f66d:4ff:fe73:d4a6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:66065 errors:0 dropped:0 overruns:0 frame:0
TX packets:44804 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:38222311 (36.4 MiB) TX bytes:5841642 (5.5 MiB)

ra0 Link encap:Ethernet HWaddr 00:87:36:12:0E:81
inet addr:172.30.3.30 Bcast:172.30.3.255 Mask:255.255.255.0
inet6 addr: fe80::287:36ff:fe12:e81/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:144725 errors:0 dropped:0 overruns:0 frame:0
TX packets:1177 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:41587475 (39.6 MiB) TX bytes:127539 (124.5 KiB)

$ ethtool -i ra0
driver: RALINK WLAN
version:
firmware-version:
bus-info: CSR 0x0
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no

MT7601的Linux驱动中没有实现nl80211的接口,hostapd没法直接用。下面是尝试的过程:
我的Linux是 fedora 16,360 wifi 2, 需要对 github上的脚本做修改:
https://gist.github.com/lytsing/991ab69460587aa91aa5
$ ./ubuntu.sh ra0 p2p1 password

[deli@violet 360-wifi-linux]$ sudo hostapd ~/.360wifi/.hostapd.ra0.conf
Configuration file: /home/deli/.360wifi/.hostapd.ra0.conf
nl80211: 'nl80211' generic netlink not found
nl80211 driver initialization failed.

加载 mac80211 再试试。
[deli@violet 360-wifi-linux]$ sudo modprobe mac80211

[deli@violet 360-wifi-linux]$ sudo hostapd -dd ~/.360wifi/.hostapd.ra0.conf

Configuration file: /home/deli/.360wifi/.hostapd.ra0.conf
nl80211: Failed to set interface ra0 into AP mode
nl80211 driver initialization failed.
ELOOP: remaining socket: sock=4 eloop_data=0x9b77898 user_data=0x9b77da8 handler=0x8075380
ELOOP: remaining socket: sock=6 eloop_data=0x9b795c0 user_data=(nil) handler=0x807ef50

无解。

If you enjoyed this post, make sure you subscribe to my RSS feed!

14 replies on “360 wifi 2 做无线网卡(Linux)”

跟楼主遇到一样的问题啊,搞了好半天,我才发现原来mt7601U的驱动竟然不支持nl80211.
不知道楼主相应的hostapd.conf是怎么写的,可否贴出来参照参照?
多谢!

我的使用脚本生成,https://github.com/lytsing/360-wifi-linux 如下:
[deli@violet .360wifi]$ cat .hostapd.wlan0.conf
interface=wlan0
driver=nl80211
ssid=deli@lytsing.org
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

wifi 2无法在Linux使用,最后我跟我同事交换了他的 wifi 1版本,不用装驱动,ifconfig 直接 wlan0 冒出,lw list出来显示有 AP字样,激动啊。

1代就是用网卡芯片是 RT5370 的,
148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
比如 EDUP EP-N8538 也是用的这个芯片

具体的内核支持 AP 的驱动厂家支持列表如下, 看起来就是 ralink 支持最好,
http://wireless.kernel.org/en/users/Drivers

但后面被 mtk 收购后就不灵了
[1]http://www.freemindworld.com/blog/2013/131010_360_wifi_in_linux.shtml

真坑,我没看全文,结果一步一步做下来都没问题,我以为可以用了,把我高兴的呀,结果最后一个无解,擦!
不过还是很谢谢lz的探索精神,虽然我不是搞硬件的和驱动的,但是觉得搞这个都很牛逼。楼主加油!

官网下的DPO_MT7601U_LinuxSTA_3.0.0.4_20130913 本身在ubuntu 14.04 下都编译通过不了.
make -C tools
make[1]: 正在进入目录 `/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/tools’
gcc -g bin2h.c -o bin2h
make[1]:正在离开目录 `/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/tools’
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/tools/bin2h
cp -f os/linux/Makefile.6 /home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/Makefile
make -C /lib/modules/3.13.0-24-generic/build SUBDIRS=/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux modules
make[1]: 正在进入目录 `/usr/src/linux-headers-3.13.0-24-generic’
CC [M] /home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.o
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.c: In function ‘RtmpOsUsDelay’:
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.c:179:8: warning: unused variable ‘i’ [-Wunused-variable]
ULONG i;
^
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.c: In function ‘__RtmpOSFSInfoChange’:
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.c:1121:20: error: incompatible types when assigning to type ‘int’ from type ‘kuid_t’
pOSFSInfo->fsuid = current_fsuid();
^
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.c:1122:20: error: incompatible types when assigning to type ‘int’ from type ‘kgid_t’
pOSFSInfo->fsgid = current_fsgid();
^
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.c: In function ‘RtmpDrvAllRFPrint’:
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.c:2052:4: warning: passing argument 2 of ‘file_w->f_op->write’ from incompatible pointer type [enabled by default]
file_w->f_op->write(file_w, pBuf, BufLen, &file_w->f_pos);
^
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.c:2052:4: note: expected ‘const char *’ but argument is of type ‘UINT32 *’
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.c:2037:22: warning: unused variable ‘macValue’ [-Wunused-variable]
UINT32 macAddr = 0, macValue = 0;
^
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.c:2037:9: warning: unused variable ‘macAddr’ [-Wunused-variable]
UINT32 macAddr = 0, macValue = 0;
^
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.c: In function ‘RtmpOSIRQRelease’:
/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.c:2173:21: warning: unused variable ‘net_dev’ [-Wunused-variable]
struct net_device *net_dev = (struct net_device *)pNetDev;
^
make[2]: *** [/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux/../../os/linux/rt_linux.o] 错误 1
make[1]: *** [_module_/home/tarena/下载/DPO_MT7601U_LinuxSTA_3.0.0.4_20130913/os/linux] 错误 2
make[1]:正在离开目录 `/usr/src/linux-headers-3.13.0-24-generic’
make: *** [LINUX] 错误 2

Leave a Reply to durongze Cancel reply

Your email address will not be published. Required fields are marked *