install tp link wn725n wifi usb adapter on ubuntu

I found the solution.

I found the solution. I installed the driver for the usb wifi adapter successfully using the following:

sudo apt-get update
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install git
git clone https://github.com/lwfinger/rtl8188eu
cd rtl8188eu
make all
sudo make install
sudo modprobe 8188eu.ko

and then I used the following command:

sudo lshw -C network

to get the internal wifi driver file name and then add it to blacklist

sudo -H gedit /etc/modprobe.d/blacklist

and add the following line to the end of the file:

blacklist xxxxx

where xxxx is the internal wifi driver file name.

Restart and Ubuntu should now work with the usb adapter.

Note: if your internal wifi is fine then you don’t need to blacklist it, i only did that because it was tuened off by hardware switch and doesn’t want to turn on again and it turns off the usb wifi as well so i had to blacklist it.

 

 

Actually there are 2 different revision of this tl-wn725n wifi adapter, the v1 and the v2 which have different chipsets.

How to recognize them?

The tp-link website say that is possible to recognize them by the FCCID (labeled on the adapter).

If your FCCID terminates with v2 then is the second revision, which use the RTL8188EUS Realtek chipset.

Otherwise if your FCCID terminates with v1 (or you can’t find a hardware version) it is the first revision, based on the Realtek RTL8188CUS chipset.

Where do i find the driver?

For the v2 version on the tp-link website : here

For the v1 version here (from realtek) , or here

More info:

https://wikidevi.com/wiki/TP-LINK_TL-WN725N_v1

 

 

https://help.ubuntu.com/community/HardwareSupportComponentsWirelessNetworkCardsTP-Link#USB

 

[FAILED] ubuntu 16.04 上使用 TP-LINK WN725N 免驱版 无线网卡

该网卡使用MTK 7601u芯片。虽然型号也叫WN725N,但是和之前的WN725N根本就不是一个东西。。。是的,除了生产厂家以及都是黑色USB无线网卡以外,二者没有任何共同点。
插到机器上之后,lsusb显示为:
Bus 003 Device 006: ID 148f:2878 Ralink Technology, Corp.

系统将之挂载为一个cdrom。在Windows上,可以直接使用里面的安装程序进行驱动安装。
并讲网卡模式切换为无线网卡模式。

在Ubuntu上,为了切换模式,参考了usb_modeswitch的data文件:
# RaLink MT7601U
TargetVendor=0x148f
TargetProduct=0x7601
StandardEject=1

是的,只要进行eject即可。。。
可直接执行:
sudo eject /dev/sr0
或者
sudo usb_modeswitch -v 148f -p 2878 -K

之后lsusb,等待一下,即可观察到:
Bus 003 Device 007: ID 148f:7601 Ralink Technology, Corp. MT7601U Wireless Adapter

其实这个等待的时间,是系统正在使用自带mt7601驱动尝试probe网卡。

[  589.049149] usb 3-11: reset high-speed USB device number 7 using xhci_hcd
[  589.179614] mt7601u 3-11:1.0: ASIC revision: 76010001 MAC revision: 76010500
[  589.180380] mt7601u 3-11:1.0: Firmware Version: 0.1.00 Build: 7640 Build time: 201302052146____
[  592.645071] mt7601u 3-11:1.0: Vendor request req:07 off:09a8 failed:-110
[  595.764998] mt7601u 3-11:1.0: Vendor request req:02 off:09a8 failed:-110
[  598.884833] mt7601u 3-11:1.0: Vendor request req:07 off:0734 failed:-110
[  602.004776] mt7601u 3-11:1.0: Vendor request req:42 off:0230 failed:-110
[  605.124673] mt7601u 3-11:1.0: Vendor request req:07 off:0080 failed:-110
[  608.244542] mt7601u 3-11:1.0: Vendor request req:02 off:0080 failed:-110
[  611.364455] mt7601u 3-11:1.0: Vendor request req:02 off:0080 failed:-110
[  611.364489] mt7601u: probe of 3-11:1.0 failed with error -110
[  611.364526] usbcore: registered new interface driver mt7601u

可以看到,probe最终失败了。应该是网卡驱动(分析代码后发现,也可能是firmware)和该型号网卡不匹配。
参照https://askubuntu.com/questions/457061/ralink-mt7601u-148f7601-wi-fi-adapter-installation
手动安装驱动。

sudo apt-get install linux-headers-generic build-essential git

git clone https://github.com/art567/mt7601usta.git

cd mt7601usta/src

make

sudo make install

sudo mkdir -p /etc/Wireless/RT2870STA/

sudo cp RT2870STA.dat /etc/Wireless/RT2870STA/

sudo modprobe mt7601Usta

注意:考虑到之前的驱动已经加载,在执行modprobe之前,应该考虑先将之前的驱动rmmod掉。(实际尝试后发现然并卵。)
系统默认驱动信息:

modinfo mt7601u
filename:       /lib/modules/4.4.0-81-generic/kernel/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko
license:        GPL
firmware:       mt7601u.bin
srcversion:     C4F802D4D12C5BC2BA7FEB7
alias:          usb:v7392p7710d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2A5Fp1000d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2955p1001d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2955p0001d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2717p4106d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v2001p3D04d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v148Fp760Dd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v148Fp760Cd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v148Fp760Bd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v148Fp760Ad*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v148Fp7601d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v13D3p3434d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v13D3p3431d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0E8Dp760Bd*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0E8Dp760Ad*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v0B05p17D3d*dc*dsc*dp*ic*isc*ip*in*
depends:        mac80211,cfg80211
intree:         Y
vermagic:       4.4.0-81-generic SMP mod_unload modversions

modprobe执行之后,可以查看sudo lshw -C net
  *-network DISABLED
       description: Wireless interface
       physical id: 2
       logical name: ra0
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=RALINK WLAN multicast=yes wireless=Ralink STA
可见系统已经可以识别该网卡,但网络处于disable状态。可能和我机器系统本身有关。在dmesg中可以看到
[ 1108.702033] ModemManager[925]: segfault at 0 ip 0000000000431ab3 sp 00007fffc062e940 error 4 in ModemManager[400000+
103000]
接下来尝试使用ifconfig强行up  ra0
sudo ifconfig ra0 up
命令长时间没有反应

尝试将Ubuntu升级至 17.04,效果依旧。估计要深入分析驱动代码,太浪费时间。同时考虑到未来内核升级也要重新手动修改驱动,用户体验难以接受。决定放弃尝试。

================================================================
最终解决方案:
又购买了普通版本TL-WN725N(更小更便宜),未做任何配置,插在机器上,瞬间完成驱动。
教训:一分钱一分货是不假,但在linux的世界里,性价比才是最安全的标准。