Chinaunix首页 | 论坛 | 博客
  • 博客访问: 38183
  • 博文数量: 3
  • 博客积分: 84
  • 博客等级: 民兵
  • 技术积分: 91
  • 用 户 组: 普通用户
  • 注册时间: 2012-06-11 21:27
文章分类
文章存档

2016年(1)

2014年(1)

2013年(1)

我的朋友

分类: 系统运维

2014-08-05 13:50:38

家里的台式机采用的是Realtek RTL8188CUS  USB无线网卡Ubuntu 12.04升级到14.04版本,现14.04系统无线网卡驱动,定性很差,动就掉线,每次都得重新down/up一下才正常。
  1. gorgira@vostro-260:~$ lsusb
  2. Bus 002 Device 005: ID 0461:4d81 Primax Electronics, Ltd Dell N889 Optical Mouse
  3. Bus 002 Device 004: ID 413c:2107 Dell Computer Corp.
  4. Bus 002 Device 003: ID 0846:9041 NetGear, Inc. WNA1000M 802.11bgn [Realtek RTL8188CUS]
在Ubuntu论坛找到如下解决办法:
First change the wpa/wpa2 encryption to just wpa2 (CCMP)(AES) not (TKIP) if you have that option it will work best.
Second set your wireless channel in the router to 1 or 11 then save the router configuration and reboot it.
Third go into network manager at top right corner of the screen and click on edit connections>wireless tab and set IPV6 to ignore. (实践证明这个比较有效!)
Fourth shutdown your computer and unplug your usb wireless device so your internal wireless can work then reboot, if it does not connect then post a new file without usb wireless plugged in.

      
以上的能让系统自带的无线网卡驱动稳定些, 况且一般系统默认的无线网卡驱动里面都会配置了节能模式,这容易导致无线卡工作在低功耗状态,容易发生收发数据包不稳定问题。当然最好的解决办法是利用Realtek官方提供的无线网卡驱动:


    
很遗憾,发现官方的网卡驱动支持的内核版本为Linux Kernel 2.6.18~3.9,而笔者使用的Ubuntu内核版本如下:

  1. gorgira@vostro-260:~$ uname -a
  2.     Linux vostro-260 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

显然3.13.0的内核版本目前还不支持,或许修改驱动会是解决办法,不是不可以,就是费时,忽然想到会不会别人也同样有这个问题困惑呢,于是在github找到如下的解决办法:
     Using the kernel driver, you won't be able to connect unless your 20ft within range of the router.If you want your usb wireless device to work (rtl8192cu) properly, you may want to install the proprietary driver with the following commands:

sudo apt-get install git build-essential linux-headers-generic dkms
git clone https://github.com/dz0ny/rt8192cu.git --depth 1 

cd rt8192cu
sudo make dkms

And use the following to load the driver
sudo modprobe 8192cu

Notice this module uses "8192cu" instead of "rtl8192cu" to load. Finally,update your /etc/modules folder accordingly with this command:
echo '8192cu' | sudo tee -a /etc/modules

With this driver you get full 300Mb/s instead of 150 and there is full encryption suport as well. Not only that but the range is at least 10 times better than the kernel driver and no more dropped signal.

由于这个版本针对的是3.13.0-24-generic的内核版本,利用该方法编译出来的在3.13.0-32-generic上会发生插入模块格式不正确的问题,于是笔者就利用了源码进行如下操作:

  1. gorgira@vostro-260:~$ cd codesource/rt8192cu/
  2. gorgira@vostro-260:~/codesource/rt8192cu$ make modules
  3. gorgira@vostro-260:~/codesource/rt8192cu$ make install

此外,需要注意的是这份驱动默认是使能了网卡节能功能,并且打开debug信息,只需对源码修改如下:

  1. commit ab09d3ba9372d89e24ce5174175257118f21a2ed
  2. Author: Weiqiang Su <ipaper_purple@163.com>
  3. Date: Tue Aug 5 10:08:02 2014 +0800
  4.     remove power saving mode by default and disable dbg information

  5. diff --git a/.gitignore b/.gitignore
  6. index a687040..852fb76 100644
  7. --- a/.gitignore
  8. +++ b/.gitignore
  9. @@ -11,3 +11,4 @@ patches/original
  10.  patches/rt8192cu_diff.patch
  11.  patches/tmp
  12.  *~
  13. +tags
  14. diff --git a/Makefile b/Makefile
  15. index 3088a7c..0e8b137 100755
  16. --- a/Makefile
  17. +++ b/Makefile
  18. @@ -29,7 +29,7 @@ CONFIG_PCI_HCI = n
  19.  CONFIG_SDIO_HCI = n
  20.  
  21.  CONFIG_MP_INCLUDED = n
  22. -CONFIG_POWER_SAVING = y
  23. +CONFIG_POWER_SAVING = n
  24.  CONFIG_USB_AUTOSUSPEND = n
  25.  CONFIG_HW_PWRP_DETECTION = n
  26.  CONFIG_WIFI_TEST = n
  27. diff --git a/include/rtw_debug.h b/include/rtw_debug.h
  28. index 0ccf220..f2828c2 100755
  29. --- a/include/rtw_debug.h
  30. +++ b/include/rtw_debug.h
  31. @@ -310,6 +310,7 @@ extern u32 GlobalDebugLevel;
  32.  
  33.  #define DBG_871X_LEVEL LOG_LEVEL
  34.  
  35. +#undef _dbgdump
  36.  #if defined (_dbgdump)
  37.          #undef DBG_871X
  38.  // #define DBG_871X _dbgdump

       终于编译完成了,剩下的问题就是能让模块开机自动加载了,还需完成:

(1) 禁止默认的rtl8192cu模块加载

  1. gorgira@vostro-260:~/codesource/rt8192cu$ sudo echo "blacklist rtl8192cu" >> /etc/modprobe.d/blacklist.conf

(2) 利用make install 或者采用手动创建目录/lib/modules/3.13.0-32-generic/kernel/drivers/net/wireless/rtlwifi/8192cu/,然后把编译生成的8192cu.ko拷贝到该目录下,并执行如下操作

  1. gorgira@vostro-260:~/codesource/rt8192cu$ sudo depmod -a 3.13.0-32-generic

重启系统,一切OK!网卡超级稳定!



阅读(19181) | 评论(6) | 转发(3) |
给主人留下些什么吧!~~

打酱油的龙套2014-09-07 22:25:52

折腾了几个月的问题啊 总算是成功了 太感谢了!

mender052014-08-25 21:14:14

mender05:lsusb 能看到 无线网卡,但是屏幕右上角扫描不出任何无线网络。系统设置里的network也只有有线网。。。

是我2了,没有执行后面的命令。
echo "blacklist rtl8192cu" >> /etc/modprobe.d/blacklist.conf
手动创建目录/lib/modules/3.13.0-34-generic/kernel/drivers/net/wireless/rtlwifi/8192cu/,然后把编译生成的8192cu.ko拷贝到该目录下;
sudo depmod -a 3.13.0-34-generic
重启就好了。
感谢博主的方法。

回复 | 举报

mender052014-08-25 19:56:51

mender05:楼主,我把代码git下来以后make,然后make install。重启以后无线网卡不见了。。。怎么解决啊

lsusb 能看到 无线网卡,但是屏幕右上角扫描不出任何无线网络。系统设置里的network也只有有线网。。。

回复 | 举报

mender052014-08-25 19:53:23

楼主,我把代码git下来以后make,然后make install。重启以后无线网卡不见了。。。怎么解决啊

caizp20082014-08-23 21:27:11

文明上网,理性发言...