2

I've recently purchased a Wifi Dongle containing a Realtek rtl8811CU chipset. I'm using Ubuntu 18.04 LTS.

Luckily, after finding this Github repo, I could compile it and install the driver without any problem.

However, every time I connect the dongle, is detected as a Disk, and I need to run usb_modeswitch to make it work:

$ lsusb
 [...]
 Bus 001 Device 013: ID 0bda:1a2b Realtek Semiconductor Corp. 
$ sudo usb_modeswitch -KW -v 0bda -p 1a2b
$ lsusb
 [...]
 Bus 001 Device 014: ID 0bda:c811 Realtek Semiconductor Corp.

The device ID changes and now I can correctly use my Wifi dongle.

I've tried to add this entry, to the udev rules, located in /lib/udev/rules.d/40-usb_modeswitch.rules, supposedly to run the command every time the device is detected:

 # Realtek 8211CU Wifi AC USB
 ATTR{idVendor}=="0bda", ATTR{idProduct}=="1a2b", RUN+="usb_modeswitch '/%k'"

But then I recconect, and nothing happens.

I've checked that maybe you need a service to do this, but it seems that cannot be activated.

$ systemctl --all | grep usb_modeswitch
● usb_modeswitch@1-4.1.service    loaded    failed   failed    USB_ModeSwitch_1-4.1                                                            
system-usb_modeswitch.slice       loaded    active   active    system-usb_modeswitch.slice    

$ systemctl status usb_modeswitch@1-4.1.service
● usb_modeswitch@1-4.1.service - USB_ModeSwitch_1-4.1
Loaded: loaded (/lib/systemd/system/usb_modeswitch@.service; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-10-04 11:49:17 CDT; 2min 5s ago
    Docs: man:usb_modeswitch_dispatcher(1)
Process: 32216 ExecStart=/usr/sbin/usb_modeswitch_dispatcher --switch-mode 1-4.1 (code=exited, status=1/FAILURE)
Main PID: 32216 (code=exited, status=1/FAILURE)

oct 04 11:49:17  systemd[1]: Starting USB_ModeSwitch_1-4.1...
oct 04 11:49:17  usb_modeswitch_dispatcher[32216]: Could not read attribute: No such file or directory
oct 04 11:49:17  usb_modeswitch_dispatcher[32216]: Could not read attribute: No such file or directory
oct 04 11:49:17  systemd[1]: usb_modeswitch@1-4.1.service: Main process exited, code=exited, status=1/FAILURE
oct 04 11:49:17  systemd[1]: usb_modeswitch@1-4.1.service: Failed with result 'exit-code'.
oct 04 11:49:17  systemd[1]: Failed to start USB_ModeSwitch_1-4.1.

Seems that there is a problem with the Ubuntu wrapper, does anyone knows how I can investigate further? I'm new to systemd and udev rules, so I'm not really sure where to find more logs or debug features.

2 Answers 2

5

I've found the way to do it. I've modified the file /lib/udev/rules.d/40-usb_modeswitch.rules appending before the line LABEL="modeswitch_rules_end" the following:

# Realtek 8211CU Wifi AC USB
ATTR{idVendor}=="0bda", ATTR{idProduct}=="1a2b", RUN+="/usr/sbin/usb_modeswitch -K -v 0bda -p 1a2b"

After that, every time I connected the wifi dongle, the disk doesn't appear and automatically the Wifi is detected. Maybe it's not the cleanest method, but it works.

2
  • 1
    I think the standard way should be like this: ATTR{idVendor}=="0e8d", ATTR{idProduct}=="2870", RUN+="usb_modeswitch '%b/%k'" Mar 4, 2019 at 16:44
  • 1
    This worked and DWA 171 Revision C works as WiFi adaptor now. > /usr/sbin/usb_modeswitch -K -v 0bda -p 1a2b
    – mon
    Oct 25, 2019 at 11:13
1

Have you tried live usb without install to try if it's a problem with your Ubuntu downloaded? I recommend you try XUbuntu 18.04 live version to confirm if the wifi works in your laptop, you can download from here and try it and tell us if it works or still can't detected your dongle, I'm using XUbuntu 18.04, it reconigzes my dongle usb although in screen appears two wifis icons (1 for dongle usb and other for my other default wifi) but it works for me:

https://xubuntu.org/download

2
  • I will try, I have a laptop with a fresh Xubuntu install, but I will use the live USB anyways. As I noted, the Wifi works after running the usb-switch command, but it's cumbersome to do everytime I reconnect.
    – Checo R
    Oct 4, 2018 at 18:16
  • Mine's detected automatically, tell us if it works, good luck! Oct 4, 2018 at 18:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.