Raspberry Pi 4B, OpenWrt 22.03, mt7921au, AP not functional

I'm running a Raspberry Pi 4B with OpenWrt 22.03 and a Comfast CF-953AX wifi USB network adapter with the Mediatek mt7921au chipset. I'm unable to get the adapter to initialize in AP/Master mode.
In Luci it says "device is not active"/"wireless is not associated". I've installed both packages for this adapter (kmod-mt7921e & kmod-mt7921u). I'm receiving the errors below:

daemon.err hostapd: Driver does not support configured HT capability [LDPC].

I'm able to get past that error by adding option ldpc '0' to /etc/config/wireless... Only to come up with 3 more similar errors. Adding the below options bypassed those errors:

option ldpc '0'
option tx_stbc '0'
option rx_stbc '0'
option max_amsdu '0'

Once I got past the above errors I receive this error:

Configured VHT capability [VHT_CAP_MAX_MPDU_LENGTH_MASK] exceeds max value supported by the driver (2 > 0)

I'm also receiving hostapd errors regarding invalid arguments and failed permissions (also bolded below)

Is anybody else trying to configure a similar Raspberry Pi 4B Wifi 6 access point, or has experience with getting these adapters functional in OpenWrt?

logread:

Sat Sep 17 02:26:02 2022 daemon.notice netifd: radio1 (2203): Failed to create interface wlan0
Sat Sep 17 02:26:02 2022 daemon.notice hostapd: Configuration file: /var/run/hostapd-phy0.conf (phy wlan0) --> new PHY
Sat Sep 17 02:26:02 2022 kern.info kernel: [ 313.216398] br-lan: port 2(wlan0) entered blocking state
Sat Sep 17 02:26:02 2022 kern.info kernel: [ 313.224484] br-lan: port 2(wlan0) entered disabled state
Sat Sep 17 02:26:02 2022 kern.info kernel: [ 313.232448] device wlan0 entered promiscuous mode
Sat Sep 17 02:26:02 2022 daemon.err hostapd: Driver does not support configured HT capability [LDPC]
Sat Sep 17 02:26:02 2022 daemon.notice hostapd: wlan0: interface state UNINITIALIZED->DISABLED
Sat Sep 17 02:26:02 2022 daemon.notice hostapd: wlan0: AP-DISABLED
Sat Sep 17 02:26:02 2022 daemon.err hostapd: wlan0: Unable to setup interface.
Sat Sep 17 02:26:02 2022 daemon.notice hostapd: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Sat Sep 17 02:26:03 2022 kern.info kernel: [ 313.282783] device wlan0 left promiscuous mode
Sat Sep 17 02:26:03 2022 kern.info kernel: [ 313.291243] br-lan: port 2(wlan0) entered disabled state
Sat Sep 17 02:26:03 2022 daemon.err hostapd: rmdir[ctrl_interface=/var/run/hostapd]: Permission denied
Sat Sep 17 02:26:03 2022 daemon.notice hostapd: wlan0: CTRL-EVENT-TERMINATING
Sat Sep 17 02:26:03 2022 daemon.err hostapd: hostapd_free_hapd_data: Interface wlan0 wasn't started
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): Command failed: ubus call hostapd config_add {"iface":"wlan0", "config":"/var/run/hostapd-phy0.conf"} (Invalid argument)
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): Usage: ubus [arguments...]
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): Options:
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): -s : Set the unix domain socket to connect to
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): -t : Set the timeout (in seconds) for a command to complete
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): -S: Use simplified output (for scripts)
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): -v: More verbose output
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): -m : (for monitor): include a specific message type
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): (can be used more than once)
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): -M <r|t> (for monitor): only capture received or transmitted traffic
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203):
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): Commands:
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): - list List objects
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): - call Call an object method
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): - subscribe [...] Subscribe to object(s) notifications
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): - listen [...] Listen for events
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): - send Send an event
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): - wait_for [...] Wait for multiple objects to appear on ubus
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): - monitor Monitor ubus traffic
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203):
Sat Sep 17 02:26:03 2022 daemon.notice netifd: radio1 (2203): Device setup failed: HOSTAPD_START_FAILED
Sat Sep 17 02:26:03 2022 daemon.notice netifd: Wireless device 'radio1' set retry=0
Sat Sep 17 02:26:03 2022 daemon.crit netifd: Wireless device 'radio1' setup failed, retry=0
Sat Sep 17 02:26:03 2022 daemon.notice netifd: Wireless device 'radio1' is now down

Have you used this adapter for AP mode in the past? Not all USB adapters support AP mode in general, so this one may be part of that group.

Have you used this adapter for AP mode in the past? Not all USB adapters support AP mode in general, so this one may be part of that group.

I'm not the OP but can answer as I have an adapter ( CF-951AX ) with the same chipset ( mt7921au ) and I use it with my wifi router ( ZyXEL NBG6817 ) and OpenWRT 22.03. In my case, after loading the two packages the OP loaded, I was able to set the interface up with Luci and things worked fine in WiFi 6 mode. I was also able to turn 6 GHz band on but I had to edit /etc/config/wireless to do that as Luci is just not WiFi 6e capable yet.

So, the answer is yes, this adapter can handle AP mode in several bands. The problem looks specific to Raspberry Pi 4B.

For more info on the adapters:

Select menu item 2.

Of note: Word is that ALFA will be releasing a couple of new adapters based on this WiFi 6e chipset soon. The driver for this chipset is already mainlined in the Linux kernel. The devs here were kind enough to backport it to kernel 5.10.

Regards

1 Like

Thanks @psherman, yeah the adapter supports AP mode as others have been able to get it working essentially plug-and-play in other distros and with OpenWrt on other platforms (as long as you install both necessary kmods). Per iw list it also has the capability.

Supported interface modes:
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor

I think ones with Mediatek chipsets do.
Most of them anyways.

Thanks for the info. I am not an expert on the USB-wifi adapters and chipsets, but I do know that some are better than others for various purposes (and generally that a proper wifi AP will outperform basically all USB adapters).

I had raised the quoted point because I wanted to make sure that the OP (and future readers) look at the supported operating modes for the adapters they are using/considering. Obviously in this case, the chipset supports AP mode.

I got it to work on a 3B+, will try this week on 4B. Did you compile your own install image? Thats how I got it to work and also installed the latest version of driver files called WIFI_MT7961_patch_mcu_1_2_hdr.bin and WIFI_MT7922_patch_mcu_1_1_hdr.bin

I feel like I read only works on 32bit and a usb2 port, not a usb3 port..

https://black.jmyntrn.com/2022/09/17/comfast-cf-953ax-with-openwrt-on-a-raspberry-pi-3b/

you had me curious... so I tried it and it worked right away!

I just posted this article with details.

1 Like

How to Install or Update mt7921au firmware files on OpenWRT

Download firmware files to Linux PC

Go to the following site:

https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/mediatek

Click on WIFI_MT7961_patch_mcu_1_2_hdr.bin

Click on plain

Save file

Click on WIFI_RAM_CODE_MT7961_1.bin

Click on plain

Save file

ssh to OpenWRT router (Putty or other) (make sure a non null password was previously set)

cd /lib/firmware

mkdir mediatek

On Linux PC:

$ scp WIFI_RAM_CODE_MT7961_1.bin root@192.168.1.1:/lib/firmware/mediatek
$ scp WIFI_MT7961_patch_mcu_1_2_hdr.bin root@192.168.1.1:/lib/firmware/mediatek

WIFI_MT7922_patch_mcu_1_1_hdr.bin

The above is not a firmware file for mt7921au. Look for MT7961.

Thanks for this @black_jmyntrn.

I feel like I read only works on 32bit and a usb2 port, not a usb3 port..

If I'm reading that correctly and it only works on a USB2 port unfortunately it's limited to 480Mbps, well below the adapter's rated throughput. Shucks.

On a fresh install of OpenWrt 22.03.2 64bit on a Raspberry Pi4 after upgrading the firmware as described, I still receive the same errors I did previously and the adapter does not function.

But if I unplug the adapter and plug it back in again the adapter functions - I'm able to connect to it.in AX mode. This is awesome, it's a great start.

Now to find a solution that doesn't require physical interaction.. As far as I'm aware it's not possible to disable/enable/restart USB on the Raspberry Pi on a per-port basis, you have to reset the entire bus. I could be incorrect but a similar work-around would be nice until the issue is permanently resolved.

Thanks for your efforts.

Thank you very much @nick59 for detailing this process. I'm stuck with a Windows machine to scp the firmware over so I used Putty which comes with pscp command line util, worked great.

Hey @RPi , that manual intervention is not what we are looking for. I'm running OpenWRT 22.03.2 on my ZyXEL NBG6817 which has a USB3 port for the cf-951ax adapter. Things are working good. AX works. With manual intervention in /etc/config/wireless I think I have 6Ghz going but I don't have another 6GHz device so have no way to check yet. The manual intervention is because Luci is not there yet. I run RasPiOS on my Pi4B with hostapd. You have to compile a new kernel and a few other things to get there but I am not seeing the manual intervention on my Pi4B so it looks like this may be an OpenWRT (for Pi4B) issue.

Can't wait until Alfa kicks out a high power mt7921au based usb wifi adapter.

shouldnt all line items have a driver assigned to it?

T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
D:  Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0e8d ProdID=7961 Rev= 1.00
S:  Manufacturer=MediaTek Inc.
S:  Product=Wireless_Device
S:  SerialNumber=000000000
C:* #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=100mA
A:  FirstIf#= 0 IfCount= 3 Cls=e0(wlcon) Sub=01 Prot=01
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=125us
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:  If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E:  Ad=8a(I) Atr=03(Int.) MxPS=  64 Ivl=125us
E:  Ad=0a(O) Atr=03(Int.) MxPS=  64 Ivl=125us
I:  If#= 2 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=(none)
E:  Ad=8a(I) Atr=03(Int.) MxPS=  64 Ivl=125us
E:  Ad=0a(O) Atr=03(Int.) MxPS=  64 Ivl=125us
I:* If#= 3 Alt= 0 #EPs= 9 Cls=ff(vend.) Sub=ff Prot=ff Driver=mt7921u
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=09(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=86(I) Atr=03(Int.) MxPS=   2 Ivl=125us

I tried to update firmware on OpenWrt 23.05.2, it rendered the whole router reboot on RPi4B, I have to unplug the dongle to let it boot, then replace the firmware with default one to make it working again.

When was the last time that Pi ran the latest Raspberry OS?
I ask because the 4 has an eeprom (unlike previous Pis) and they do update the bootloader often.
It just takes a first boot to update. Or you can follow this but either way you are going to need to dedicate an sd card.

And we are working on finding and supporting wifi devices here including the mt7921au.

I have read that the mt7921au has an amplifier that is not reporting to Linux and limits power to 13dBm on 5Ghz. I am in discussions with PANDA to see if they have solved this >2 year issue.

You mean I have to use RPi OS to update the EEPROM and go back to OpenWrt to try again? (Mine was running DietPi before and last run was probably 1yr ago).

The CF-953AX is ALWAYS reporting 3dBm while in AP mode, I heard from others that it's just an incorrect reporting, the actual transmission should be higher. And from my experience, when using it with NanoPi R4S, I can still achieve ~500Mbps speedtest result even I am in another room.

You don't have to do anything.
It is a step in troubleshooting and is suggested in the Pi write up.

As I explained earlier: the chipset does have a driver issue with its amplifier on 5Ghz that, reportedly, limits tx to 13dBm.
Maybe those people are wrong and 13dBm is just what is reported but the amp goes full blast. I dunno.

An app like android Wi-Fi analyzer would give more accurate results.

In all earnest: you have a Raspberry Pi. You only have one sd card?

I have more than one RPi 4B (also older models), and of course tons of SD cards at home (in fact I usually boot from USB SSD with other OS, OpenWrt on SD card just for simplicity)

Then why make a scene about flashing one with the latest OS and updating the bootloader?

Apologies: not had coffee yet.