Saturday, 19 September 2009

Connecting to Starhub using Huawei E1750 on Archlinux

I have a Asus 1005HA running Archlinux. Recently signed up for Starhub's mobile broadband plan, which gave me a Huawei E1750. I could not google much on how to connect using this device from linux. So this is how I got mine to connect from bits and pieces of information from googling.

This is my uname:
Linux nettie 2.6.30-ARCH #1 SMP PREEMPT Wed Sep 9 12:37:32 UTC 2009 i686 Intel(R) Atom(TM) CPU N280 @ 1.66GHz GenuineIntel GNU/Linux


This is what we're trying to get when we type lsusb:
Bus 005 Device 002: ID 0b05:b700 ASUSTek Computer, Inc. Broadcom Bluetooth 2.1
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 005: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem
Bus 001 Device 002: ID 13d3:5095 IMC Networks 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


Take note of the vendor id and product id of the Huawei device. 12d1 is the vendor id and 1001 is the product id. When you first plug it in the product id should be 1446. You should get something like this:
Bus 001 Device 005: ID 12d1:1446 Huawei Technologies Co., Ltd. E620 USB Modem


To switch to a product id of 1001, I used a combination modem-modeswitch and usb-modeswitch. modem-modeswitch comes by default for me in archlinux /lib/udev/modem-modeswitch. usb-modeswitch will need to be installed. I did this by getting the PKGBUILD from AUR and changing the content to use the latest usb-modeswitch (http://www.draisberghof.de/usb_modeswitch/). Add the following to your /etc/usb_modeswitch.conf:
# Huawei E1750
#
DefaultVendor= 0x12d1
DefaultProduct= 0x1446
MessageEndpoint= 0x01
MessageContent="55534243000000000000000000000011060000000000000000000000000000"
CheckSuccess=5


You don't really need the last line "CheckSuccess=5". I have it there to just check if the switch was successful. I then wrote the following script to be executed with sudo:
#!/bin/sh
modprobe -r usb-storage
modprobe -r usbserial
/lib/udev/modem-modeswitch --vendor 0x12d1 --product 0x1446 --type option-zerocd
modprobe usbserial vendor=0x12d1 product=0x1446
/usr/bin/usb_modeswitch


This is what works for me. I'm not sure why it does. Sometimes I need to execute this several times to get it to work. Most of the time, once is enough after boot. You should be expecting the creation of 3 /dev/ttyUSB*. You can by "ls /dev/ttyUSB*" or from dmesg. But most importantly, you must have the switch of the product id to 1001 is lsusb.

After this all we need is wvdial. This is my /etc/wvdial.conf
[Dialer Defaults]
Modem = /dev/ttyUSB0
Modem Type = Analog Modem
Baud = 460800
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2
Init3 =
Area Code =
Phone = *99#
Username = star
Password = hub
Ask Password = off
Dial Command = ATDT
Stupid Mode = on
Compuserve = off
Force Address =
Idle Seconds = 0
DialMessage1 =
DialMessage2 =
ISDN = off
Check Def Route = on
Auto DNS = on


Execute "sudo wvdial" and just wait for the connection and setting up of nameserver. Hope this helps somebody :)

No comments: