For a long while, I'd wanted to use my spangly SPV as a modem from Linux. Fow Windows users, it seemed just too easy - the drivers are provided on the CD!

There just had to be a way - it's just pppd, surely!

Well, I've done it, and the details are here. Note that this is the UK setup. I'm sure that it will work for other countries if the Access Point Name (orangeinternet here) is changed accordingly.

Prerequisites

  • Linux kernel 2.4
  • USB drivers. A quick lsmod as root should show the module usb-hci or some other USB driver.
  • pppd - If you've used a modem to dial out with this box, then you're on.

Files

Create or edit the following files:

  • /etc/ppp/chap.secrets
  • /etc/ppp/peers/spv
  • /etc/ppp/peers/spv-connect-chat

The contents of these files are as follows.

/etc/ppp/chap.secrets:

# Secrets for authentication using CHAP
# client        server  secret                  IP addresses
your.full.domain.name  ""      "orange"        *

/etc/ppp/peers/spv:

connect '/usr/sbin/chat -vf /etc/ppp/peers/spv-connect-chat'

/dev/ttyUSB0
-detach
debug
idle 900

nopcomp
noaccomp
nobsdcomp
nodeflate
noccp
novj
usepeerdns
defaultroute
ipcp-accept-local

noauth

/etc/ppp/peers/spv-connect-chat:

"" AT
OK AT&F
OK 'AT+cgdcont=1,"IP","orangeinternet","",0,0'
OK ATDT*99#
CONNECT ""

Now we are ready to set up the phone.

 

Setting up the SPV

First, take the phone out of the cradle. The reason will become clear.

Now, tail the file /var/log/debug (If you don't have one, then read up on syslog.conf)

Now, put the phone in the cradle. /var/log/debug should now look like:

Sep 19 21:28:40 bobbins kernel: hub.c: USB new device connect on bus1/1, 
assigned device number 3
Sep 19 21:28:40 bobbins kernel: usb.c: USB device 3 (vend/prod 0xbb4/0xcf) 
is not claimed by any active driver.

Now go to the Programs/More/More/Accessories/Modem Link, and select USB in the Connection spinner. Next click Menu then Activate

At this point in time, the kernel just isn't bothered about the SPV - it's just some strange device. Now we will start to do magic!

What we now need to do is load the usbserial module. This fellow makes the USB port appear just like an RS-232 port.

 

Loading the usbserial Kernel Module

Now type:

[root@bobbins /]# modprobe usbserial vendor=0x0bb4 product=0x00ce

Remember those two hex numbers from before? /var/log/debug should now start to look like:

Sep 19 21:37:04 bobbins kernel: usb.c: registered new driver serial
Sep 19 21:37:04 bobbins kernel: usbserial.c: USB Serial support registered 
for Generic
Sep 19 21:37:04 bobbins kernel: usbserial.c: USB Serial Driver core v1.4

Try unplugging the phone from the cradle and then plugging it back in again. The kernel should recognise its old friend:

Sep 19 21:37:22 bobbins kernel: hub.c: USB new device connect on bus1/1, 
assigned device number 4
Sep 19 21:37:22 bobbins kernel: usbserial.c: Generic converter detected
Sep 19 21:37:22 bobbins kernel: usbserial.c: Generic converter now attached 
to ttyUSB0 (or usb/tts/0 for devfs)

The next bit is really exciting, although not strictly necessary... Open minicom, and configure the thing to look at /dev/ttyUSB0 Press enter a couple of times, and then type AT. If you now see OK back at you, then we're cooking on gas! Yes, the SPV is reacting just like a standard modem. Told you it was exciting!

 

Starting the Connection

The first thing to do is to make sure that no existing route exists. As root, inspect your current routing table:

[root@bobbins /]# route 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

Here we can see that I have a default route set to my gateway box at IP 192.168.1.1 - we'll need to remove the route for the duration of the dialup connection. I'm sure that this can be replaced with the ppp connection, but I couldn't be arsed to find out how.

[root@bobbins /]# route del default gw 192.168.1.1

A quick re-run of route will confirm that the default route has been deleted.

Now we can fire up the connection for real!

Make sure that the scripts created before are all chmod +x and then run:

[root@bobbins /]# pppd call spv

/var/log/debug should now start to fill with all sorts of rubbish:

Sep 19 21:50:51 bobbins pppd[10486]: pppd 2.4.1 started by paul, uid 0
Sep 19 21:50:52 bobbins chat[10487]: send (AT^M)
Sep 19 21:50:52 bobbins chat[10487]: expect (OK)
Sep 19 21:50:52 bobbins chat[10487]: T^M^M
Sep 19 21:50:52 bobbins chat[10487]: OK
Sep 19 21:50:52 bobbins chat[10487]:  -- got it 
Sep 19 21:50:52 bobbins chat[10487]: send (AT&F^M)
Sep 19 21:50:52 bobbins chat[10487]: expect (OK)
Sep 19 21:50:52 bobbins chat[10487]: ^M
Sep 19 21:50:52 bobbins chat[10487]: AT&F^M^M
Sep 19 21:50:52 bobbins chat[10487]: OK
Sep 19 21:50:52 bobbins chat[10487]:  -- got it 
Sep 19 21:50:52 bobbins chat[10487]: send (AT+cgdcont=1,"IP","orangeinternet","",0,0^M)
Sep 19 21:50:53 bobbins chat[10487]: expect (OK)
Sep 19 21:50:53 bobbins chat[10487]: ^M
Sep 19 21:50:53 bobbins chat[10487]: AT+cgdcont=1,"IP","orangeinternet","",0,0^M^M
Sep 19 21:50:53 bobbins chat[10487]: OK
Sep 19 21:50:53 bobbins chat[10487]:  -- got it 
Sep 19 21:50:53 bobbins chat[10487]: send (ATDT*99#^M)
Sep 19 21:50:53 bobbins chat[10487]: expect (CONNECT)
Sep 19 21:50:53 bobbins chat[10487]: ^M
Sep 19 21:50:53 bobbins chat[10487]: ATDT*99#^M^M
Sep 19 21:50:53 bobbins chat[10487]: CONNECT
Sep 19 21:50:53 bobbins chat[10487]:  -- got it 
Sep 19 21:50:53 bobbins chat[10487]: send (^M)
Sep 19 21:50:53 bobbins pppd[10486]: Serial connection established.
Sep 19 21:50:53 bobbins pppd[10486]: using channel 2
Sep 19 21:50:53 bobbins pppd[10486]: Using interface ppp0
Sep 19 21:50:53 bobbins pppd[10486]: Connect: ppp0 <--> /dev/ttyUSB0
Sep 19 21:50:54 bobbins /etc/hotplug/net.agent: assuming ppp0 is already up
Sep 19 21:50:54 bobbins pppd[10486]: rcvd [LCP ConfReq id=0x1e <auth chap MD5>  ]
Sep 19 21:50:54 bobbins pppd[10486]: sent [LCP ConfReq id=0x1 <asyncmap 0x0> ]
Sep 19 21:50:54 bobbins pppd[10486]: sent [LCP ConfRej id=0x1e <pcomp> ]
Sep 19 21:50:54 bobbins pppd[10486]: rcvd [LCP ConfRej id=0x1 <magic 0xeed3c3be>]
Sep 19 21:50:54 bobbins pppd[10486]: sent [LCP ConfReq id=0x2 <asyncmap 0x0>]
Sep 19 21:50:54 bobbins pppd[10486]: rcvd [LCP ConfReq id=0x1f <auth chap MD5>]
Sep 19 21:50:54 bobbins pppd[10486]: sent [LCP ConfAck id=0x1f <auth chap MD5>]
Sep 19 21:50:54 bobbins pppd[10486]: rcvd [LCP ConfAck id=0x2 <asyncmap 0x0>]
Sep 19 21:50:54 bobbins pppd[10486]: rcvd [CHAP Challenge id=0x1c 
<5231c7670369329813703facbbc6a0223b01f114ce4584104f82eab7a7704218fe4c>, name = ""]
Sep 19 21:50:54 bobbins pppd[10486]: sent [CHAP Response id=0x1c 
<7aa1f754455b8bfaf8c3ee92a20dd0cb>, name = "bobbins.objektiv.co.uk"]
Sep 19 21:50:54 bobbins pppd[10486]: rcvd [CHAP Success id=0x1c ""]
Sep 19 21:50:54 bobbins pppd[10486]: sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> 
<ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
[root@bobbins paul]# Sep 19 21:50:57 bobbins pppd[10486]: sent [IPCP ConfReq id=0x1 
<addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
Sep 19 21:51:00 bobbins pppd[10486]: rcvd [IPCP ConfReq id=0x17]
Sep 19 21:51:00 bobbins pppd[10486]: sent [IPCP ConfNak id=0x17 <addr 0.0.0.0>]
Sep 19 21:51:00 bobbins pppd[10486]: rcvd [IPCP ConfReq id=0x18]
Sep 19 21:51:00 bobbins pppd[10486]: sent [IPCP ConfAck id=0x18]
Sep 19 21:51:00 bobbins pppd[10486]: sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> 
<ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
Sep 19 21:51:00 bobbins pppd[10486]: rcvd [IPCP ConfNak id=0x1 
<addr 172.23.234.186> <ms-dns1 194.33.26.135> ]
Sep 19 21:51:00 bobbins pppd[10486]: sent [IPCP ConfReq id=0x2 
<addr 172.23.234.186> <ms-dns1 194.33.26.135> ]
Sep 19 21:51:00 bobbins pppd[10486]: rcvd [IPCP ConfAck id=0x2 
<addr 172.23.234.186> <ms-dns1 194.33.26.135> <ms-dns3 193.35.131.194>]
Sep 19 21:51:00 bobbins pppd[10486]: Could not determine remote IP address: 
defaulting to 10.64.64.64
Sep 19 21:51:00 bobbins pppd[10486]: not replacing existing default route to 
eth0 [192.168.1.1]
Sep 19 21:51:00 bobbins pppd[10486]: local  IP address 172.23.234.186
Sep 19 21:51:00 bobbins pppd[10486]: remote IP address 10.64.64.64
Sep 19 21:51:00 bobbins pppd[10486]: primary   DNS address 194.33.26.135
Sep 19 21:51:00 bobbins pppd[10486]: secondary DNS address 193.35.131.194
Sep 19 21:51:00 bobbins pppd[10486]: Script /etc/ppp/ip-up started (pid 10502)
Sep 19 21:51:01 bobbins pppd[10486]: Script /etc/ppp/ip-up finished (pid 10502), 
status = 0x0

In the terminal window used to lauch pppd, you will also see lots of stuff with the last few lines looking like:

Could not determine remote IP address: defaulting to 10.64.64.64
not replacing existing default route to eth0 [192.168.1.1]
local  IP address 172.23.234.186
remote IP address 10.64.64.64
primary   DNS address 194.33.26.135
secondary DNS address 193.35.131.194
Script /etc/ppp/ip-up started (pid 10502)
Script /etc/ppp/ip-up finished (pid 10502), status = 0x0

The golden bit in both is the /etc/ppp/ip-up finished line. This tells us that a connection was made. Don't worry about the Could not determine remote IP address.

A quick peek at the SPV display should reveal that the normal 'aerial' symbol is replaced by two arrows. This means we are connected. Hurrah!!

Running ifconfig should now tell us that the interface is up and running:

[root@bobbins /]# ifconfig
...
stuff
...
ppp0      Link encap:Point-to-Point Protocol  
          inet addr:172.23.234.186  P-t-P:10.64.64.64  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:52 (52.0 b)  TX bytes:102 (102.0 b)

Now, make a note of the number in the P-t-P bit. (10.64.64.64 in my case). This will be the new gateway address.

Now configure the ppp connection to be the default route. (You do want to actually use the connection, don't you?!)

[root@bobbins /]# route add default gw 10.64.64.64

 

The Bit You're Waiting For...

Now try pinging a remote machine. Or better still lynx to your favourite website. It's not rippingly quick, but it's quick enough to ssh into a machine in an emergency.

To kill the connection, press Ctrl+C in the window you used to lauch pppd. Also press the 'end call' button on the phone to completely disconnect the session. You just never know.

Once the session has ended, remove the new default and restore your old one. That is left as an exercise for the reader ;-).

Have fun!

--
Paul. (paul@paulperkins.net)

 

©2003 Paul Perkins