rtl8812AU and/or rtl8814AU drivers

This way I know, but I don't like to directly modify any Makefiles files to be safe from any incompatibility from the source. And I was quite surprised that the Linux version was as a bolean in the menuconfig, but was not able to change it.

Now I have 4.14.95 and when used git pull, I received 4.14.99. I've updated the packages as well with make package/symlinks, make menuconfig and only save without changes. Than make -j4.

I got:

Firmware Version OpenWrt SNAPSHOT r9103+252-45a2771 / LuCI Master (git-19.046.39448-bd56c1a)
Kernel Version 4.14.99

Configured WiFi AP, WPA2 and passwd and stored.
Wireless status:

Type: MAC80211 802.11bgn
Channel: 11 (2.462 GHz)
Bitrate: -
[Signal: 0 dBm / Quality: 0%] SSID: OpenWrt
Mode: Master
Encryption: WPA2 PSK (CCMP)
Associations: -

But when try to connect, it hangs.

Edit: compiled the 4.19.21 kernel and the result is the same.
Edit 2: I've updated the rtl8189fs driver to the latest 2018-09-02 version, but no change, still hangs.
BTW, for sure, I've tested several boards, SD cards and power supply to eliminate it.

@jgrulich I have not tried AP mode, I am just using it as a WLAN client to Ethernet bridge. Then very likely in AP mode I will have the same issue.

@kestrel Please try the AP mode than if the issue appears.

@jgrulich Thanks for the mod,I got the rtl8812 usb wifi dongle working, based on your information, I build a snapshot image found on this commit: https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=e9d92bf1e1af71ff19e4cdc753de3f65963c58a5 tried on raspberry pi 3 b ,AP and STA are working.

Sun Feb 17 11:58:34 2019 kern.info kernel: [   50.571092] usb 1-1.3: new high-speed USB device number 5 using dwc_otg
Sun Feb 17 11:58:34 2019 kern.info kernel: [   50.701852] usb 1-1.3: New USB device found, idVendor=20f4, idProduct=805b
Sun Feb 17 11:58:34 2019 kern.info kernel: [   50.711684] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Sun Feb 17 11:58:34 2019 kern.info kernel: [   50.721881] usb 1-1.3: Product: AC1200 Dual Band USB Adapter
Sun Feb 17 11:58:34 2019 kern.info kernel: [   50.730294] usb 1-1.3: Manufacturer: Realtek
Sun Feb 17 11:58:34 2019 kern.info kernel: [   50.737193] usb 1-1.3: SerialNumber: 123456
Sun Feb 17 11:58:35 2019 kern.warn kernel: [   51.007966] RTL871X: rtw_ndev_init(wlan1)
Sun Feb 17 12:01:22 2019 user.notice mac80211: Failed command: iw phy phy1 set antenna all all
Sun Feb 17 12:01:22 2019 daemon.notice netifd: radio1 (1956): command failed: No such device (-19)
Sun Feb 17 12:01:22 2019 user.notice mac80211: Failed command: iw phy phy1 interface add wlan1 type __ap
Sun Feb 17 12:01:48 2019 daemon.err hostapd: Configuration file: /var/run/hostapd-phy1.conf
Sun Feb 17 12:01:48 2019 kern.info kernel: [  244.440981] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not ready
Sun Feb 17 12:01:48 2019 kern.info kernel: [  244.451809] br-lan: port 2(wlan1) entered blocking state
Sun Feb 17 12:01:48 2019 kern.info kernel: [  244.459504] br-lan: port 2(wlan1) entered disabled state
Sun Feb 17 12:01:48 2019 kern.info kernel: [  244.467434] device wlan1 entered promiscuous mode
Sun Feb 17 12:01:48 2019 daemon.notice hostapd: wlan1: interface state UNINITIALIZED->COUNTRY_UPDATE
Sun Feb 17 12:01:48 2019 daemon.notice hostapd: wlan1: interface state COUNTRY_UPDATE->HT_SCAN
Sun Feb 17 12:01:49 2019 daemon.notice hostapd: Switch own primary and secondary channel to get secondary channel with no Beacons from other BSSes
Sun Feb 17 12:01:49 2019 daemon.err hostapd: Using interface wlan1 with hwaddr xx:xx:97:2f:41:b0 and ssid "RTL8812"
Sun Feb 17 12:01:49 2019 kern.warn kernel: [  245.352631] RTL871X: assoc success
Sun Feb 17 12:01:49 2019 kern.info kernel: [  245.357126] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
Sun Feb 17 12:01:49 2019 kern.info kernel: [  245.364687] br-lan: port 2(wlan1) entered blocking state
Sun Feb 17 12:01:49 2019 kern.info kernel: [  245.371074] br-lan: port 2(wlan1) entered forwarding state
Sun Feb 17 12:01:49 2019 daemon.notice hostapd: wlan1: interface state HT_SCAN->ENABLED
Sun Feb 17 12:01:49 2019 daemon.notice hostapd: wlan1: AP-ENABLED
Sun Feb 17 12:01:49 2019 kern.warn kernel: [  245.379354] RTL871X: set group key camid:1, addr:00:00:00:00:00:00, kid:1, type:AES
Sun Feb 17 12:01:49 2019 daemon.notice netifd: Network device 'wlan1' link is up
Sun Feb 17 12:02:21 2019 daemon.info hostapd: wlan1: STA xx:xx:a2:58:32:09 IEEE 802.11: associated
Sun Feb 17 12:02:21 2019 kern.warn kernel: [  277.395952] RTL871X: send eapol packet
Sun Feb 17 12:02:21 2019 kern.warn kernel: [  277.403077] RTL871X: set group key camid:1, addr:00:00:00:00:00:00, kid:1, type:AES
Sun Feb 17 12:02:21 2019 kern.warn kernel: [  277.427971] RTL871X: send eapol packet
Sun Feb 17 12:02:21 2019 daemon.notice hostapd: wlan1: AP-STA-CONNECTED xx:xx:a2:58:32:09
Sun Feb 17 12:02:21 2019 daemon.info hostapd: wlan1: STA xx:xx:a2:58:32:09 RADIUS: starting accounting session 8FE7BE82C78E5CD9
Sun Feb 17 12:02:21 2019 daemon.info hostapd: wlan1: STA xx:xx:a2:58:32:09 WPA: pairwise key handshake completed (RSN)
Sun Feb 17 12:02:21 2019 kern.warn kernel: [  277.435945] RTL871X: set pairwise key camid:4, addr:xx:xx:a2:58:32:09, kid:0, type:AES
Sun Feb 17 12:02:21 2019 daemon.info dnsmasq-dhcp[1119]: DHCPREQUEST(br-lan) 192.168.1.199 xx:xx:a2:58:32:09
Sun Feb 17 12:02:21 2019 daemon.info dnsmasq-dhcp[1119]: DHCPACK(br-lan) 192.168.1.199 xx:xx:a2:58:32:09 iPhone-SE
1 Like

@jeff1 Good to know. Yes I've tested this snapshot version on several different boards and WiFi devices and it works. But it's the really latest commit which works, because the exactly next one commit is mac80211: rebase ontop of v4.18.5 which is not compatible with the mentioned drivers and cause the kernel panic.
It's confirmed, that there is not issue with the kernel itself and it works with the latest 4.14.99 kernel too.
See this:

@jgrulich Hi, I confirm the kernel panics in AP mode with 4.14.98 and 4.19.20. Furthermore, I have set up the openwrt as bridge from wlan to ethernet. Unfortunatly even though the station mode works with the kernels above, there is no reliable connection. I have tried everything, turn off USB, just run with one or two CPU cores instead of all 4, switch back to fast ethernet, etc. I also tried 4.14.72, which you reported as the last working AP mode release. But under heavy network load, the 8189 driver disconnects and reestablishes the connections which causes about 30-50seconds connection outage. The working connection under load lasts about 20-40 seconds before disconnect. Indicating messages in the kernel are:
[ 105.377549] RTL871X: linked_status_chk(wlan0) disconnect or roaming
[ 108.970949] RTL871X: nolinked power save enter
[ 109.790298] RTL871X: nolinked power save leave
[ 111.571137] RTL871X: rtw_set_802_11_connect(wlan0) fw_state=0x00000008
[ 112.561488] RTL871X: start auth
I thought it was a power problem of the board itself, however then I tried armbian with the 4.19.13 kernel and the rtl8189ftv drivers, that are part of it. And it just works, no disconnects, etc. I tried to find the sources for the 4.19.13 kernel, but they do not seem to be there in the official armbian source repository at github (it shows a 3.4.113 kernel).
Its a pity, thats that hard or even impossible to get openwrt working, but for now, I give up testing, since I have now set up armbian with a NATed bridge and it works fine.

Thanks for sharing your insights.

@kestrel Yes, the stability is another issue of most of new drivers and is valid here too.
Even when connected, the speed varies a lot.
I may confirm, that Armbian is for now well supported and stable distro. I've tried to build the openwrt on top of it, but no success and the source code is not directly available as you've mentioned too. The only way how to get it is to use their build tools which will download all the SDK.

The same on 8812au and kernel 4.14.98 , I've tested AP with PSK2 and NONE encryption
Openwrt distro has very old driver 4.3.x.x , stable version for 8812au is 5.1.5 or 5.2.20

@jgrulich Well, the driver is not really new. I downloaded the SDK for armbian and copied over just the sources for the rtl8189fs driver into the openwrt build directory. The result is the same, the driver compiles just fine and then it has the same disconnect issues, there does not seem to be much difference in the the driver sources though. The problem must be somewhere else, e.g. in the mac80211 layer or kernel. Any ideas where to start searching?

$5 on ethtool :slight_smile:

"hostapd can be built with tracing code that will track and analyze memory allocations and other resource registrations and certain API uses. ... The trace code can be enabled with CONFIG_WPA_TRACE=y build option"
https://w1.fi/wpa_supplicant/devel/testing_tools.html

in OpenWrt:
build_dir/target-*/hostapd-full-openssl/hostapd-2018-12-02-c2c6c01b/hostapd/defconfig


# Enable tracing code for developer debugging
# This tracks use of memory allocations and other registrations and reports
# incorrect use with a backtrace of call (or allocation) location.
#CONFIG_WPA_TRACE=y

Update: I can't build with trace code (execinfo.h not exist in openwrt distro)

In file included from ../src/utils/trace.c:16:0:
../src/utils/trace.h:15:10: fatal error: execinfo.h: No such file or directory
 #include <execinfo.h>
          ^~~~~~~~~~~~
compilation terminated.

That only confirmed what I've already wrote before. The driver is quite old, but is not the major issue. I've updated to the latest version from the git, but no difference.
The Linux kernel is not the issue, or at least the result is the same from 4.14.25 to 4.14.101. The major issue is with the mac80211. The latest somehow working version is 2017-11-01 and when upgraded to the 4.18.5 it results into kernel panic. The same result for any 4.19. and it can't be build with the 2017 mac80211 version.
@kestrel Please look into the Armbian SDK and try the mac80211 from there for the OpenWrt compilation. Guess that the most important will be the set of patches, because it probably will use the same source kernel drivers.

@jgrulich Mmh, the interesting part is that net/mac80211 gets compiled at armbian (there are lots of .o files after completing the build), while in the openwrt folder neither in the backports nor in the kernel folder there are any .o files in net/mac80211. There is not even a mac80211.o or .ko in the whole openwrt build tree.

@kestrel exactly the mac80211.ko is not needed for rlt driver itself. It's enough to have cfg80211.ko which is loaded as dependency to 8189fs.ko.

I've tried to use both files from Armbian, but cfg80211.ko need satisfy dependency to rfkill, which is not available in OpenWrt source.
To have compatible kernel, I've tried to use the Armbian's /boot, but even the kernel starts, it halts somewhere and then reboots. But don't know what happens, because there is not output on the serial.
There is only:

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[   43.857279] reboot: Restarting system

Edit. This is the full verbosity output:

[    4.273669] sunxi-mmc 1c10000.mmc: allocated mmc-pwrseq
[    4.509368] sunxi-mmc 1c10000.mmc: initialized, max. request size: 16384 KB
[    4.534267] mmc1: new high speed SDIO card at address 0001
[    4.801465] random: fast init done
[   45.532057] reboot: Restarting system

No idea, what is random function which probably cause system halt.
The reboot is than probably caused by watchdog.

How you did the build, kernel 4.9 is assigned for RPI3 in this git version (8812au required 4.14)

I've used the Armbian kernel and most of the system works well, included the WiFi:

Hostname OpenWrt
Model Xunlong Orange Pi Zero
Architecture ARMv7 Processor rev 5 (v7l)
Firmware Version OpenWrt SNAPSHOT unknown / LuCI Master git-19.046.56017-7f791e9)
Kernel Version 4.19.20-sunxi

Exactly it's running on OPi-R1 board, not Zero.

But there are missing some OpenWrt specific kernel modules which are not available in Armbian and need to be replaced by some Armbian alternative:

root@OpenWrt:~# dmesg | grep "kmodloader: failed to load"
[    9.673861] kmodloader: failed to load rtc-sunxi
[   10.025866] kmodloader: failed to load crc-ccitt
[   10.063430] kmodloader: failed to load nf_conntrack_rtcache
[   10.063720] kmodloader: failed to load nf_flow_table_hw
[   10.068321] kmodloader: failed to load xt_FLOWOFFLOAD

Another, but not so important issue is the LED triggering which omits netdev/wlan0 status which indicates the WiFi working.

@Piorun2002 Yes you right, kernel need to be upgrade to 4.14 on that snapshot or build on master with mac80211 driver from 2017-11-01,you can take at look at my source:

@jgrulich I had a look at the kernel config in openwrt and tried to activate mac80211, after building the kernel I got duplicate symbol problems cfg80211_something during startup. So my guess is, that in armbian, parts of the cfg80211 layer from the net/mac80211 sources is used, but in openwrt the kernel builtin cfg80211 is used, which causes the differences. If I have some time, I will further research that.

Which versions / tags I should download exactly to build openwrt for RPI with 8812au?