Saturday, April 25, 2009

Connect Internet through mobile in Linux

Hi again, have you ever connected the internet through your mobile in linux platform?? i guess no, because the pc-suite for linux has not yet developed and using wine pc-suite won't install properly. But here are the 5 steps to connect.

Before you follow these steps 1st connect the mobile to pc by cable or bluetooth. If you are connecting by cable then select Nokia mode. Use these commands in terminal.


1. lsusb

You will get some lines of values which ranges of particular hardware connected to pc.
For example in my case.
Eg:-
Bus 004 Device 004: ID 0421:005e Nokia Mobile Phones
Bus 004 Device 003: ID 046d:c03d Logitech, Inc.
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 005: ID 0a5c:2101 Broadcom Corp.
Bus 001 Device 001: ID 0000:0000
Bus 005 Device 005: ID 0bda:0158 Realtek Semiconductor Corp.
Bus 005 Device 001: ID 0000:0000


Now note down the range of your phone connected.
Eg:- 0421: 005e (in my case, see 1st line of above Eg)


2. sudo /sbin/modprobe usbserial vendor=0x421 product=0x05e

Here 421 and 05e is the range in my case. Use only last 3 digits.


3. wvdialconf create

When you use this command you will get a long output like this eg

Eg:- Editing `create'.
Scanning your serial ports for a modem.
Modem Port Scan<*1>: S0 S1 S2 S3
WvModem<*1>: Cannot get information for serial port.
ttyACM0<*1>: ATQ0 V1 E1 -- OK
ttyACM0<*1>: ATQ0 V1 E1 Z -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyACM0<*1>: Modem Identifier: ATI -- Nokia
ttyACM0<*1>: Speed 4800: AT -- OK
ttyACM0<*1>: Speed 9600: AT -- OK
ttyACM0<*1>: Speed 19200: AT -- OK
ttyACM0<*1>: Speed 38400: AT -- OK
ttyACM0<*1>: Speed 57600: AT -- OK
ttyACM0<*1>: Speed 115200: AT -- OK
ttyACM0<*1>: Speed 230400: AT -- OK
ttyACM0<*1>: Speed 460800: AT -- OK
ttyACM0<*1>: Max speed is 460800; that should be safe.
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
WvModem<*1>: Cannot get information for serial port.
ttyUSB0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyUSB0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 9600 baud
ttyUSB0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
Found an USB modem on /dev/ttyACM0.
Modem configuration written to create.
ttyACM0: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

Here note down the maximum speed, (in my case its 460800, in last line).


4. sudo gedit /etc/wvdial.conf

You will get a opened file with some lines. Now delete all the lines and paste the below Eg code and save it.

Eg:-
[Dialer Defaults]
Modem = /dev/ttyACM0
Baud = 460800
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = Analog Modem
Phone = *99#
Username = username
Password = password
Stupid Mode = 1


5. wvdial

This is the last command to be used and whenever you want connect the internet just use this last command. Now use the above cmd. You wil get like this
Eg:-
--> WvDial: Internet dialer version 1.60
--> Can get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#


Now minimize the terminal and use.
If you want to DISCONNECT the connection then hit Ctrl+c

2 comments:

Anonymous said...

Nice one,but in the 4th step it must be gksu gedit not sudo gedit...to know why you can read this http://www.psychocats.net/ubuntu/graphicalsudo

Ajay Kulkarni said...

Yes, u must use "gksu" instead of "sudo" for graphical application (only in 4th step), but i used it for understanding purpose for new user.