Look, this is not the page you should link to. This is just here in case the original disappears. I see a lot if hits to this page, which shouldn't be the case. The page you should put your links to is http://kapsi.fi/~mcfrisk/linux_gprs.html (and it has propably got a lot newer version, too). Guys, do your homework :) Now you're only here because my little Biblo page wanted to link this page.

But, since you are here (even though you really, really should use the link above and tell the one responsible for the link you've followed to move his link, too) I'll use your precious time for a small commercial:

Of Linux, GPRS Phones, Serial Cable, Irda, Bluetooth and USB


Table of Contents
Requirements
Install
Help
Thanks

Revision History
Revision 0.0.13080503Revised by: Mikko Rapeli
Updates to 'phones reported to work' list: Ericsson r600 stuff was missing after the Docbook update, oops. According to Kaj Barck Siemens C55 works with USB cable, great.
Revision 0.0.12100403Revised by: Mikko Rapeli
Added USB section since got Orange SPV working. Hi, Microsoft! Nokia 7650 Bluetooth automation for file transfer needs some more work but some info is there.
Revision 0.0.11180303Revised by: Mikko Rapeli
Added rfcomm setup automation.
Revision 0.0.10010303Revised by: Mikko Rapeli
Changed document source to Docbook XML V4.2, huh; I seem to like PSGML mode in GNU Emacs and RedHat 8.0 Docbook utils.
Revision 0.0.9191102Revised by: Mikko Rapeli
Added ATH to connect script due to t65 problems, thanks to Anders Ingeborn
Revision 0.0.8081102Revised by: Mikko Rapeli
got Ericsson T39m working with Bluetooth
Revision 0.0.7051102Revised by: Mikko Rapeli
got Nokia 7650 working with Bluetooth
Revision 0.0.6301002Revised by: Mikko Rapeli
added Nokia 30, Bluetooth and more pppd options
Revision 0.0.5300102Revised by: Mikko Rapeli
added Nokia 8310 stuff
Revision 0.0.4290102Revised by: Mikko Rapeli
added IrDA support, oh so trivial
Revision 0.0.3280102Revised by: Mikko Rapeli
rewrote instructions to include the 2.4.x kernel options

This article explains how to use GSM GPRS phones with RS-232 serial cable, IrDA and Bluetooth in Linux. The GPRS configuration is for a Finnish operator Radiolinja, but can be changed to suite any other operators settings.


Requirements

Settings for the GPRS service

To setup the GPRS connection from a PC, some GPRS network/operator/service specific settings are needed. Get these from your operator:

Access Point Name (APN) - my operator uses "internet"
Username and password for the APN, if any - my operator uses username "rlnet" and password "internet"
Packet Data Protocol (PDP) name - most operators use the Internet Protocol (IP)
Quality of Service (QoS) parameters if any - some services may use these to provide packet traffic priorisation
Domain Name Service (DNS) IP addresses - my operators servers are 213.161.033.200 and 212.226.226.001 (these resolve human readable names like www.iki.fi to Internet routable packet addresses like 212.16.100.1)


PC

HP OmniBook 4150 (SIR IrDA enabled from BIOS)
AMD Athlon 1GHz, KT133 serial and USB ports, Racewood BTD-2403 Bluetooth USB Dongle


Linux

RedHat 7.1: kernel 2.4.2-2, pppd version 2.4.0, chat version 1.22, irda-utils-0.9.13-7
RedHat 7.3: kernel vanilla 2.4.19 (perhaps required by Bluez Bluetooth), pppd-2.4.1-2, chat 1.22, bluez-libs-2.2, bluez-utils-2.1, bluez-sdp-0.8, bluez-pan-1.0, bluez-kernel-2.3, bluez-hciemu-1.0, bluez-hcidump-1.3, bluez-bluefw-0.7
RedHat 8.0 with standard kernel 2.4.18-27.8.0

To install pppd, chat, vwdial, USB, IrDA and Bluez Bluetooth stuff consult their man pages, relevant howto's and search forums, mailing lists and the Internet for solutions. These sites may be of use: irda.sourceforge.net, bluez.sourceforge.net, www.linux-usb.org. For more detailed information about GPRS take a look at the turtiainen.dna.fi/GPRS-HOWTO.


GPRS phones

I have tried these phones:

Ericsson r520, tested with serial cable, IrDA
Ericsson t39, tested with serial cable, IrDA, Bluetooth
Ericsson t68, tested with serial cable, IrDA
Nokia 8310, tested with IrDA
Nokia 30, tested with serial cable
Nokia 7650, tested with IrDA, Bluetooth
Orange SPV (Microsoft Smartphone), tested with USB

These have been reported to work too:

Ericsson r600 works with scripts by Heikki Lindholm
Nokia 6310i
Nokia 6310e with USB-to-RS232 converter (PL2303 chip) and serial cable
Siemens C55 with USB cable (Kaj Barck: kernels 2.4.18 and 2.4.20 with usbserial and Prolific 2303 Single Port Serial Driver support, create device files according to kernel documentation and use GPRS scripts with /dev/ttyUSB0 serial port)
Siemens s45
Siemens ME45
Siemens M50


Install

General stuff

If you are running a 2.4.x kernel, add the following line to /etc/modules.conf:


options ppp_async flag_time=0
      

Download the GPRS configuration and help files:

linux_gprs.xml - document root
linux_gprs.html - the same document in html
gprs - pppd configuration file
gprs-connect-chat - connect AT command script
gprs-disconnect-chat - disconnect AT command script
gprs-wvdial.conf - wvdial configuration used with USB

As root, copy the gprs* files to /etc/ppp/peers/ and make shure that they are owned by root and the chat scripts are executable:


# cp gprs* /etc/ppp/peers/
# chown root:root /etc/ppp/peers/gprs*
# chmod u+rwx,g=rx,o=rx /etc/ppp/peers/gprs-connect-chat
# chmod u+rwx,g=rx,o=rx /etc/ppp/peers/gprs-disconnect-chat
      

Take a quick look at these file just to see what they're made of.

Next you need to configure the name servers. If your phones ppp stack can give the DNS server addresses and if your /etc/ppp/ip-up or /etc/ppp/ip-up.local script can hande nameserver configuration from pppd, set the /etc/ppp/peers/gprs options to this:


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

With this option the GPRS network given name servers are saved to /etc/ppp/resolv.conf and the ip-up scripts could for example copy this file to /etc/resolv.conf.

If the phone does not support the usepeerdns option, add DNS servers to your /etc/resolv.conf. For example Radiolinja's name servers are:


nameserver 213.161.033.200
nameserver 212.226.226.001
      

Also check, that you have order hosts,bind line in your /etc/host.conf.

Set the Access Point Name (APN) and QoS parameters in the gprs-connect-chat according to your GPRS operators settings.

The Nokia 8310 and 30 and some other phones may not support the GPRS QoS parameter AT commands, so the following lines must be removed from the gprs-connect-chat file:


OK              AT+CGQREQ=1,0,0,0,0,0           \
OK              AT+CGQMIN=1,0,0,0,0,0           \
      

On some phones, like Ericsson and SonyEricsson models, the AT command used to set the APN name and other options in the gprs-connect-chat actualy changes the settings in the phone. In this case you may wan't to remove the QoS line and this APN line from the gprs-connect-chat script:


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

On some other phones, like the Siemens models, this command acts like a normal modem init command and none of the GPRS settings in the phone are touched. See the GPRS-HOWTO for more details on these AT commands.

If the GPRS provider requires PAP or CHAP authentication to access the service, add the username and password to the /etc/ppp/pap-secrets and /etc/ppp/chap-secrets respectively.


Serial cable

Edit (mainly comment and uncomment) the /etc/ppp/peers/gprs file for serial cable. Here is a stripped example configuration:


...
#/dev/ttyS0     # serial port one
/dev/ttyS1      # serial port two
#/dev/ircomm0   # IrDA serial port one
#/dev/ttyUB0    # Bluetooth serial port one
...
115200  # fast enough
#57600  # perhaps usefull with IrDA
...
crtscts  # serial cable and Bluetooth
#nocrtscts # IrDA
...
      

Use with serial cable

Connect your phone with RS-232 serial cable to the serial port one (Linux /dev/ttyS0, Windows COM1). Start pppd with the GPRS scripts as root:


	# pppd call gprs
      

The pppd stays on the shell screen, so you can terminate the connection at any time by pressing CTRL-C.

Now, you should see the AT commands and pppd debug output on your terminal. If all goes well, your ifconfig on another terminal shows the GPRS connection as ppp0 and route -n shows the ppp0 IP address as the default gateway.

Here's an example log with Nokia 30, serial cable and Radiolinja:


# pppd call gprs
Press CTRL-C to close the connection at any stage!
defining PDP context...
~AT
OK
ATE1
OK
AT+CGDCONT=1,"IP","internet","",0,0
OK
waiting for connect...

ATD*99***1#
CONNECT
Connected.
If the following ppp negotiations fail,
try restarting the phone.

Serial connection established.
using channel 10
Using interface ppp0
Connect: ppp0 <--> /dev/ttyS1
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x23e95889>]
rcvd [LCP ConfRej id=0x1 <magic 0x23e95889>]
sent [LCP ConfReq id=0x2 <asyncmap 0x0>]
rcvd [LCP ConfAck id=0x2 <asyncmap 0x0>]
rcvd [LCP ConfReq id=0x0 <auth pap> <mru 1500> <asyncmap 0xa0000>]
sent [LCP ConfAck id=0x0 <auth pap> <mru 1500> <asyncmap 0xa0000>]
sent [PAP AuthReq id=0x1 user="rlnet" password="internet"]
sent [PAP AuthReq id=0x2 user="rlnet" password="internet"]
rcvd [PAP AuthAck id=0x2 ""]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 
0.0.0.0>]
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>]
rcvd [IPCP ConfReq id=0x0 <addr 10.6.6.6>]
sent [IPCP ConfNak id=0x0 <addr 10.0.0.1>]
rcvd [LCP ProtRej id=0x0 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
rcvd [IPCP ConfNak id=0x1 <addr 10.68.0.64> <ms-dns1 213.161.33.200> 
<ms-dns3 212.226.226.1>]
sent [IPCP ConfReq id=0x2 <addr 10.68.0.64> <ms-dns1 213.161.33.200> 
<ms-dns3 212.226.226.1>]
rcvd [IPCP ConfReq id=0x1 <addr 10.0.0.1>]
sent [IPCP ConfAck id=0x1 <addr 10.0.0.1>]
rcvd [IPCP ConfAck id=0x2 <addr 10.68.0.64> <ms-dns1 213.161.33.200> 
<ms-dns3 212.226.226.1>]
local  IP address 10.68.0.64
remote IP address 10.0.0.1
primary   DNS address 213.161.33.200
secondary DNS address 212.226.226.1
Script /etc/ppp/ip-up started (pid 2473)
Script /etc/ppp/ip-up finished (pid 2473), status = 0x0
        

You can also ping some Internet host to see if the connection is really set up properly, but some networks and hosts may not reply to ICMP echo requests because of security issues. At the time of writing at least www.ericsson.com ping's back:


# ping www.ericsson.com
PING a1762.g.akamai.net (195.197.54.135) from 10.68.0.64 : 56(84) bytes of data.
64 bytes from a195-197-54-135.deploy.akamaitechnologies.net 
(195.197.54.135): icmp_seq=0 ttl=250 time=639.090 msec

--- a1762.g.akamai.net ping statistics ---
10 packets transmitted, 2 packets received, 80% packet loss
round-trip min/avg/max/mdev = 639.090/814.522/989.955/175.434 ms
      

If the AT or PPP negotiations fail, try restarting the phone, reconnecting the serial cable and running the pppd scripts again. If this does not help, look at the scripts for details.


IrDA

Setup IrDA on the Linux machine

This part can be tricky, so see the relevant howto's and web pages. If all is setup up correctly /etc/rc.d/init.d/irda start would set irda up. With RedHat 7.1 on an HP OmniBook 4150 I got the IrDA port working manually like this:

  • enable SIR (Serial IR) IrDA from bios, defaults to 0x2F8h and IRQ 3

  • add following lines to /etc/modules.conf: alias char-major-161 ircomm-tty, alias tty-ldisk-11 irtty

  • the kernel modules exist for the standard RedHat kernel so no compiling is needed, and also the /dev/ir* device files exist

  • load the needed modules with insmod:

    
# insmod irda
    # insmod irtty
    # insmod ircomm
                
  • do the IrDA attachment to the new ttyS1 device (see dmesg before and after the IrDA bios enabling to get the correct serial device number)

    
# irattach /dev/ttyS1 -s 1
                
  • see from /var/log/messages that IrDA is ok

  • enable the phones IrDA and check if you can see it with irdadump

  • test the IrDA serial connection and AT commands with minicom, remember to set HW flow control off in settings:

    
# minicom /dev/ircomm0
                

Now it should work. If not, RTFM and search the net.


GPRS settings with IrDA

Edit (mainly comment and uncomment) the /etc/ppp/peers/gprs file for IrDA. Here's a stripped example configuration:


...
#/dev/ttyS0     # serial port one
#/dev/ttyS1     # serial port two
/dev/ircomm0    # IrDA serial port one
#/dev/ttyUB0    # Bluetooth serial port one
...
#115200		# fast enough
57600		# perhaps usefull with IrDA
...
#crtscts  # serial cable and Bluetooth
nocrtscts # IrDA
...
          

Use with IrDA

First setup the IrDA connection to the phone as explained previously. Then do the same stuff as with serial cable. An irdadump terminal can be usefull to see that the IrDA connection is ok.


Bluetooth

Setup Bluetooth on the Linux machine

This part is tricky, but here's how I did it. I started of with RedHat Linux 7.3 with upgrades like the 2.4.18-10 kernel, but after enough trials and errors I went to the vanilla 2.4.19 kernel. There are many Bluetooth stacks availabel for Linux, but I desided to try Bluez. And the Bluetooth device I use is a Racewood Bluetooth USB dongle.


Kernel config

Since I wanted to use Bluez stack, I should not have compiled the kernel with CONFIG_USB_BLUETOOTH=m, since this option is for the Axis Bluetooth stack. After multiple rmmod/modprobes and help from the bluez-users mailing list, I removed the bluetooth.o from /lib/modules/kernel-2.4.19/kernel/drivers/usb.

All my Bluetooth related kernel options are set like this:


# grep -i blue /usr/src/linux-2.4.19/.config
CONFIG_USB_BLUETOOTH=m # Don't use this option with Bluez Bluetooth!
# Bluetooth support
CONFIG_BLUEZ=m
CONFIG_BLUEZ_L2CAP=m
CONFIG_BLUEZ_SCO=m
# Bluetooth device drivers
CONFIG_BLUEZ_HCIUSB=m
# CONFIG_BLUEZ_USB_FW_LOAD is not set
# CONFIG_BLUEZ_USB_ZERO_PACKET is not set
# CONFIG_BLUEZ_HCIUART is not set
# CONFIG_BLUEZ_HCIDTL1 is not set
# CONFIG_BLUEZ_HCIVHCI is not set
          

Then I build, installed and booted the kernel as usual. Remeber to set the /usr/src/linux and /usr/src/linux-2.4 symbolic links to the current kernel sources, to /usr/src/linux-2.4.19 in my case.


Bluez modules, programs and some testing

Next I downloaded the Bluez sources from bluez.sourceforge.net

I did a ./configure && make && make install for all of these:


bluez-kernel-2.3.tar.gz create_dev script was not in this archive, but in Bluez CVS, see the README file
bluez-libs-2.2.tar.gz
bluez-utils-2.1.tar.gz
bluez-sdp-0.8.tar.gz
bluez-pan-1.1-pre1.tar.gz
bluez-hcidump-1.3.tar.gz
bluez-hciemu-1.0.tar.gz
bluez-bluefw-0.7.tar.gz
          

And now I have the hciconfig, hcitool and rfcomm programs and all the needed Bluez kernel modules installed. Take a look at the README's for each of the Bluez modules, since you may also need to create the device files (the create_dev script in bluez-kernel) and add the this kind of lines to /etc/modules.conf:


# For Bluez Bluetooth stack
alias net-pf-31 bluez
alias bt-proto-0 l2cap
alias bt-proto-2 sco
alias bt-proto-3 rfcomm
alias bt-proto-4 bnep

# for Bluetooth UARTs
alias tty-ldisc-15 hci_uart
          

Then do a depmod -a and plug in the Bluetooth dongle. At least mine lights a green led to tell [I've got power!]. Then I did a /etc/rc.d/init.d/bluetooth start and /var/log/messages shows these messages:


Nov  5 22:34:13 ransu hcid[5600]: HCI daemon ver 2.1 started
Nov  5 22:34:14 ransu bluetooth: hcid startup succeeded
Nov  5 22:34:14 ransu kernel: BlueZ Core ver 2.2 Copyright (C) 2000,2001 Qualcomm Inc
Nov  5 22:34:14 ransu kernel: Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
Nov  5 22:34:14 ransu bluetooth: sdpd startup succeeded
Nov  5 22:34:14 ransu kernel: BlueZ L2CAP ver 2.1 Copyright (C) 2000,2001 Qualcomm Inc
Nov  5 22:34:14 ransu kernel: Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
Nov  5 22:34:14 ransu sdpd[5606]: SDPd ver 0.8 started 
          

And with lsmod I can see that the basic Bluez modules have been loaded:


l2cap                  17408   1  (autoclean)
bluez                  35048   1  (autoclean) [l2cap]
usbcore                76992   1 
          

Then I manually load the USB Bluetooth drivers and try the hciconfig tool:


# modprobe hci_usb
# modprobe usb-uhci
# hciconfig 
hci0:   Type: USB 
        BD Address: 00:08:1B:00:1B:E7 ACL MTU: 192:8  SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN 
        RX bytes:0 acl:0 sco:0 events:0 errors:0
        TX bytes:0 acl:0 sco:0 commands:0 errors:0
          

Note

For some reason the USB dongle does not work right after loading modules the hciconfig outputs a 00:00:00:00:00:00 address to the card. The dongle did wake up after I did a hciconfig hci0 down && hciconfig hci0 up.

Now the device should be up and running and /var/log/messages and dmesg also show a great deal of info about the USB Bluetooth device. With hcitool I can now see my phone, which has Bluetooth on, and I can even l2ping it:


# hcitool inq
Inquiring ...
        00:02:EE:69:E7:BD       clock offset: 0x13e4    class: 0x502204
# l2ping 00:02:EE:69:E7:BD
Ping: 00:02:EE:69:E7:BD from 00:08:1B:00:1B:E7 (data size 20) ...
0 bytes from 00:02:EE:69:E7:BD id 200 time 26.47ms
0 bytes from 00:02:EE:69:E7:BD id 201 time 40.73ms
0 bytes from 00:02:EE:69:E7:BD id 202 time 30.54ms
0 bytes from 00:02:EE:69:E7:BD id 203 time 38.35ms
4 sent, 4 received, 0% loss
          

Bluez configuration

Bluez installs the config files to /etc/bluetooth:


# ls -l /etc/bluetooth/
total 20
drwxr-xr-x    2 root     root         4096 Oct 30 00:27 firmware
-rw-r--r--    1 root     root         1371 Oct 29 19:24 hcid.conf
----------    1 root     root           36 Oct 30 00:43 link_key
-rw-------    1 root     root            7 Oct 30 00:07 pin
-rw-r--r--    1 root     root          329 Nov  5 17:44 rfcomm.conf
          

The default settings in hcid.conf were fine for me, but the phones address needs to be added to the rfcomm.conf. This how my rfcomm.conf looks like:


rfcomm0 {
        # Automatically bind the device at startup
        bind yes;

        # Bluetooth address of the device
        device 00:02:EE:69:E7:BD;

        # RFCOMM channel for the connection
        channel 1;

        # Description of the connection
        comment "Nokia 7650";
}
          

To automatically connect the to the phone with Bluetooth RFCOMM, put rfcomm bind all command to the end of the start function in /etc/rc.d/init.d/bluetooth and rfcomm release all command to the end of stop function. Here is a snippet of my /etc/rc.d/init.d/bluetooth file:


...
start()
{
        echo -n $"Starting $prog: "
        daemon /sbin/hcid

        if [ -x /usr/sbin/sdpd ]; then
                daemon /usr/sbin/sdpd
        fi

        start_uarts
        touch /var/lock/subsys/bluetooth
        # bind all rfcomm connectins from /etc/bluetooth/rfcomm.conf
        rfcomm bind all
        echo
}
stop()
{
        echo -n $"Shutting down $prog: "
        killproc hcid

        if [ -x /usr/sbin/sdpd ]; then
                killproc sdpd
        fi

        stop_uarts
        rm -f  /var/lock/subsys/bluetooth
        # release all rfcomm connections
        rfcomm release all
        echo
}
...
          

/etc/bluetooth/pin holds the pin code which you need to type on the phone when the two Bluetooth devices are paired. Change the value to something more unpredictable than 1234.

When the Bluetooth subsystem is now restarted with /etc/rc.d/init.d/bluetooth restart, the rfcomm connection should be binded automatically even if no Bluetooth devices are connected to the Linux machine:


# /etc/rc.d/init.d/bluetooth restart
Shutting down Bluetooth:                                   [  OK  ]
Starting Bluetooth:                                        [  OK  ]
# rfcomm
rfcomm0: 00:02:EE:69:E7:BD channel 1 clean
          

To automatically start the Bluetooth at boot time, add a symlink from the corresponding run level directory to the bluetoot startup script:


# ln -s /etc/rc.d/init.d/bluetooth /etc/rc5.d/K90bluetooth
          

At this point, when the bluetooth daemons are up and running, it may be wise to pair the phone and the Linux host. With Nokia 7650 it goes something like this: start Bluetooth from the phone, scan for other Bluetooth hosts, select the Linux host, insert the correct pin (the same is in /etc/bluetooth/pin) and set the host as 'Authorized'. The authorized part means, that the phone does not ask for a pin code anymore. This is insecure but handy when testing the Bluetooth connection.


Sending and receiving files with Nokia 7650

There are a few good documents in the net on how to use Bluetooth OBEX with mobile devices: http://www.frasunek.com/HOWTO-Nokia7650-Bluetooth.txt and http://www.iterationx.org/essays/2002/10/21/. At the time of writing, the above HOWTO's do not show howto automatically setup the Bluetooth connections with OBEX, so I decided to write it down here.

So, to send and receive files with the OBEX protocol, the Linux host needs the OpenOBEX library and OpenOBEX applications from http://openobex.sourceforge.net/ and ussp-push application from http://www.unrooted.net/hacking/bluez-rfcomm-obex.html. Compile and install the OpenOBEX library and applications and the ussp-push tool, #./configure && make should do it.

Note

TO BE CONTINUED


GPRS settings with Bluetooth

Edit (mainly comment and uncomment) the /etc/ppp/peers/gprs file for Bluetooth. Here's a stripped example configuration:


...
#/dev/ttyS0     # serial port one
#/dev/ttyS1     # serial port two
#/dev/ircomm0   # IrDA serial port one
/dev/rfcomm0    # Bluetooth serial port one
...
115200		# fast enough
#57600		# perhaps usefull with IrDA
...
crtscts  # serial cable and Bluetooth
#nocrtscts # IrDA
...
        

Now you should, fingers crossed, be able start the Bluetooth GPRS connection.


Use with Bluetooth

If the bluetooth daemons are not running yet, start them and try opening the connection:


# /etc/rc.d/init.d/bluetooth start
Starting Bluetooth:                                        [  OK  ]
# pppd call gprs
Press CTRL-C to close the connection at any stage!
defining PDP context...
rAT
OK
ATH
OK
ATE1
OK
AT+CGDCONT=1,"IP","internet","",0,0
OK
waiting for connect...

ATD*99***1#
CONNECT
Connected.
Connected.
If the following ppp negotiations fail,
try restarting the phone.

Serial connection established.
using channel 4
Using interface ppp0
Connect: ppp0 <--> /dev/rfcomm0
rcvd [LCP ConfReq id=0x0 <auth pap> <mru 1500> <asyncmap 0xa0000>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x4df00a4b>]
sent [LCP ConfAck id=0x0 <auth pap> <mru 1500> <asyncmap 0xa0000>]
rcvd [LCP ConfRej id=0x1 <magic 0x4df00a4b>]
sent [LCP ConfReq id=0x2 <asyncmap 0x0>]
rcvd [LCP ConfAck id=0x2 <asyncmap 0x0>]
sent [PAP AuthReq id=0x1 user="rlnet" password="internet"]
rcvd [PAP AuthAck id=0x1 ""]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>]
rcvd [IPCP ConfReq id=0x0 <addr 10.6.6.6>]
sent [IPCP ConfNak id=0x0 <addr 10.0.0.1>]
rcvd [LCP ProtRej id=0x0 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [IPCP ConfNak id=0x1 <addr 10.64.1.141> <ms-dns1 213.161.33.200> <ms-dns3 212.226.226.1>]
sent [IPCP ConfReq id=0x2 <addr 10.64.1.141> <ms-dns1 213.161.33.200> <ms-dns3 212.226.226.1>]
rcvd [IPCP ConfReq id=0x1 <addr 10.0.0.1>]
sent [IPCP ConfAck id=0x1 <addr 10.0.0.1>]
rcvd [IPCP ConfAck id=0x2 <addr 10.64.1.141> <ms-dns1 213.161.33.200> <ms-dns3 212.226.226.1>]
local  IP address 10.64.1.141
remote IP address 10.0.0.1
primary   DNS address 213.161.33.200
secondary DNS address 212.226.226.1
Script /etc/ppp/ip-up started (pid 2119)
Script /etc/ppp/ip-up finished (pid 2119), status = 0x0
      

So the pppd scripts seem to work. Verify the connectin with ping:


# ping www.ericsson.com
PING a1762.g.akamai.net (195.197.54.137) from 10.68.0.29 : 56(84) bytes of data.
64 bytes from a195-197-54-137.deploy.akamaitechnologies.net 
(195.197.54.137): icmp_seq=0 ttl=250 time=832.947 msec
64 bytes from a195-197-54-137.deploy.akamaitechnologies.net 
(195.197.54.137): icmp_seq=1 ttl=250 time=627.201 msec

--- a1762.g.akamai.net ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/mdev = 627.201/798.043/933.983/127.655 ms
      

Everything is now setup. Just go surfing!


USB

USB device configuration for Orange SPV

When I connected an Orange SPV to my RedHat 8.0 Linux box with the USB cable, /var/log/messages shows the manufacturer and device id's:


usb.c: USB device 23 (vend/prod 0xbb4/0xce) is not claimed by any active driver.Apr 10 20:50:50 ransu kernel: hub.c: USB new device connect on bus2/2, assigned
device number 23
Apr 10 20:50:50 ransu kernel: usb.c: USB device 23 (vend/prod 0xbb4/0xce) is not claimed by any active driver.
Apr 10 20:50:53 ransu /etc/hotplug/usb.agent: ... no modules for USB product bb4/ce/0

So, the device id's are visible, but none of the hotplug scripts know which driver could use it. Not a surprise, but the id's are according to http://www.linux-usb.org/usb.ids identical to the O2's Xda:


0bb4  High Tech Computer Corp.
        00ce  mmO2 XDA GSM/GPRS Pocket PC
        

After reading about USB serial drivers from Linux kernel document Documentation/usb/usb-serial.txt, I tried usbserial driver with the vendor and product id's given by the USB logs:


# modprobe usbserial vendor=0x0bb4 product=0x00ce
        

Looking at /var/log/messages, the driver seems to have loaded well:


Apr 10 20:59:03 ransu kernel: usb.c: registered new driver serial
Apr 10 20:59:03 ransu kernel: usbserial.c: USB Serial support registered for Generic
Apr 10 20:59:03 ransu kernel: usbserial.c: Generic converter detected
Apr 10 20:59:03 ransu kernel: usbserial.c: Generic converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
Apr 10 20:59:03 ransu kernel: usbserial.c: USB Serial Driver core v1.4
        

A trial with minicom on the device /dev/ttyUSB0 shows that the connection to the phone actually works, wow!

Note

Note that the phones Modem Link must be activated from Programs-Accessories-Modem Link with USB before it answers to AT commands.


GPRS setup for USB

I chose to use wvdial with the SPV because chat didn't work for me at all. The reason might be my own manual and screwed up upgrade from RedHat 7.3 to 8.0. See the gprs-wvdial.conf for the initialisation commands. The pppd configuration is very similar to the other cases, since only the device file changes to /dev/ttyUSB0 and connect script changes to gprs-wvdial.conf. Here's a stripped down configuration for Orange SPV as a USB serial device:


...
# 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"
...
# 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
...

Here is dump of a successfull GPRS connection:


# pppd call gprs
--> WvDial: Internet dialer version 1.53
--> Initializing modem.
--> Sending: ATH
ATH
OK
--> Sending: ATE1
ATE1
OK
--> Sending: AT+CGDCONT=1,"IP","internet","",0,0
AT+CGDCONT=1,"IP","internet","",0,0
OK
--> Modem initialized.
--> Sending: ATD*99#
--> Waiting for carrier.
ATD*99#
CONNECT
--> Carrier detected.  Waiting for prompt.
~[7f]}#@!}!}.} }-}#}%B#}%}'}"}(}"[0f]J~
--> PPP negotiation detected.
Serial connection established.
using channel 7
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB0
--> PPP negotiation detected.
Serial connection established.
using channel 8
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB0
rcvd [LCP ConfReq id=0x11 <auth chap MD5> <pcomp> <accomp>]
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x9c88f8d9>]
sent [LCP ConfRej id=0x11 <pcomp> <accomp>]
rcvd [LCP ConfRej id=0x1 <magic 0x9c88f8d9>]
sent [LCP ConfReq id=0x2 <asyncmap 0x0>]
rcvd [LCP ConfReq id=0x12 <auth chap MD5>]
sent [LCP ConfAck id=0x12 <auth chap MD5>]
rcvd [LCP ConfAck id=0x2 <asyncmap 0x0>]
rcvd [CHAP Challenge id=0x6 <e87abfa4444519b38d3a0605b385c0af3456549a1326fba697c73b9bc933bdd4ab10edaa380654a120c1b55540c5e923e3f57a97>, name = ""]
sent [CHAP Response id=0x6 <ee090487bc5d8833e366b382c1e1323f>, name = "rlnet"]
rcvd [CHAP Success id=0x6 ""]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>]
rcvd [LCP ProtRej id=0x6 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
rcvd [IPCP ConfReq id=0x13]
sent [IPCP ConfNak id=0x13 <addr 10.0.0.1>]
rcvd [IPCP ConfReq id=0x14 <addr 10.0.0.1>]
sent [IPCP ConfAck id=0x14 <addr 10.0.0.1>]
rcvd [IPCP ConfReq id=0x15 <addr 10.0.0.1>]
sent [IPCP ConfAck id=0x15 <addr 10.0.0.1>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [IPCP ConfNak id=0x1 <addr 10.68.1.68> <ms-dns1 213.161.33.200> <ms-dns3 212.226.226.1>]
sent [IPCP ConfReq id=0x2 <addr 10.68.1.68> <ms-dns1 213.161.33.200> <ms-dns3 212.226.226.1>]
rcvd [IPCP ConfAck id=0x2 <addr 10.68.1.68> <ms-dns1 213.161.33.200> <ms-dns3 212.226.226.1>]
local  IP address 10.68.1.68
remote IP address 10.0.0.1
primary   DNS address 213.161.33.200
secondary DNS address 212.226.226.1
Script /etc/ppp/ip-up started (pid 3239)
Script /etc/ppp/ip-up finished (pid 3239), status = 0x0

And ping verifies that the connection is up and running:


# ping www.ericsson.com
PING a1762.g.akamai.net (195.197.54.137) from 10.68.1.68 : 56(84) bytes of data.
--- a1762.g.akamai.net ping statistics ---
1 packets transmitted, 0 received, 100% loss, time 0ms

[root@ransu peers]# ping www.ericsson.com
PING a1762.g.akamai.net (195.197.54.135) from 10.68.1.68 : 56(84) bytes of data.64 bytes from a195-197-54-135.deploy.akamaitechnologies.net (195.197.54.135): icmp_seq=1 ttl=251 time=844 ms
64 bytes from a195-197-54-135.deploy.akamaitechnologies.net (195.197.54.135): icmp_seq=2 ttl=251 time=890 ms

--- a1762.g.akamai.net ping statistics ---
2 packets transmitted, 2 received, 0% loss, time 6756ms
rtt min/avg/max/mdev = 844.408/867.503/890.598/23.095 ms
# ping www.microsoft.fi
PING web01.microsoft.fi (212.209.134.48) from 10.68.1.68 : 56(84) bytes of data.
--- web01.microsoft.fi ping statistics ---
22 packets transmitted, 0 received, 100% loss, time 21012ms

So, the Orange SPV works via USB. Maybe other GPRS phones with USB support work too. At least adding a new USB device seems to be easy in Linux, if there is a working driver around.


Help

For help, take a look at the gprs, gprs-connect-chat and gprs-disconnect-chat files and search the net! I'll update this document and the related scripts and config files when I feel like it, but they will be available at http://www.iki.fi/mikko.rapeli/linux_gprs.html.


Thanks

Previously my scripts worked with 2.2.x kernels but not with the 2.4.x kernels. The fix, the modules.conf line, was discovered by Jukka Taimisto and Jaakko Rautiainen. Thanks!

That's it - enjoy!