Ubuntu 12.04.5安装TL-WN725N 2.0无线网卡驱动

来源:互联网 发布:实验数据记录怎么写 编辑:程序博客网 时间:2024/04/30 16:18

实验室有线网络用不了。新配的台式机昨天刚到手。为了让该台式机能用上实验室的无线网络,只好新买了个TP-LINK无线USB网卡。按自带的说明书和提供的网卡,Win7下很简单。但我还装了Ubuntu,考虑不周,该网卡居然没提供Linux驱动。各种Google后终于找到解决方案,希望为后来人提供一点线索,少走弯路。


系统环境:Ubuntu 12.04.5 64位

系统内核:Linux kernel 3.13.0-32-generic


确认无线网卡型号:TL-WN725N 2.0。这商品包装上的图片型号和实物不太一样,估计驱动也就大同小异!


驱动安装步骤:

1) 查看硬件型号。开始在 http://wiki.ubuntu.org.cn/UbuntuHelp:WifiDocs/Driver/bcm43xx 看了,不太明白它分的2类似乎与我的型号都无关。因为我的无线网卡是USB插口,可以通过如下方式查看我的无线网卡型号:

$ lsusb

Bus 001 Device 002: ID 8087:8008 Intel Corp.

Bus 002 Device 002: ID 8087:8000 Intel Corp.

Bus 003 Device 004: ID 0781:5530 SanDisk Corp. Cruzer

Bus 003 Device 002: ID 09da:c10a A4 Tech Co., Ltd

Bus 003 Device 003: ID0bda:8179 Realtek Semiconductor Corp.

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub


$ lspci

00:00.0 Host bridge: Intel Corporation 4th Gen Core Processor DRAM Controller (rev 06)

00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06)

00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)

00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)

00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI (rev 05)

00:16.0 Communication controller: Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1 (rev 04)

00:1a.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 (rev 05)

00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 05)

00:1c.0 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1 (rev d5)

00:1c.2 PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #3 (rev d5)

00:1d.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1 (rev 05)

00:1f.0 ISA bridge: Intel Corporation B85 Express LPC Controller (rev 05)

00:1f.2 SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode] (rev 05)

00:1f.3 SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller (rev 05)

03:00.0Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)


通过这些型号我依然不知道需要下载什么驱动。Google了一下,这问题很多,本质是 realtek 8188eu 无线驱动在 linux kernel 3.x 中的安装问题.根据硬件id为 0bda:8179 Google知该芯片组是适合Probable Linux driver 8188eu,于是问题就简单了。


2) 到https://github.com/lwfinger/rtl8188eu下载rtl8188eu的源码(rtl8188eu-master.zip)。解压,编译:

$ make all

$ sudo make install


提示安装成功。


~/Downloads/rtl8188eu-master$ ls

8188eu.ko   8188eu.mod.o  control_ap  core      hal         include   modules.order   os_dep   rtl8188eufw.bin

8188eu.mod.c  8188eu.o     COPYING   dkms.conf  hostapd-0.8  Makefile  Module.symvers  README.md  rtl_hostapd.conf


~/Downloads/rtl8188eu-master$ sudo depmod -a

~/Downloads/rtl8188eu-master$ sudo modprobe 8188eu

FATAL: Error inserting 8188eu (/lib/modules/3.13.0-32-generic/kernel/drivers/net/wireless/8188eu.ko): Device or resource busy

~/Downloads/rtl8188eu-master$

重启一下,发现右上角扇形的wifi网络出来了,只需选择对应的无线网络账号,输入密码,就可以上网了。


3) 步骤2)可能会提示缺少dkm包,如果提示,就先安装一个。因为目前电脑没网络,到http://packages.ubuntu.com/lucid/all/dkms/download去下载一个dkm安装包(dkms_2.1.1.2-2fakesync1_all.deb),拷贝到该电脑上,并安装:

~/Downloads$ sudo dpkg -i dkms_2.1.1.2-2fakesync1_all.deb

Selecting previously unselected package dkms.

(Reading database ... 144283 files and directories currently installed.)

Unpacking dkms (from dkms_2.1.1.2-2fakesync1_all.deb) ...

Setting up dkms (2.1.1.2-2fakesync1) ...

Processing triggers for man-db ...


参考:

http://www.csdn123.com/html/mycsdn20140110/eb/eb713d8c2dfc4a7e8d1b93a4970b534b.html

http://www.linuxidc.com/Linux/2013-04/83094.htm

http://blog.csdn.net/rainysia/article/details/17484537



曾按网友提示,做过如下尝试,均失败:

方法一:

在Realtek官网下载 r8168-8.039.00.tar.bz2,它详细信息:http://www.realtek.com.tw/Downloads/downloadsView.aspx?Langid=1&PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false#2

LINUX driver for kernel 3.x and 2.6.x and 2.4.x

8.039

2014/9/18

79k

解压,用 root 运行 install.sh 即可。但对我不成功。错误如下:

~/Downloads/r8168-8.039.00$sudo make

make -C src/ clean

make[1]: Entering directory `/home/ltu/Downloads/r8168-8.039.00/src'

make -C /lib/modules/3.13.0-32-generic/build SUBDIRS=/home/ltu/Downloads/r8168-8.039.00/src clean

make[2]: Entering directory `/usr/src/linux-headers-3.13.0-32-generic'

 CLEAN   /home/ltu/Downloads/r8168-8.039.00/src/.tmp_versions

 CLEAN   /home/ltu/Downloads/r8168-8.039.00/src/Module.symvers

make[2]: Leaving directory `/usr/src/linux-headers-3.13.0-32-generic'

make[1]: Leaving directory `/home/ltu/Downloads/r8168-8.039.00/src'

make -C src/ modules

make[1]: Entering directory `/home/ltu/Downloads/r8168-8.039.00/src'

make -C /lib/modules/3.13.0-32-generic/build SUBDIRS=/home/ltu/Downloads/r8168-8.039.00/src modules

make[2]: Entering directory `/usr/src/linux-headers-3.13.0-32-generic'

 CC [M]  /home/ltu/Downloads/r8168-8.039.00/src/r8168_n.o

 CC [M]  /home/ltu/Downloads/r8168-8.039.00/src/r8168_asf.o

 CC [M]  /home/ltu/Downloads/r8168-8.039.00/src/rtl_eeprom.o

 CC [M]  /home/ltu/Downloads/r8168-8.039.00/src/rtltool.o

 LD [M]  /home/ltu/Downloads/r8168-8.039.00/src/r8168.o

 Building modules, stage 2.

 MODPOST 1 modules

 CC     /home/ltu/Downloads/r8168-8.039.00/src/r8168.mod.o

 LD [M]  /home/ltu/Downloads/r8168-8.039.00/src/r8168.ko

make[2]: Leaving directory `/usr/src/linux-headers-3.13.0-32-generic'

make[1]: Leaving directory `/home/ltu/Downloads/r8168-8.039.00/src'

make -C src/ install

make[1]: Entering directory `/home/ltu/Downloads/r8168-8.039.00/src'

make -C /lib/modules/3.13.0-32-generic/build SUBDIRS=/home/ltu/Downloads/r8168-8.039.00/src INSTALL_MOD_DIR=kernel/drivers/net/ethernet/realtek modules_install

make[2]: Entering directory `/usr/src/linux-headers-3.13.0-32-generic'

 INSTALL /home/ltu/Downloads/r8168-8.039.00/src/r8168.ko

Can't read private key

 DEPMOD  3.13.0-32-generic

make[2]: Leaving directory `/usr/src/linux-headers-3.13.0-32-generic'

make[1]: Leaving directory `/home/ltu/Downloads/r8168-8.039.00/src'



方法二:

~/Downloads$sudo dpkg -i rtl8188eu-dkms_0+git20130406_all.deb

(Reading database ... 144328 files and directories currently installed.)

Preparing to replace rtl8188eu-dkms 0+git20130406 (using rtl8188eu-dkms_0+git20130406_all.deb) ...

------------------------------

Deleting module version: 0+git20130406

completely from the DKMS tree.

------------------------------

Done.

Unpacking replacement rtl8188eu-dkms ...

Setting up rtl8188eu-dkms (0+git20130406) ...

Loading new rtl8188eu-0+git20130406 DKMS files...

First Installation: checking all kernels...

Building only for 3.13.0-32-generic

Building initial module for 3.13.0-32-generic


Error! Bad return status for module build on kernel: 3.13.0-32-generic (x86_64)

Consult the make.log in the build directory

/var/lib/dkms/rtl8188eu/0+git20130406/build/ for more information.

dpkg: error processing rtl8188eu-dkms (--install):

subprocess installed post-installation script returned error exit status 10

Errors were encountered while processing:

rtl8188eu-dkms


可能原因:Linux内核版本不一样,该包不支持我的版本。



方法三:

下载这个https://github.com/Red54/linux-shumeipai2/tree/sunxi-3.0/drivers/net/wireless/rtl8188eu据说支持3.x内核的版本,编译,报错:

/var/lib/dkms/rtl8188eu/0+git20130406/build/include/osdep_service.h: In function ‘thread_enter’:

/var/lib/dkms/rtl8188eu/0+git20130406/build/include/osdep_service.h:1397:2: error: implicit declaration of function ‘daemonize’ [-Werror=implicit-function-declaration]

开始Google了一会,无解,就没继续探索这个问题

但是,后来无意中看到博文:http://yafeilee.me/blogs/51c1ad4015638855d1000002提及上面这个问题的关键, 说这个版本的8188eu 在 3.5.x 内核以下版本都没有问题, 3.5.x 以上就出问题了。解决方法很简单,说是删掉它就可以了:

  diff --git a/include/osdep_service.h b/include/osdep_service.h   index ed2dae5..e9acb0d 100755   --- a/include/osdep_service.h   +++ b/include/osdep_service.h   @@ -1403,7 +1403,7 @@ static __inline void thread_enter(char *name);   static __inline void thread_enter(char *name)   {   #ifdef PLATFORM_LINUX   -       daemonize("%s", name);   +       //daemonize("%s", name);           allow_signal(SIGTERM);   #endif   #ifdef PLATFORM_FREEBSD

删除后再编译安装则可。估计我前面成功了的那个版本,就是这里被高手修改以后的版本吧~~

最后:

这里是 3.13 内核的解决方法,其它内核的话估计有不同的错误信息,最好去找找有没有兼容新内核的驱动,如果还是没有,就只能自己动手去改代码了。

0 0