flexibeast.space - gemlog - 2021-06-26

Adventures with Realtek wifi on Linux

A couple of months ago, i bought a new ASUS Laptop D509DA. In researching its hardware, i learned that its built-in wifi was a Realtek device. i wasn't aware of Realtek devices being troublesome on Linux (unlike, say, Broadcom wifi), and there was indeed a driver in the Linux kernel tree for the chipset in question - rtl8821ce - so i went ahead and bought the machine. Unfortunately, however, the specific revision of that chipset was (in kernel 5.11.x) / is (in kernel 5.12.13) not yet supported. So on 2021-04-29, i sent an email to the linux-wireless list with some dmesg text:

rtw_8821ce 0000:01:00.0: enabling device (0000 -> 0003)
rtw_8821ce 0000:01:00.0: Firmware version 24.8.0, H2C version 12
rtw_8821ce 0000:01:00.0: rfe 4 isn't supported
rtw_8821ce 0000:01:00.0: failed to setup chip efuse info
rtw_8821ce 0000:01:00.0: failed to setup chip information
=> https://marc.info/?l=linux-wireless&m=161968427506696&w=2 -- Email to linux-wireless

The most recent update i've received so far is a message around 2021-05-12 from someone at Realtek:

I'd like to let you know that I don't forget this thing, and my colleague is working on this. If there's any update, I'll let you know. Please wait a while.

The bottom line was that i had no network connectivity on my new laptop[a]. Housemates of a partner offered several USB wifi adaptors, and it turned out only one worked: “Realtek Semiconductor Corp. RTL8188CUS 802.11n”, USB ID 0bda:8176. When i say “worked”, i mean, worked at all: the adaptor would only work on the 2.4GHz band, and, as a tiny dongle, its reception was .... not the best. Still, that was enough to keep me going.

One of the aforementioned housemates, however, was intrigued, and after doing some research, found a USB wifi adaptor said to be known to work on Void Linux systems. It arrived yesterday: branded “BrosTrend”[b], lsusb(1) reports it as “Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter”, USB ID 0bda:8176. Unfortunately, it didn't work out of the box. Okay; the housemate had found a DKMS[c]-based rtl8192cu driver available by running an install script[d]. i manually downloaded the shell script, scanned over it to check it wasn't doing anything obviously dodgy, then ran it. Unfortunately it failed to build the driver module, returning the error “GRO_DROP undeclared”. After some research, i found this diff from 2021-04-05:

GitHub commit

So i added a line of sed to the install script:

if is_command dkms; then
    sed -i 's/GRO_DROP/GRO_MERGED_FREE/' "/usr/src/rtl$_CHIP-$rtlversion/os_dep/linux/recv_linux.c"
    dkms remove -m "rtl$_CHIP" -v "$rtlversion" --all 2>/dev/null

The module built successfully, the adaptor is now working, and i now have 5GHz wifi on my laptop. Hopefully the “rfe 4 isn't supported” issue with the rtw_8821ce gets addressed eventually ....

🏷 ict


Gemlog Home

[a] It doesn't have an RJ-45 port, and even if it did, or one was added via USB, i rarely use my laptop close to an AP with RJ-45 ports.

[b] “BrosTrend 650Mbps Long Range Linux WiFi Adapter”

[c] Wikipedia: ‘Dynamic Kernel Module Support’

[d] https://deb.trendtechcn.com/