How to install TP-Link Archer Linux Drivers


Ah TP-Link, just like Netgear, are perfect examples of companies that don’t respect us, Linux users. Because we represent a small percentage compared to the wave of Windows or MacOS users. Always finding excuses like “No, but it’s complicated to compile our drivers for Linux” even though they are also on MacOS which is based on BSD. The world upside down. But I think it might change in the future and also, oh hope in the commercial conflict between the two world powers namely the United States and China, that we can have better compatibility between Linux users and companies that produce network equipment. Yes TP-Link, NetGear and Realtek, we’re waiting for you in this field (or come back to the field) Note: I’m referring to the Chinese government which is producing a sovereign OS based on Debian. Source: (ItsFoss Article about OpenKylin)

Context:

I have in my possession a TP-Link Archer TX20U wifi key, which promises so many beautiful things. But which is actually a vast joke on Windows. With the fact that it can’t switch from 2.4GHz to 5GHz like a grown-up. A shame when you want to be for all audiences. I had to go into the advanced configuration of the key to make the switch myself. The good joke was on Linux where the key is recognized as USB support and not Wifi. With command line, a Github repository and a little patience, we’re going to solve this.

In Action:

N.B.: I’m going to use an Ubuntu-based system. Please refer to the Github repository for other distributions.

Detect the device ID:

To start, we’re going to proceed with detecting the device ID. For this, we’ll use the following command:

lsusb

And we’ll get something like:

Bus 003 Device 005: ID 35bc:0100 Realtek 802.11ac WLAN Adapter

The advantage of lsusb is to have a list of all USB devices connected to the machine. Which is handy to know if our device is alive or not upstream. Which allows us to know if we’re on the right track or not. All that’s left is to paste the ID into our favorite search engine and find an answer. By chance, I found for myself a Github repository created by morrownr and the rest of the procedure will be based on his repository and his excellent Readme.md which helped me a lot.

Let’s get the Repository:

Going to the following link: morrownr/rtl8852bu, we’re going to proceed with retrieving the repository by doing a git clone.

git clone https://github.com/morrownr/rtl8852bu

We’ll therefore end up with a rtl8852bu folder in our current directory (*For my part, it’s in the home that I have my rtl8852bu folder). And before moving on to installing the driver via a script, we’ll directly get the necessary tools to install the driver. So let’s get the necessary tools: namely make and gcc

sudo apt install make gcc

and we can move on to the next step.

Installing the driver:

The Github repository we retrieved contains a script that will allow executing dkms to compile and install the driver. The advantage of this method is that we don’t need to compile the driver manually, everything is automated.

In our folder we should have these elements:

ls  
8852bu.conf         dkms-make.sh     install-driver.sh  phl
common.mk           docs             Kconfig            platform
core                edit-options.sh  LICENSE            README.md
default-editor.txt  FAQ.md           Makefile           remove-driver.sh
dkms.conf           include          os_dep             supported-device-IDs

We’re going to focus on the scripts install-driver.sh, edit-options.sh and remove-driver.sh.

To launch the driver installation script, we’ll do:

sudo ./install-driver.sh

From there, the script will take care of compiling the driver and installing it via dkms. If all goes well, we’ll have a confirmation message and you’ll be offered to modify the driver options. Which we’ll do to be able to configure the driver.

Let’s edit the driver options:

Logically during your installation, you’ll have nano starting and we’ll be able to modify the driver options. We can also modify them via the edit-options.sh script.

The modprode.d/8852bu.conf file will be read by nano and we’ll immediately remove a ’#’ in front of the following line:

# Purpose: Allow easy access to specific driver options.
#
# Edit the following line to change, add or delete options:
options 8852bu rtw_switch_usb_mode=0 rtw_he_enable=1 rtw_vht_enable=1 rtw_dfs_region_domain=0 rtw_wireless_mode=95>
#

From there, modprobe will understand the indications you’re going to give for the driver. Now you can modify the driver options as you wish. But for the example we’ll use my options which are adapted. The .conf file explains well the steps to follow. What I added is the following line:

rtw_wireless_mode=95

Which allows configuring the driver to support 2.4GHz and 5GHz and switch automatically. You can modify the options as you wish by going to the Wireless Mode part of the .conf and taking the values you want. Don’t worry, morrownr has thought of everything to make it simple.

After saving our settings on nano with Ctrl + X then Y and Enter, we’ll be able to validate the restart of our machine.

Updating the driver:

I think you’ll quickly understand that with kernel updates, you’ll have to expect your driver to jump or that it needs to be updated. To do this, you’ll have to return to the rtl8852bu folder and launch

sudo ./remove-driver.sh

This will remove the current driver. Then we’ll retrieve the latest data if there are updates from the Github repository, so

git pull

If we don’t have an update from the repository, we can skip this step.

And we can relaunch the installation script:

sudo ./install-driver.sh

And to finish, reproduce the same procedure for the .conf that I indicated above (See “Let’s edit the driver options”)

Conclusion:

It’s an excellent way to troubleshoot and use our wifi key on Linux. Certainly, there’s the update step following an update of your system which could become very redundant. But in the meantime, it helps. But I sincerely advise taking a wifi key or a wifi card that is compatible with Linux and the possibility to choose 2.4GHz or 5GHz.

In any case, no thanks to TP-Link and Realtek for this headache and I hope it will change one day when China will be in full Linux..

But a big thank you to morrownr for his Github repository!!! Github rtl8852bu