A “multi-state” USB WiFi adapter carries on-board storage with a Windows driver, so on first plug it enumerates as a CD-ROM or flash drive. Windows autoruns the installer; other OSes see only a disk and no network interface, so the adapter must be told to switch.
Most mainstream distributions — Ubuntu, Fedora, Debian, OpenSUSE, Arch — ship usb-modeswitch with the adapter in its data files and switch silently; hand-switch only when the package is missing, the data predates the adapter, or the device is a rebadged clone.
Finding out
lsusb
sudo apt install usb-modeswitch usb-modeswitch-data
sudo usb_modeswitch -K -W -v 0e8d -p 2870 # vendor:product from lsusb
-K sends the eject, -W removes the fake storage. If lsusb then shows a new product ID and ip link a wireless interface, the switch worked — make it permanent.
Making it permanent
Two files: a udev rule triggering the switch on plug, and a config file for the device. The rule goes in /lib/udev/rules.d/40-usb_modeswitch.rules, below the GOTO="modeswitch_rules_end" line near the top:
# COMFAST CF-WU782AC/WU785AC, TEROW ROW02FD
ATTR{idVendor}=="0e8d", ATTR{idProduct}=="2870", RUN+="usb_modeswitch '/%k'"
The config file is named after the original IDs, /usr/share/usb_modeswitch/0e8d:2870:
| |
TargetVendor/TargetProductList are the IDs the device takes after switching — what the kernel binds a driver to; StandardEject=1 is the common case, and quirky devices need a MessageContent byte sequence instead.
Reboot, or replug the adapter, and it should come up as WiFi.
| Adapter | Original IDs | Target product | Config file |
|---|---|---|---|
| COMFAST CF-WU782AC, CF-WU785AC, TEROW ROW02FD | 0e8d:2870 | 7612 | /usr/share/usb_modeswitch/0e8d:2870 |
| Techkey 5B12/5B10 (Realtek 8811cu) | 0bda:1a2b | — | rule only, inline -K -v 0bda -p 1a2b |
| D-Link DWA-X1850, Alfa AWUS036AXER | 0bda:1a2b | 8852 | /usr/share/usb_modeswitch/0bda:1a2b |
The 8811cu entry is the exception: some adapters switch with just the -K eject in the rule, no config file.
ATTR{idVendor}=="0bda", ATTR{idProduct}=="1a2b", RUN+="/usr/sbin/usb_modeswitch -K -v 0bda -p 1a2b"
Two rule forms: RUN+="usb_modeswitch '/%k'" reads the config file on every plug; an inline usb_modeswitch -K … hardcodes the command. Prefer the config file — a switched device that re-enumerates back to storage usually means a rule that never ran.
Turning it off
To stop it fighting over a device, edit /etc/usb_modeswitch.conf:
DisableSwitching=1
Then reboot. Disabling is global, useful when something else handles the modem or dongle.