- Automatically use usb_modeswitch for Wifi USB
- Solution 2
- Related videos on Youtube
- Checo R
- Comments
- Automatically use usb_modeswitch for Wifi USB
- Understanding mode switching in Realtek RTL8812AU 802.11ac Windows drivers
- Comments
- advancement betterment boost
- How to setup a USB 3G Modem using usb_modeswitch and wvdial
- 1. Install required software
- 2. Get the USB switching codes
- 3. Create custom usb_modeswitch config file
- 4. Create the wvdial config file
- 5. Connect to the internet
Automatically use usb_modeswitch for Wifi USB
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=="0bda", ATTR=="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.
Solution 2
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:
Related videos on Youtube
Checo R
Dumb guy who wants to learn programming. I like Python and C.
Updated on September 18, 2022
Comments
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=="0bda", ATTR=="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 ● [email protected] loaded failed failed USB_ModeSwitch_1-4.1 system-usb_modeswitch.slice loaded active active system-usb_modeswitch.slice $ systemctl status [email protected] ● [email protected] - USB_ModeSwitch_1-4.1 Loaded: loaded (/lib/systemd/system/[email protected]; 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]: [email protected]: Main process exited, code=exited, status=1/FAILURE oct 04 11:49:17 systemd[1]: [email protected]: 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.
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.
Automatically use usb_modeswitch for Wifi USB
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=="0bda", ATTR=="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.
Understanding mode switching in Realtek RTL8812AU 802.11ac Windows drivers
So you just received your brand new 802.11ac USB adapter, capable of 867 mbps, and you plug it in and run a diagnostic program and wait, what’s this? It says it is a USB 2.0 device? You run another diagnostic program and it says the same thing! You know that USB 2.0 is only capable of 480 mbps. So the adapter is not really 867 capable after all….hmmmmm. but wait, actually it is.
The reason this happens is because the driver switches between USB 2 and USB 3 modes as needed.
These devices are backward compatible with older networks that have speeds below 480 mbps, such as 802.11n 150 and 300 mbps networks. The default mode of these USB 3.0 devices according to diagnostics is USB 2.0. When you are not connected to any network, this is the mode that will be displayed. When you connect to an 802.11n network, or a 1T1R 802.11ac network, the adapter will stay in USB 2.0 mode because the max speed of 480 for USB 2.0 is more than your network connection rate.
But connect to an 802.11ac network above 480, such as an 867 mbps 802.11ac 5 GHz network, and then check diagnostics again. Now it shows USB 3.0 as the mode. The chipset uses smart switching to go into either mode depending on what type of network to which you are connected.
Comments
Is it possible to disable this switching feature? I don’t need it
Muhammad Abdul-Khabir said:
How do you force to be in USB 3.0 mode? I want to use the higher speed to stream between 802.11ac 5Ghz devices and need the 3.0 mode, but windows just says “this device can run faster if connected through USB 3.0”. It’s only doing around 400mbps rather than a 600mbps as it’s a direct line of sight connection between the two, they are literally just 3 feet away from one another with nothing in between.
Modes can be set at ‘Auto’ (Default) or USB1, USB2 and USB3 in Windows 10 by way of the Device manager and ‘Advanced’ Tab for properties. Scroll down and you will find the property and msgbox to enter values. I changed mine to use 802.11ac and 5Ghz mode first along with VHT TX/RX & HT TX/RX to maximize throughput from my own dual-mode router that is in the same room. 5Ghz besides having less traffic from less users (and less collisions) does best LOS (Line Of Sight) with few barriers to reduce it’s link budget. Also there is a misconception that proximity is only beneficial to throughput. This is not true. There is a point at which reducing the distance between a wireless NIC and an AP have a deleterious effect. Meaning it will negatively effect your reception by getting too close to the AP/Gateway. I hope this answers some questions in the community
advancement betterment boost
How to setup a USB 3G Modem using usb_modeswitch and wvdial
1. Install required software
- Connect your Raspberry PI to the internet via LAN or Wifi
- Open a terminal window and enter:
sudo apt-get update sudo apt-get install ppp usb-modeswitch wvdial
2. Get the USB switching codes
- We need to get the codes of the USB device in USB storage mode and USB modem mode.
- Connect your USB modem and reboot the Raspberry PI without LAN or Wifi connection
- Once rebooted open a terminal window and enter:
- The output will look similar to the screenshot below. Your modem should be listed as one of the USB devices. Note the numbers underlined. These are the device vendor and product codes.
- Make a note of these numbers. In this case it is 19d2:2000
- This value will later be used in the DefaultProduct value
- Then we need to soft reboot the Rapberry PI with the modem connected.
- Open a terminal window and enter:
- The output will look similar to the screenshot below. Your modem should be listed and if you are lucky the second set of numbers would have changed. This is usb_modeswitch doing it’s job and switching the device to USB modem mode.
- Make a note of the new numbers. In this case it is 19d2:2002
- This value will be used later in the TargetProduct value
3. Create custom usb_modeswitch config file
- We need to create a custom config file for usb_modeswitch on the Raspberry PI because on a cold boot the device is not always active yet when usb_modeswitch runs on startup and the device is left in USB storage mode.
- We will extract some more information for our usb_modeswitch config file so that we can do the switching manually.
- Open a terminal window and enter the following replacing the codes 19d2 and 2000 with the codes you noted in step 2. Also note the added backslash.
cd /tmp tar -xzvf /usr/share/usb_modeswitch/configPack.tar.gz 19d2\:2000
- Now open the extracted file with a text editor like leafpad replacing the codes noted in step 2.
leafpad 19d2:2000
- The content of the file should look something similar to the screenshot below.
- The parts we are interested in are shown in blue.
- Now open the /etc/usb_modeswitch.conf file and add the information obtained above to the file.
- Open a terminal window and enter:
sudo leafpad /etc/usb_modeswitch.conf
- Then add the following replacing the codes and MessageContent values with those of your device and save.
DefaultVendor=0x19d2 DefaultProduct=0x2000 TargetVendor=0x19d2 TargetProduct=0x2002 MessageContent="5553424312345678000000000000061e000000000000000000000000000000" MessageContent2="5553424312345679000000000000061b000000020000000000000000000000" MessageContent3="55534243123456702000000080000c85010101180101010101000000000000"
4. Create the wvdial config file
- The next step is to create a config file for wvdial so you can connect to your service provider.
- Open a terminal window and enter:
sudo leafpad /etc/wvdial.conf
[Dialer 3gconnect] Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Init3 = AT+CGDCONT=1,"IP","internet" Stupid Mode = 1 Modem Type = Analog Modem ISDN = 0 Phone = *99# Modem = /dev/gsmmodem Username = < >Password = < >Baud = 460800
- Replace internet with your service provider’s APN
- Replace the Phone number if you need to dial a different code to connect.
- Replace Username and Password if needed. To leave the username and password as blank use
5. Connect to the internet
- To connect we need to make sure the device is in modem mode.
- Open a terminal and enter:
sudo usb_modeswitch -c /etc/usb_modeswitch.conf