Skip to content

Instantly share code, notes, and snippets.

@EkriirkE
Last active February 12, 2026 10:02
Show Gist options
  • Select an option

  • Save EkriirkE/03e1ae0e81533f1ba1ccc0862cbe2bd2 to your computer and use it in GitHub Desktop.

Select an option

Save EkriirkE/03e1ae0e81533f1ba1ccc0862cbe2bd2 to your computer and use it in GitHub Desktop.
rtw_8821cu USB WiFi dongle intermittently disabling

I have a cheap chinese USB WiFi dongle identifying as 0bda:c811 Realtek Semiconductor Corp. 802.11ac NIC, using the rtw_8821cu drivers/firmware.
It tries to appear as a drivers "CD" every boot/insertion but usb_modeswitch takes care of that.
It works great, except when it doesn't; it will randomly go offline/disappear and dmesg looks something like this every time:

[94250.702748] rtw_8821cu 4-1:1.0: unused phy status page (6)
[99560.537336] rtw_8821cu 4-1:1.0: unused phy status page (8)
[101755.068962] rtw_8821cu 4-1:1.0: unused phy status page (10)
[102762.647001] rtw_8821cu 4-1:1.0: failed to get urb length:32768
[102762.647788] rtw_8821cu 4-1:1.0: unused phy status page (8)
[111558.473720] rtw_8821cu 4-1:1.0: failed to get urb length:32768
[115044.686775] rtw_8821cu 4-1:1.0: unused phy status page (5)
[116199.244172] rtw_8821cu 4-1:1.0: unused phy status page (9)
[116510.253549] rtw_8821cu 4-1:1.0: unused phy status page (8)
[118145.237723] rtw_8821cu 4-1:1.0: unused phy status page (3)
[119383.455432] rtw_8821cu 4-1:1.0: failed to get tx report from firmware

with failed to get tx report from firmware repeating. The other errors usally happen randomly as 1-offs without causing any noticible issues. It is only until the "tx report" message appears that the dongle has gone offline.

So I run this hacky watchdog script to reset the USB port any time that last message appears. Somehow current connections are seamlessly preserved open with only a slight pause in transfers during the reassociation.

USBP=$(lsusb | sed -En "s/^Bus 0*([0-9]+) .* ID 0bda:c811 .*$/\1-1/p")
dmesg -W | while read l; do
	[[ ! $l =~ "failed to get tx" ]] && continue
	echo "RESETTING $USBP: "$l; 
	echo $USBP>/sys/bus/usb/drivers/usb/unbind; echo $USBP>/sys/bus/usb/drivers/usb/bind
	sleep 1
done

The USB bus/device is seemingly random every reboot so I extract it from lsusb, and on this SBC the root device (Bus X-1*) is what I twiddle. This will unbind("unplug") then bind("re-insert") the adaptor any time that last error appears in dmesg.

* ex: If lsusb shows Bus 004 Device 005: ID 0bda:c811 Realtek Semiconductor Corp. 802.11ac NIC, I need to reset 4-1 on my SBC, ignoring the device #. This may not be the same for your setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment