How to add drivers for RTL8811cu to OpenWrt

Hi, I am using openwrt with TP-Link TL-WR1043ND v1. I've just got a RTL-8811cu USB network adapter that I'd like to connect at the USB port but I did not find adequate drivers.

I noticed there are linux drivers for this device at https://github.com/brektrou/rtl8821CU

I don't know how difficult could it be to use this driver with my hardware platform, this is why I am posting here, in order to get some orientation about this subject.

Thanks!

Mauricio

That's a slightly butchered up vendor driver, which isn't compatible to nl80211 (still using its own kernel 2.6.16 derived ieee80211softmac wireless stack) - as a consequence AP mode won't be possible, even if you package up that driver. Furthermore USB throughput on your router is around 4 MByte/s, a far cry of the speed 802.11ac requires (you'd probably run into OOM conditions as well, as your second radio will need quite some RAM as well).

If you have a little patience while checking your local used markets, you may find quite decent OpenWrt supported concurrent dual-band 802.11ac routers for surprisingly cheap prices (~20 EUR or USD, less if you're lucky).

Hi, thank you for your answer.

I don't need AP mode. I just want to use this tiny adapter to link in client mode to a distant location. Reduced bandwidth isn't a concern neither. I'm lost at how to get that driver working in my own router.

You will have to package it up as an OpenWrt (source-) package, similar to the others. Pretty much by definition the USB WLAN card will have worse reception characteristics than using the native WLAN capabilities of your router (much smaller antennas, too close to each other); this won't actually help you.

Hi, thanks for the comments.

This adapter has an sma-rp connector where you can attach any antenna you like.

Let me see if I am understanding: Do I have to upload the source code for the driver to a repository and wait for it to be compiled and available for my platform?

No, you can (and need to) start with local modifications of the repo and build it yourself.

Recent Realtek chipsets such as RTL8812AU actually supports AP mode, but since it is a cfg80211/nl80211 driver, it probably does not work with LuCI. You may need your own script to bring up the device and run the hostapd instance.

@mautas
You can refer to the rtl8812au-ct package and see if you can package the rtl8811cu driver for OpenWrt.

EDIT:
According to Jes Sorensen's presentation, Realtek's development process is like:

1. Respin hardware
2. cp -a driver-<oldchip> driver-<newchip>
3. Hack driver-<newchip>
4. Release driver-<newchip>
5. goto 1
2 Likes

Any news here? I want to use a raspberry pi 4B as a travelmate. Therefore I need a second network adapter / radio to connect to a Hotspot and the internal to serve as an access point.
I have a USB dingle with the RTL8811CU but can't get it working.
Did anyone manage to compile a driver package that works on OpenWRT yet?
Or is there another chipset recommended for this usecase that is supported and has already working drivers?

Do yourself a favour and get different hardware for this purpose. The RPi's wifi is already below expectations, but Realtek USB wireless is pure madness.

A cheap (maybe second hand) ath79- or mt7621a based concurrent dual-band device will run circles around an RPi or RTL8811CU in terms of wireless features, performance and stability.

I Just need the device temporarily. My girlfriend moves into a house where she could use a Vodafone wifi Hotspot for the next few months until she gets her own internet.
Therefore I want to put an OpenWRT box there, that connects to the Hotspot with the travelmate service and logs in with a script. Then she can connect all her devices to the Raspberry Pi Router without having to log in via a web interface anymore.
I don't need high speed internet and also the signal strength is not an issue.
Can you recommend a cheap USB wifi stick (chipset) that has driver support and would work for this purpose?

Has anyone succeeded adding the RTL8821CU to work on OpenWRT?
I was trying to follow this:

XinRoom/Openwrt_rtl8811cu: Openwrt Driver For RTL8811CU, RTL8821CU (github.com)

My OpenWRT is compiled version for Orange Pi from this:
walmartshopper/openwrt-orangepi-r1-plus: OpenWrt repo with patches for Orange Pi R1 Plus support (github.com)

OpenWrt 22.03.2
Xunlong Orange Pi R1 Plus LTS

And when I try to compile I get this:

<command-line>: note: this is the location of the previous definition
/home/hugo/openwrt-orangepi-r1-plus/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/rtl8821cu-2022-05-20-7033001f/os_dep/linux/ioctl_cfg80211.c: In function 'rtw_cfg80211_ch_switch_notify':
/home/hugo/openwrt-orangepi-r1-plus/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/rtl8821cu-2022-05-20-7033001f/os_dep/linux/ioctl_cfg80211.c:469:17: error: too few arguments to function 'cfg80211_ch_switch_started_notify'
  469 |                 cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/hugo/openwrt-orangepi-r1-plus/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/rtl8821cu-2022-05-20-7033001f/include/osdep_service_linux.h:98,
                 from /home/hugo/openwrt-orangepi-r1-plus/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/rtl8821cu-2022-05-20-7033001f/include/osdep_service.h:54,
                 from /home/hugo/openwrt-orangepi-r1-plus/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/rtl8821cu-2022-05-20-7033001f/include/drv_types.h:27,
                 from /home/hugo/openwrt-orangepi-r1-plus/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/rtl8821cu-2022-05-20-7033001f/os_dep/linux/ioctl_cfg80211.c:17:
/home/hugo/openwrt-orangepi-r1-plus/staging_dir/target-aarch64_generic_musl/usr/include/mac80211/net/cfg80211.h:7804:6: note: declared here
 7804 | void cfg80211_ch_switch_started_notify(struct net_device *dev,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[5]: *** [scripts/Makefile.build:286: /home/hugo/openwrt-orangepi-r1-plus/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/rtl8821cu-2022-05-20-7033001f/os_dep/linux/ioctl_cfg80211.o] Error 1
make[4]: *** [Makefile:1832: /home/hugo/openwrt-orangepi-r1-plus/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/rtl8821cu-2022-05-20-7033001f] Error 2
make[4]: Leaving directory '/home/hugo/openwrt-orangepi-r1-plus/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.146'
make[3]: *** [Makefile:81: /home/hugo/openwrt-orangepi-r1-plus/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/rtl8821cu-2022-05-20-7033001f/.built] Error 2
make[3]: Leaving directory '/home/hugo/mypackages/rtl8811cu'
time: package/feeds/mypackages/rtl8811cu/compile#55.67#8.03#63.99
    ERROR: package/feeds/mypackages/rtl8811cu failed to build.
make[2]: *** [package/Makefile:116: package/feeds/mypackages/rtl8811cu/compile] Error 1
make[2]: Leaving directory '/home/hugo/openwrt-orangepi-r1-plus'
make[1]: *** [package/Makefile:110: /home/hugo/openwrt-orangepi-r1-plus/staging_dir/target-aarch64_generic_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/hugo/openwrt-orangepi-r1-plus'
make: *** [/home/hugo/openwrt-orangepi-r1-plus/include/toplevel.mk:230: world] Error 2

There's a reason why RTL wireless is highly discouraged.

1 Like

I backported from linux 6.2 to OpenWrt master branch the rtl8821cu rtl8822cu/bu rtl8723du drivers, I have a rtl882cu USB dongle, is working stable as client mode, as AP sometimes crashes.

3 Likes

Thank you so much .. I'll try to work on it =D

How do you know that this specific router has 4 megabytes/sec USB2.0 rate?
I disagree. USB2 spec works around 30 megabytes/sec and if you was capped at 4mb from transferring files from usb to router you better blame it on the flash drive read/write speeds than the router.
USB communicates with the processor and if the processor speeds handle 4 megs only why the hell you have gigabit ports on this router ?
Should be able to get 30 megabytes/sec w/ wifi adapter unless there's stable evidence of the opposite that you can share.

I don't know about you, but I blame its 400 MHz mips 74Kc core, which can't keep the rather CPU intensive USB 2.0 bus busy. And yes, I'm speaking out of personal experience with this device and others of its vintage (and ~comparable performance), you need more than that on the CPU side, to max out USB 2.0 transfer rates.

1 Like

As I suspected you're WRONG and I beg you to do not give people false information without double or triple checking. I have the same router and installed USB rndis tethering from phone to router and was able to achieve 172mbits on speedtest and if I had 240mbits it would max out the USB2. 400 MHz mips isn't problem to handle all that throughput !

How do I install those?