Huawei e173s and how to make it work in Linux

Few days ago, I made the decision of switching from my customized Arch to Gnome Ubuntu (just for a month or two most likely... got tired of bareness of the Openbox :) ). However, my Huawei E173s GSM modem stopped working. Neither was it autodetected, nor easy to figure out how to make it work. (I also had to figure it out in Arch, but it was mostly a matter of installing usb_modeswitch and modemmanager... also, modemmanager in Arch is in much newer version than in Ubuntu). This problem seems to affect a wider range of distributions (while googling various forums for the solution, I noticed people with similar problems on Fedora, Arch, Ubuntu, OpenSUSE and so on...), so even if the solution will be Ubuntu-based, it takes no time to understand how to do it on other distros. The problem might be partially gone in newest distros though, there where Modem Manager version is new enough.

As you probably know by now, this particular modem needs to be handled by usb_modeswitch - a program that switches a bunch of these crazy modems that are masking themselves as CDROM drives until the user installs the drivers he can find there. Of course, Windows drivers are useless to us, not to mention that we need to switch the modem's mode, because right after plugging it, it is not detected as a modem yet:
$ lsusb | grep Huawei
Bus 003 Device 005: ID 12d1:1c0b Huawei Technologies Co., Ltd. E173s 3G broadband stick (modem off)

Basically, the problems seem to be:
1. Something isn't right in the default Ubuntu's usb_modeswitch config for the modem, so we need to replace it
2. The driver doesn't automatically load for the device, so we need to make it load each boot, with an option pointing at the device's USB ID
3. There's a regression in Modem Manager 0.6.0(Bug #1057186: Modem functionality of the Huawei E173 and E3131 doesn't work - Ubuntu Launchpad), so we either need to downgrade it to 0.5.x, or use Wader instead (which is a replacement for Modem Manager, that is compatible with Network Manager) - both seemed to work for me.

So, let's solve 1.
sudo nano /usr/share/usb_modeswitch/12d1\:1c0b
We paste this into the file (Modeswitch forums topic that helped me a bit):
 # Huawei E173s

#original content, as supplied by Ubuntu
#TargetVendor=  0x12d1
#TargetProductList="1c05,1c07,1c08,1c10"

#MessageContent="55534243123456780000000000000011062000000100000000000000000000"

#version from the modeswitch forums

DefaultVendor=  0x12d1
DefaultProduct= 0x1c0b

TargetVendor=  0x12d1
TargetProduct= 0x1c05

CheckSuccess=20

MessageEndpoint= 0x0f
MessageContent= "55534243123456780000000000000011062000000100000000000000000000"

Then, we need to deal with 2.
sudo nano /etc/modules
Add to the end of the file:
usbserial vendor=0x12d1 product=0x1c0b

Now, we can either downgrade Modem Manager or install Wader. First option:
wget http://launchpadlibrarian.net/98148167/modemmanager_0.5.2.0-0ubuntu2_amd64.deb
sudo apt-get remove modemmanager
sudo dpkg -i modemmanager_0.5.2.0-0ubuntu2_amd64.deb 
Second option:
sudo apt-get remove modemmanager
sudo apt-get install wader-core
Then, it's time for a reboot. After it's done, we plug in our E173s dongle into an USB port and wait 20-30 seconds. Look at dmesg and lsusb outputs to check whether the modem is working. If not, you might need to unplug it, then plug it again, as I had to. Be sure that your WiFi/wired connection is disabled or you might not even notice whether your connection started working or not :)
Here's an output of my dmesg after doing the steps above:


[ 1019.070733] usb 3-1: new high-speed USB device number 3 using xhci_hcd
[ 1019.088002] usb 3-1: New USB device found, idVendor=12d1, idProduct=1c0b
[ 1019.088014] usb 3-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 1019.088020] usb 3-1: Product: HUAWEI Mobile
[ 1019.088026] usb 3-1: Manufacturer: HUAWEI
[ 1019.091454] usbserial_generic 3-1:1.0: The "generic" usb-serial driver is only for testing and one-off prototypes.
[ 1019.091463] usbserial_generic 3-1:1.0: Tell linux-usb@vger.kernel.org to add your device to a proper driver.
[ 1019.091469] usbserial_generic 3-1:1.0: generic converter detected
[ 1019.091643] usb 3-1: generic converter now attached to ttyUSB0
[ 1019.091777] usbserial_generic 3-1:1.1: The "generic" usb-serial driver is only for testing and one-off prototypes.
[ 1019.091782] usbserial_generic 3-1:1.1: Tell linux-usb@vger.kernel.org to add your device to a proper driver.
[ 1019.091786] usbserial_generic 3-1:1.1: generic converter detected
[ 1019.091920] usb 3-1: generic converter now attached to ttyUSB1
[ 1021.337786] usb 3-1: usbfs: USBDEVFS_CONTROL failed cmd usb_modeswitch rqt 128 rq 6 len 255 ret -110
[ 1022.173609] generic ttyUSB0: generic converter now disconnected from ttyUSB0
[ 1022.173652] usbserial_generic 3-1:1.0: device disconnected
[ 1022.174837] usb 3-1: USB disconnect, device number 3
[ 1022.175360] generic ttyUSB1: generic converter now disconnected from ttyUSB1
[ 1022.175405] usbserial_generic 3-1:1.1: device disconnected
[ 1027.290502] usb 3-1: new high-speed USB device number 4 using xhci_hcd
[ 1027.307304] usb 3-1: New USB device found, idVendor=12d1, idProduct=1c05
[ 1027.307318] usb 3-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 1027.307327] usb 3-1: Product: HUAWEI Mobile
[ 1027.307335] usb 3-1: Manufacturer: HUAWEI
[ 1027.362887] usbcore: registered new interface driver option
[ 1027.362898] usbserial: USB Serial support registered for GSM modem (1-port)
[ 1027.362965] option 3-1:1.0: GSM modem (1-port) converter detected
[ 1027.363046] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 1027.363068] option 3-1:1.1: GSM modem (1-port) converter detected
[ 1027.363127] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 1027.363145] option 3-1:1.2: GSM modem (1-port) converter detected
[ 1027.363735] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB2
[ 1027.368156] usb-storage 3-1:1.3: USB Mass Storage device detected
[ 1027.371335] scsi7 : usb-storage 3-1:1.3
[ 1027.371433] usb-storage 3-1:1.4: USB Mass Storage device detected
[ 1027.371816] scsi8 : usb-storage 3-1:1.4
[ 1027.371892] usbcore: registered new interface driver usb-storage
[ 1029.193817] usb 3-1: usbfs: USBDEVFS_CONTROL failed cmd usb_modeswitch rqt 128 rq 6 len 255 ret -110
[ 1030.376852] scsi 7:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[ 1030.376866] scsi 8:0:0:0: Direct-Access     HUAWEI   SD Storage       2.31 PQ: 0 ANSI: 2
[ 1030.379117] sr1: scsi-1 drive
[ 1030.379553] sr 7:0:0:0: Attached scsi CD-ROM sr1
[ 1030.379779] sr 7:0:0:0: Attached scsi generic sg3 type 5
[ 1030.380629] sd 8:0:0:0: Attached scsi generic sg4 type 0
[ 1030.387743] sd 8:0:0:0: [sdc] Attached SCSI removable disk

lsusb output also seems much better now:
$ lsusb | grep Huawei
Bus 003 Device 004: ID 12d1:1c05 Huawei Technologies Co., Ltd. E173s 3G broadband stick (modem on)

Comments

Popular Posts