Sunday, March 16, 2008

USB Data Card on Ubuntu Linux - How To?

Ubuntu Linux and Windows XP are two operating systems which sit on my system. As of me, I rarely use Linux. The installation is just to boast that I was once a student pursuing a project in Grid Computing (LOL!)

I'm on Linux right now - brooding over what might have actually happened to Windows OS which isn't booting. Definitely, something is wrong. Pity that softwares don't nag and complain whenever they are expected to.

I needed my daily dose of Internet – usual mail checking and stuff, for which I had no options but to use the unused Ubuntu. Way back in history, about in the year 2007 I had managed to find out steps to connect my datacard via Ubuntu. Had decided to post on the same, since it helps keeping things documented. I guess its high time to do the same, right now.

Ensure that the steps are carried out with root login.

Step 1. Check your card is recognized by the kernel

Command: # cat /proc/bus/usb/devices


T: Bus=02 Lev=01 Prnt=01 Port=05 Cnt=02 Dev#= 4 Spd=12 MxCh= 0

D: Ver= 1.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=16 #Cfgs= 1

P: Vendor=12d1 ProdID=1001 Rev= 0.00

S: Manufacturer=Huawei Technologies

S: Product=Huawei Mobile

S: SerialNumber=HUAWEI EC3X1

C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA

I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=pl2303

E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=128ms

E: Ad=8a(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms

E: Ad=0b(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms

I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=pl2303

E: Ad=83(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms

E: Ad=06(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms

Step 2. Modprobe the driver

2.1 Command: # modprobe usbserial vendor=0x12d1 product=0x1001

2.2 Command: # dmesg


[ 2315.412106] usbcore: registered new interface driver usbserial

[ 2315.412508] drivers/usb/serial/usb-serial.c: USB Serial support registered for generic

[ 2315.461938] usbcore: registered new interface driver usbserial_generic

[ 2315.461945] drivers/usb/serial/usb-serial.c: USB Serial Driver core

[ 2315.480382] drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303

[ 2315.480414] pl2303 2-6:1.0: pl2303 converter detected

[ 2315.480608] usb 2-6: pl2303 converter now attached to ttyUSB0

[ 2315.480620] pl2303 2-6:1.1: pl2303 converter detected

[ 2315.480691] usb 2-6: pl2303 converter now attached to ttyUSB1

Step 3. Edit wvdial.conf

Command: # vi /etc/wvdial.conf


Modem = /dev/ttyUSB0

Baud = 115200

SetVolume = 0

Dial Command = ATDT

Init1 = ATZ

FlowControl = Hardware (CRTSCTS)

[Dialer cdma]

Username = You Phone Number Here

Password = Your Password

Phone = #777 – 'This number depends on your service provider'

Stupid Mode = 1

Inherits = Modem0

Step 4. Run wvdial

Command: # wvdial cdma


--> WvDial: Internet dialer version 1.56

--> Cannot get information for serial port.

--> Initializing modem.

--> Sending: ATZ



--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0


--> Modem initialized.

--> Sending: ATDT#777

--> Waiting for carrier.


CONNECT 230400

--> Carrier detected. Starting PPP immediately.

--> Starting pppd at Sun Mar 16 11:09:28 2008

--> Pid of pppd: 19377

--> Using interface ppp0

--> pppd: � [06][08]�[11][06][08]

--> pppd: � [06][08]�[11][06][08]

--> pppd: � [06][08]�[11][06][08]

--> pppd: � [06][08]�[11][06][08]

--> local IP address

--> pppd: � [06][08]�[11][06][08]

--> remote IP address

--> pppd: � [06][08]�[11][06][08]

--> primary DNS address

--> pppd: � [06][08]�[11][06][08]

--> secondary DNS address

--> pppd: � [06][08]�[11][06][08]

And you're connected! Ensure that your internet traffic goes through your 'Modem'. In Ubuntu, this can be done via System->Administration->Networking.

I must declare that I am no geek when it comes to Linux and Shell Commands - these steps are excerpted from a technical forum on internet. Suggestions, changes and credits are welcomed!