-->

..:: seize the day ::..

July 28, 2008

Internet Connection With Nokia E51

Filed under: IT stuff

 Hi all,

Here we go again. After reading one posting in opensuse-id list, I think I should give the community some knowledge and experience that I have using my Nokia E51 as GPRS modem to connect to TelkomFlash to Internet on my openSUSE 11 machine. Off course by making some adjustment here and there this setup can also be used to connect using any GSM phone or any GPRS Modem to any GSM access point.

I plugged my Nokia E51 to my laptop using USB cable that is provided with the handphone, and my phone ask me to use either PC Suite or Data Transfer. The difference is (CMIIW) using PC Suite can give me access to the phone as a system in general while selecting Data Transfer only give the access to memory card inside the phone. So choose PC Suite as the way you communicate to the phone. (Another method is using bluetooth, you can find it in my other post here and it seems less complicated)

Then watched carefully to the dmesg give me:

usb 2-1: new full speed USB device using uhci_hcd and address 2
usb 2-1: configuration #1 chosen from 1 choice
usb 2-1: New USB device found, idVendor=0421, idProduct=0042
usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-1: Product: Nokia E51
usb 2-1: Manufacturer: Nokia
cdc_acm 2-1:1.10: ttyACM0: USB ACM device
usbcore: registered new interface driver cdc_acm
drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver cdc_ether

the important thing here is my opensuse 11 understand the Nokia E51 phone and it will use ttyACM0 as device file name. So the rest is easy.

I have these 3 files that I borrow from somewhere (forget it now, but i will put the link here as soon as i found it). The files are:

  • gprs 
  • gprs-connect-chat
  • gprs-disconnect-chat

put all of this files on /etc/ppp/peers. You can copy all the files below and remove all the lines start with # (except the lines with #!/bin/sh) to make it easy to look at. (You can do this with sed, for example: cat /etc/ppp/peers/gprs | sed ‘/ *#/d; /^ *$/d’ )

#=====================================================================================

 

# $Id: gprs,v 1.4 2004/04/28 08:40:32 mcfrisk medwinz Exp $
#
# File:
# gprs
#
# Description:
# Serial cable, IrDA, Bluetooth and USB pppd options for GPRS phones.
# See ‘man pppd’ for detailed option descriptions.

# Most GPRS phones don’t reply to LCP echo’s
lcp-echo-failure 0
lcp-echo-interval 0

# Keep pppd attached to the terminal:
# Comment this to get daemon mode pppd
nodetach

# Debug info from pppd:
# Comment this off, if you don’t need more info
debug

# Show password in debug messages
show-password

# Connect script:
# scripts to initialize the GPRS modem and start the connection,
# wvdial command is for Orange SPV while other phones should work with chat
connect /etc/ppp/peers/gprs-connect-chat
#connect "/usr/bin/wvdial –chat –config /etc/ppp/peers/gprs-wvdial.conf radiolinja_usb_orange_spv"

# Disconnect script:
# AT commands used to ‘hangup’ the GPRS connection.
disconnect /etc/ppp/peers/gprs-disconnect-chat

# Serial device to which the GPRS phone is connected:
# /dev/ttyS0 for serial port (COM1 in Windows),
# /dev/ircomm0 for IrDA,
# /dev/ttyUB0 for Bluetooth (Bluez with rfcomm running) and
# /dev/ttyUSB0 for USB
#/dev/ttyS0    # serial port one
#/dev/ttyS1    # serial port two
#/dev/ircomm0    # IrDA serial port one
#/dev/rfcomm0    # Bluetooth serial port one
#/dev/ttyUSB0    # USB serial device, for example Orange SPV
/dev/ttyACM0    # USB ACM device which is my Nokia-E51

# Serial port line speed
115200    # fast enough
#57600    # perhaps usefull with IrDA as some phones don’t like
        # speeds higher than this

# Hardware flow control:
# Use hardware flow control with cable, Bluetooth and USB but not with IrDA.
crtscts  # serial cable, Bluetooth and USB, on some occations with IrDA too
#nocrtscts # IrDA

# Ignore carrier detect signal from the modem:
local

# IP addresses:
# - accept peers idea of our local address and set address peer as 10.0.0.1
# (any address would do, since IPCP gives 0.0.0.0 to it)
# - if you use the 10. network at home or something and pppd rejects it,
# change the address to something else
:10.0.0.1

# pppd must not propose any IP address to the peer!
noipdefault

# Accept peers idea of our local address
ipcp-accept-local

# Add the ppp interface as default route to the IP routing table
defaultroute

# Newer pppd’s also support replacing the default route, if one is
# already present, when the GPRS connetion should be set as the default route
# to the network
#replacedefaultroute

# DNS servers from the phone:
# some phones support this, some don’t.
usepeerdns

# ppp compression:
# ppp compression may be used between the phone and the pppd, but the
# serial connection is usually not the bottleneck in GPRS, so the
# compression is useless (and with some phones need to disabled before
# the LCP negotiations succeed).
novj
nobsdcomp
novjccomp
nopcomp
noaccomp

# The phone is not required to authenticate:
noauth

# Username and password:
# If username and password are required by the APN, put here the username
# and put the username-password combination to the secrets file:
# /etc/ppp/pap-secrets for PAP and /etc/ppp/chap-secrets for CHAP
# authentication. See pppd man pages for details.
# Example, Radiolinja operator pap-secrets:
# "rlnet"         *       "internet"    *
#user "rlnet"
user "internet"

# The persist tries to reopen the connection if it is dropped. This
# is usefull for example with a Nokia 7650 which only manages to
# ‘dial’ with every second attempt or when the network likes to drop the
# connection every now and then. It’s not fun when the over-night
# ‘apt-get dist-upgrade -d -y’ fails constantly…
#persist
#maxfail 99

# Asyncmap:
# some phones may require this option.
#asyncmap 0xa0000

# No magic:
# some phones may require this option.
#nomagic

# Require PAP authentication:
# some phones may require this option.
#require-pap

#============================================================================================

This is the content of gprs-connect-chat

#============================================================================================

#!/bin/sh
#
# $Id: gprs-connect-chat,v 1.2 2004/02/02 23:19:28 mcfrisk medwinz Exp $

# The actual chat script:

exec chat                         \
    TIMEOUT        5                \
    ECHO         ON                \
    ABORT        ‘\nBUSY\r’            \
    ABORT        ‘\nERROR\r’            \
    ABORT        ‘\nNO ANSWER\r’            \
    ABORT        ‘\nNO CARRIER\r’        \
    ABORT        ‘\nNO DIALTONE\r’        \
    ABORT        ‘\nRINGING\r\n\r\nRINGING\r’    \
    ‘’        \rAT                \
    TIMEOUT        12                \
    SAY        "Press CTRL-C to close the connection at any stage!"    \
    SAY        "\ndefining PDP context…\n"    \
    OK        ATH                \
    OK        ATE1                \
    OK        ‘AT+CGDCONT=1,"IP","internet","",0,0′    \
    OK        ATD*99#                \
    TIMEOUT        22                \
    SAY        "\nwaiting for connect…\n"    \
    CONNECT        ""                \
    SAY        "\nConnected." \
    SAY        "\nIf the following ppp negotiations fail,\n"    \
    SAY        "try restarting the phone.\n"

#============================================================================================

This is the content of gprs-disconnect-chat

#============================================================================================

#!/bin/sh
#
# $Id: gprs-disconnect-chat,v 1.3.2.2 2006/02/14 20:20:17 mcfrisk medwinz Exp $
#
# File:
# gprs-disconnect-chat
#
# send break
exec /usr/sbin/chat -V -s -S    \
ABORT        "BUSY"        \
ABORT        "ERROR"        \
ABORT        "NO DIALTONE"    \
SAY        "\nSending break to the modem\n"    \
""        "\K"        \
""        "\K"        \
""        "\K"        \
""        "\d\d+++\d\dATH"    \
SAY        "\nPDP context detached\n"

#=========================================================================================

Then don’t forget set the owner and mode

# chown root:root /etc/ppp/peers/gprs*

# chmod 644 /etc/ppp/peers/gprs

# chmod 755 /etc/ppp/peers/gprs-connect-chat

# chmod 755 /etc/ppp/peers/gprs-disconnect-chat 

If the linux doesn’t have the wvdial package, we should install it (off course with all the dependencies).

To run it, just type as root:

# pppd call gprs

To end a connection just press ctrl+c.

The setting here is for Telkomsel Flash, so if you use other provider just change the APN name in gprs-connect-chat. Find the line:

OK        ‘AT+CGDCONT=1,"IP","internet","",0,0′    \

and change "internet" with your APN name.

So try change a little bit to match with your setting and this script should be working.

PS: Sometimes you need to change the setting of Network Mode from your handphone. I found out that selecting dual mode on  Network Mode sometimes doesn’t work. If it is the case just change the network mode to either UMTS (3G) or GSM (gprs).

Below are the pictures from my system connecting using this script

pppd call gprs

pppd call gprs 1 

pppd call gprs out