The TL-WDN7200H AC 1900 dual-band high-gain wireless USB network card with TP-LINK connected to the ThinkBook 14 IML of the notebook computer today supports 2.4GHz 600Mbps+5GHz 1300Mbps.
Windows 10 is directly supported without installing the driver. However, the CentOS Linux 8 system was in trouble, and there was no relevant driver support, so it could not be used.
View the current kernel version:
[ root@centos ~]# uname -aLinux centos 4.18.0-147.6.el8.x86_64 #1 SMP Tue Oct 1515:19:32 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Note: Remember the version number 4.18.0, it will be used to modify the code when compiling later.
To find the idea by compiling the driver by yourself, you must first find the chip manufacturer model.
List USB:
[ root@centos ~]# lsusbBus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hubBus 001 Device 005: ID 5986:2113 Acer, Inc Bus 001 Device 004: ID 27c6:55a4 Bus 001 Device 003: ID 18f8:1286[Maxxter] Bus 001 Device 002: ID 2357:0106 TP-Link Bus 001 Device 006: ID 8087:0aaa Intel Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
See Bus 001 Device 002: ID 2357:0106 TP-Link, extract ID 2357:0106, look up the information and find that the manufacturer of the wireless USB network card chip is realtek and the model is 8814au.
Find Realtek 8814AU USB WiFi driver on github, download and compile.
Note: To find this version rtl8814au v4.3.21_17997.20160531, do not look for the latest version.
The first error occurred during compilation:
/tmp/rtl8814au/os_dep/linux/os_intfs.c:914:22: error: initialization of‘u16(*)(struct net_device *, struct sk_buff *, struct net_device *,u16(*)(struct net_device *, struct sk_buff *, struct net_device *))’ {aka ‘short unsigned int(*)(struct net_device *, struct sk_buff *, struct net_device *, short unsigned int(*)(struct net_device *, struct sk_buff *, struct net_device *))’}from incompatible pointer type ‘u16(*)(struct net_device *, struct sk_buff *,void*,u16(*)(struct net_device *, struct sk_buff *, struct net_device *))’ {aka ‘short unsigned int(*)(struct net_device *, struct sk_buff *,void*, short unsigned int(*)(struct net_device *, struct sk_buff *, struct net_device *))’}[-Werror=incompatible-pointer-types].ndo_select_queue = rtw_select_queue,^~~~~~~~~~~~~~~~/tmp/rtl8814au/os_dep/linux/os_intfs.c:914:22: note:(near initialization for ‘rtw_netdev_ops.ndo_select_queue’)cc1: some warnings being treated as errorsmake[2]:***[scripts/Makefile.build:313:/tmp/rtl8814au/os_dep/linux/os_intfs.o] Error 1make[1]:***[Makefile:1547: _module_/tmp/rtl8814au] Error 2make[1]: Leaving directory '/usr/src/kernels/4.18.0-147.6.el8.x86_64'make:***[Makefile:1699: modules] Error 2
Open the os_dep/linux/os_intfs.c file in the rtl8814au directory and locate the rtw_select_queue function:
static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb#if LINUX_VERSION_CODE >=KERNEL_VERSION(3,13,0),void*accel_priv#if LINUX_VERSION_CODE >=KERNEL_VERSION(3,14,0), select_queue_fallback_t fallback#endif
# endif)
Change to the following:
static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb#if LINUX_VERSION_CODE >=KERNEL_VERSION(3,13,0) #if LINUX_VERSION_CODE >=KERNEL_VERSION(4,18,0), struct net_device *sb_dev #else,void*accel_priv #endif #if LINUX_VERSION_CODE >=KERNEL_VERSION(3,14,0)& LINUX_VERSION_CODE <KERNEL_VERSION(5,2,0), select_queue_fallback_t fallback #endif#endif)
Continue to compile and find the second error:
/tmp/rtl8814au/os_dep/linux/rtw_android.c: In function ‘rtw_android_priv_cmd’:/tmp/rtl8814au/os_dep/linux/rtw_android.c:615:62: error: macro "access_ok" passed 3 arguments, but takes just 2if(!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)){^/tmp/rtl8814au/os_dep/linux/rtw_android.c:615:7: error: ‘access_ok’ undeclared(first use inthisfunction)if(!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)){^~~~~~~~~/tmp/rtl8814au/os_dep/linux/rtw_android.c:615:7: note: each undeclared identifier is reported only once for each function it appears inmake[2]:***[scripts/Makefile.build:313:/tmp/rtl8814au/os_dep/linux/rtw_android.o] Error 1make[1]:***[Makefile:1547: _module_/tmp/rtl8814au] Error 2make[1]: Leaving directory '/usr/src/kernels/4.18.0-147.6.el8.x86_64'make:***[Makefile:1699: modules] Error 2
Open the os_dep/linux/rtw_android.c file in the rtl8814au directory and locate the rtw_android_priv_cmd function:
if(!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)){
Change to the following:
# if(LINUX_VERSION_CODE >=KERNEL_VERSION(4,18,0))if(!access_ok(priv_cmd.buf, priv_cmd.total_len)){#elseif(!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)){#endif
Continue to compile and pass normally!
Finally, you can see that 8814au.ko has been generated:
LD [M]/tmp/rtl8814au/8814au.o Building modules, stage 2. MODPOST 1 modules CC /tmp/rtl8814au/8814au.mod.o LD [M]/tmp/rtl8814au/8814au.komake[1]: Leaving directory '/usr/src/kernels/4.18.0-147.6.el8.x86_64'
Use load module after installation:
modprobe 8814au
cat /proc/kmsg can see:
<4>[19967.549960] RTL871X: module init start<4>[19967.549961] RTL871X: rtl8814au v4.3.21_17997.20160531<4>[19967.671171] RTL871X:rtw_ndev_init(wlan0) if1 mac_addr=08:1f:71:24:64:8a<6>[19967.671505] usbcore: registered newinterface driver rtl8814au<4>[19967.671507] RTL871X: module init ret=0<6>[19967.682791] rtl8814au 1-3:1.0 wlp0s20f0u3: renamed from wlan0<6>[19967.697724] IPv6:ADDRCONF(NETDEV_UP): wlp0s20f0u3: link is not ready<6>[19968.104292] IPv6:ADDRCONF(NETDEV_UP): wlp0s20f0u3: link is not ready<6>[19968.106996] IPv6:ADDRCONF(NETDEV_UP): wlp0s20f0u3: link is not ready<6>[19968.121708] IPv6:ADDRCONF(NETDEV_UP): wlp0s20f0u3: link is not ready<4>[19971.176837] RTL871X: nolinked power save enter<6>[19971.191472] IPv6:ADDRCONF(NETDEV_UP): wlp0s20f0u3: link is not ready<4>[19971.617442] RTL871X: nolinked power save leave<4>[19974.653364] RTL871X:rtw_set_802_11_connect(wlp0s20f0u3) fw_state=0x00000008<4>[19974.859910] RTL871X: start auth<4>[19974.862100] RTL871X: auth success, start assoc<4>[19974.880289] RTL871X:rtw_cfg80211_indicate_connect(wlp0s20f0u3) BSS not found !!<4>[19974.880316] RTL871X: assoc success<4>[19975.010392] RTL871X: recv eapol packet<4>[19975.010619] RTL871X: send eapol packet<4>[19975.013448] RTL871X: recv eapol packet<4>[19975.013527] RTL871X: send eapol packet<4>[19975.013596] RTL871X:set pairwise key camid:4, addr:74:05:a5:01:23:45, kid:0, type:AES<6>[19975.013730] IPv6:ADDRCONF(NETDEV_CHANGE): wlp0s20f0u3: link becomes ready<4>[19975.014452] RTL871X:set group key camid:5, addr:74:05:a5:01:23:45, kid:2, type:AES
You can already connect to the WIFI normally!
Note: This article is original by Toyo Lau and may not be reproduced on any platform without permission. If you need to reprint, contact the author~. Or you can directly technical exchange group: 734638086. Pay attention to the WeChat official account: Technical Training Camp (WeChat ID: TechBootcamp) for more information~
Recommended Posts