Tuesday, 12 August 2008

Connecting to Internet using a Sony Ericsson K530i mobile phone in Ubuntu (Linux) via USB cable

We are going to connect our Ubuntu system to Internet using a Sony Ericsson K530i phone via a usb cable.

First of all we switch on our phone, we insert the pin number and then connect the usb cable that came with the phone to our K530i and to our computer.

A menu presenting three choices will appear on the phone screen:

  • File transfer
  • Phone mode
  • Print

We select Phone mode.

Now our phone is ready to use the usb cable.


There are two ways to connect to Internet via USB:
  • Emulating a ethernet device through a usb cable.
  • Using the K530i mobile phone as a usb serial modem.


EMULATING A ETHERNET DEVICE THROUGH USB CABLE


Our system Linux kernel has to already be compiled with cdc_ether module support. This module performs the emulation.


Let's configure our phone, we go to:
Menu->Settings->Connectivity->USB->USB Internet->USB data accounts
and select our Internet ISP provider account.

If there is not an already configured account we shall create a new account:
Menu->Settings->Connectivity->Data comm.->Data accounts->New account

Some APNs from Spanish Internet providers are:

Movistar: movistar.es
Vodafone: ac.vodafone.es
Yoigo: internet
Orange: internet

Usually user and password are not needed.


At the end, we establish the connection:
Menu->Settings->Connectivity->USB->USB Internet->Turn on

To check what has happened, we open a console and execute:
$ifconfig

An interface like usb0 with its IP address correctly configured will appear.


When we finish navigating, we switch off the connection:
Menu->Settings->Connectivity->USB->USB Internet->Turn off


USING THE K530i MOBILE PHONE AS A USB SERIAL MODEM


Our K530i phone will receive AT commands an will act as a USB serial modem.


First we install wvdial package:
$sudo aptitude install wvdial


If our modem is correctly connected through the usb cable some serial devices will show:

$ls -l /dev/ttyACM*

crw-rw---- 1 root dialout 166, 0 2008-08-12 19:50 /dev/ttyACM0
crw-rw---- 1 root dialout 166, 1 2008-08-12 19:50 /dev/ttyACM1


Now we need to configure wvdial so we create in our home directory a file called .wvdialrc

e.g:
[Dialer Defaults]
Phone = *99***1#
username = ''
password = ''
Modem = /dev/ttyACM0
Baud = 460800
Stupid Mode = 1
Init1 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = Analog Modem

[Dialer Vodafone]
Init4 = AT+CGDCONT=1,"IP","ac.vodafone.es";

[Dialer Movistar]
Init4 = AT+CGDCONT=1,"IP","movistar.es";

[Dialer Yoigo]
Init4 =AT+CGDCONT=1,"IP","internet";

[Dialer Masmovil]
Init4 =AT+CGDCONT=1,"IP","internetmas";

[Dialer Simyo]
Init4 =AT+CGDCONT=1,"IP","gprs-service.com";


[Dialer Pin]
Init2 = AT+CPIN="8888"      #write your pin here.



This configuration file will work for most Spanish ISPs.

e.g:

$wvdial Vodafone will establish the connection.

or

$wvdial Vodafone Pin for the first time, to set the pin number too.

To stop it, simply press ctrl+c.

If your have another provider you will have to add an appropriate Init4 line with your provider APN. Some operators also change the Phone number.


YOU MAY ALSO BE INTERESTED IN:

Connect to Internet using a K530i phone in Debian GNU/Linux via Bluetooth

0 comentarios: