header image

USB_ModeSwitch – Activating Switchable USB Devices on Linux

Posted by: | January 13, 2010 | No Comment |

USB_ModeSwitch is (surprise!) a mode switching tool for controlling “flip flop” (multiple device) USB gear.

Several new USB devices (especially high-speed wireless WAN stuff, there seems to be a chipset from Qualcomm offering that feature) have their MS Windows drivers onboard; when plugged in for the first time they act like a flash storage and start installing the driver from there. After that (and on every consecutive plugging) this driver switches the mode internally, the storage device vanishes (in most cases), and a new device (like an USB modem) shows up. The WWAN gear maker Option calls that feature “ZeroCD (TM)”.

As you may have guessed, hardly anything of this is documented and Linux support by the better part of the makers is non-existent. On the good side, most of the known devices work out of the box with the available Linux drivers like “usb-storage” or “option” (an optimized serial driver for high-speed modems). That leaves the problem of the mode switching from storage to modem or whatever the thing is supposed to do.

Fortunately there are things like human reason, USB sniffing programs and “libusb”. It is possible to eavesdrop the communication of the MS Windows driver, to isolate the command or action that does the switching, and to reproduce the same thing with Linux.

USB_ModeSwitch makes the last step considerably easier by taking the important parameters from a configuration file and doing all the initialization and communication stuff.
Starting from version 0.9.7 it has an optional success check which spares the manual call of “lsusb” to note any changes after execution. This comes at a price though: to work properly, the success check needs a system/device dependent delay to give the device time to settle after the switch. This delay is configurable, but it obviously prevents USB_ModeSwitch to return immediately. Thus it is mostly useful during testing.

The latest release version is 1.0.7. The tar archive contains the source and a i586 binary (32 bit, GCC 4.3.2). I used libusb-0.1.12.

Changes and updates to the config database happen more often than new releases; most of the valuable knowledge about devices is contained in these files. So you better use the latest version linked here.

  • Download usb_modeswitch-1.0.7.tar.bz2, dated from 2010-01-06; a Debian (Xandros/Ubuntu) package should be available soon at the Debian Repository. Many architectures are supported there (like amd64 or ia64).
  • Load the latest usb_modeswitch-current_data.tar.bz2 (2010-01-06). Contains the device database, rules and the config file (for reference), including full paths. Use this version only with releases from 1.0.7 upward !
  • The latest usb_modeswitch.conf (2009-12-26); the default place is “/etc”.
    The config file is shifting it’s meaning to a kind of reference as the system integration is more widely used.
  • Don’t forget libusb if you don’t have it. In your distribution, there is most likely a package named “libusb-dev” or “libusb-devel”. Choose the legacy version (0.1.12)

How to use it :

After you have that file => usb_modeswitch-1.0.7.tar.bz2, you must extract its content by using extraction software (right click that file => extract here). The content of that file is included these files :













by using Nautilus (type “sudo nautilus” in terminal), you must copy these files (red color files only) into :

usb_modeswitch => /usr/sbin

usb_modeswitch.conf => /etc

Next you must set or edit usb_modeswitch.conf with gedit => choose your modem type

Now on terminal you can type :

standy@ubuntu:~$ sudo usb_modeswitch

for real sample, you can see in :

How to set-up or install ZTE MG880 USB Modem in Ubuntu Jaunty 9.04

under: Computer Science

Leave a response

Your response: