欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Ubuntu16.04下联想R720的无线网卡开启问题及信号不稳定

程序员文章站 2022-06-06 08:01:23
...

问题一
1.1 问题描述
笔记本型号:Lenovo r720笔记本(i5-7300hq,gtx1060 maxq 6g),默认装入Win10系统,然而当装入Ubuntu16.04双系统时,会出现无线网卡(型号:RTL8821AE)被hard blocked问题。
即:
在终端敲入:
rfkill list all
会出现:

Soft blocked: no
Hard blocked:yes
1:ideapad_bluetooth: Bluetooth
Soft blocked: no
Hard blocked: yes
2:phy0: Wireless LAN
Soft blocked: no
Hard blocked:no
3:hci0: Bluetooth
Soft blocked: yes
Hard blocked: no

可以看到,优先级前的ideapad_wlan的Hard blocked 默认为yes,即ubuntu默认关闭了硬件wifi开关,而联想R720的wifi只有软件开关,没有硬件开关的启动,所以引起了wifi无法开启的问题。

1.2 解决方法
从无线模块的显示列表可以看出,序号2的wifi模块是软硬件是可以启动的,所以,只要将前面默认的模块移出即可。
a)方法一:
1)移出ideapad无线模块:
sudo modprobe -r ideapad_laptop
2)使用命令查看:
rfkill list all
如下提示:

2:phy0: Wireless LAN
Soft blocked: no
Hard blocked:no
3:hci0: Bluetooth
Soft blocked: yes
Hard blocked: no

即wifi模块工作正常,然而每次重启ubuntu系统都要重新进行模块移出,故可将该命令设置为开机自启动。
3)在/etc/rc.local文件中添加命令:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

#因为使用的是非管理员登录,故在执行sudo命令时要输入密码,方可自动化执行,
#此处假设用户密码为123,命令一定要在exit 0之前运行,该文件如果没有修改权限
#修改前使用 chmod 命令修改权限即可!

echo "123" |sudo modprobe -r ideapad_laptop
exit 0

开机启动后系统会自动执行改脚本文件,完成wifi模块的自动移出操作。

b)方法二(推荐):
通过列入黑名单的方式来实现自动移出ideapad_laptop设备。
1)创建/etc/modprobe.d/ideapad.conf文件:

sudo touch /etc/modprobe.d/ideapad.conf

2)编辑ideapad.conf文件:

sudo gedit ideapad.conf
  1. 在ideapad.conf文件中添加:
blacklist ideapad_laptop
  1. 关闭并保存ideapad.conf文件,移除ideapad_laptop设备:
sudo modprobe -r ideapad_laptop
  1. 注销重启Ubuntu系统,可以看到无线设备能够被打开,并能搜索到WiFi信号。

问题二
2.1 问题描述
在解决以上无线网卡开启问题后,发现已连接的wifi容易断开并且信号强度较差
最近在新电脑上装了Ubuntu 16.04,结果wifi经常连不上,连上了过段时间就掉线,路由器就在电脑的旁边,而且信号非常的弱。
但是Windows系统没有任何问题,所以就在网上找解决办法,也按照网上的方法试了,结果好多方法都是没用的。
最后从askubuntu上找到了解决方法,首先要查看本机的无线网卡型号:

1 [email protected]:~$ lspci
 2 00:00.0 Host bridge: Intel Corporation Broadwell-U Host Bridge -OPI (rev 09)
 3 00:02.0 VGA compatible controller: Intel Corporation Broadwell-U Integrated Graphics (rev 09)
 4 00:03.0 Audio device: Intel Corporation Broadwell-U Audio Controller (rev 09)
 5 00:04.0 Signal processing controller: Intel Corporation Broadwell-U Camarillo Device (rev 09)
 6 00:14.0 USB controller: Intel Corporation Wildcat Point-LP USB xHCI Controller (rev 03)
 7 00:16.0 Communication controller: Intel Corporation Wildcat Point-LP MEI Controller #1 (rev 03)
 8 00:1b.0 Audio device: Intel Corporation Wildcat Point-LP High Definition Audio Controller (rev 03)
 9 00:1c.0 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #1 (rev e3)
10 00:1c.1 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #2 (rev e3)
11 00:1c.2 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #3 (rev e3)
12 00:1c.3 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #4 (rev e3)
13 00:1c.4 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #5 (rev e3)
14 00:1d.0 USB controller: Intel Corporation Wildcat Point-LP USB EHCI Controller (rev 03)
15 00:1f.0 ISA bridge: Intel Corporation Wildcat Point-LP LPC Controller (rev 03)
16 00:1f.2 SATA controller: Intel Corporation Wildcat Point-LP SATA Controller [AHCI Mode] (rev 03)
17 00:1f.3 SMBus: Intel Corporation Wildcat Point-LP SMBus Controller (rev 03)
18 02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader (rev 01)
19 08:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8723BE PCIe Wireless Network Adapter
20 09:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller (rev 0a)
21 0a:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940M] (rev a2)

看到第19行的是无线网卡信息,且型号为RTL8723BE.

从网上看到RTL8723系列网卡都有这个频繁掉线的问题,只不过BE版本是更新的版本,添加了一个参数.

再来查看RTL8723BE这块网卡驱动的参数信息,

1 [email protected]:~$ modinfo rtl8723be
 2 filename:      /lib/modules/4.4.0-22-generic/kernel/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rtl8723be.ko
 3 firmware:      rtlwifi/rtl8723befw.bin
 4 description:    Realtek 8723BE 802.11n PCI wireless
 5 license:        GPL
 6 author:        Realtek WlanFAE    <[email protected]>
 7 author:        PageHe    <[email protected]>
 8 srcversion:    00619764255210776FAB54D
 9 alias:          pci:v000010ECd0000B723sv*sd*bc*sc*i*
10 depends:        rtlwifi,rtl_pci,btcoexist,mac80211
11 vermagic:      4.4.0-22-generic SMP mod_unload modversions
12 parm:          swlps:bool
13 parm:          swenc:using hardware crypto (default 0 [hardware])
14  (bool)
15 parm:          ips:using no link power save (default 1 is open)
16  (bool)
17 parm:          fwlps:using linked fw control power save (default 1 is open)
18  (bool)
19 parm:          msi:Set to 1 to use MSI interrupts mode (default 0)
20  (bool)
21 parm:          debug:Set debug level (0-5) (default 0) (int)
22 parm:          disable_watchdog:Set to 1 to disable the watchdog (default 0)
23  (bool)
24 parm:          ant_sel:Set to 1 or 2 to force antenna number (default 0)
25  (int)

看第12行到25行这几个参数,ips和fwlps是用来控制节能的,ant_sel是用来控制信号强度的.最主要的就是修改这几个参数的默认值.

首先我们把配置驱动的文件打开

[email protected]:~$ sudo nano /etc/modprobe.d/rtl8723be.conf

将如下参数黏贴到配置文件中:

options rtl8723be debug=1
options rtl8723be disable_watchdog=N
options rtl8723be fwlps=Y
options rtl8723be ips=Y
options rtl8723be msi=N
options rtl8723be swenc=N
options rtl8723be swlps=N
options rtl8723be ant_sel=2

保存配置文件后,运行如下命令来应用配置

[email protected]:~$ sudo modprobe -r rtl8723be
[email protected]:~$ sudo modprobe rtl8723be

是不是信号强了许多?