I just bought one of these (D-Link DWA-171 Revision C) devices. Setting them up is still not trouble-free, so it's not surprising to me that we have a number of threads about them. Anyway, I just got it working on my Fedora 31 box, and this seems as good a thread as any to update.
First, I installed the driver:
Code:
git clone https://github.com/brektrou/rtl8821CU.git
cd rtl8821CU
chmod +x dkms-install.sh
sudo ./dkms-install.sh
This is from here:
https://askubuntu.com/a/1164982
Then, I wrote a script to load the driver and switch the device from "Flash disk mode(default) to active adapter mode", as the official drivers put it. Respect to D-Link for providing official Linux drivers, but, well, they don't work. The repo above did. Anyway, here's the script, which is at
/usr/local/bin/dwa171:
Code:
#!/usr/bin/env bash
/usr/sbin/modprobe 8821cu
/usr/sbin/usb_modeswitch -K -v 0bda -p 1a2b > /dev/null
And then I wrote a udev rule to load that script when the adapter is detected. It's at
/etc/udev/rules.d/99-dwa171.rules
Code:
ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="1a2b", RUN+="/usr/local/bin/dwa171"
I have no idea if this is the best way to do it; it's just the first working setup I stumbled across.