i-Mode connection for the iPAQ

Introduction

A while back, my father donated his old iPAQ to me. Being a fan of free software, I immediately decided to put an alternative operating system on the unit. With Familiar, a free alternative was available, and it even provided me with a dpkg lookalike ipkg! With this system set up, I could do most things one can do with a PDA - maintain a calendar, take notes, play music, ... When cradled, I could connect it to the Internet via my desktop PC. Obviously a PDA isn't meant to be cradled all the time, so I had to find a way to connect it to the net while on the road as well. The hard part turned out to be finding a bluetooth card I could use with this OS, as at the time of writing this document, not a whole lot of Compact Flash cards are supported yet - partly because some manufacturers don't provide specifications required to write the drivers, partly because the ARM kernel used in Familiar isn't fully at par with the one used on i386 systems yet. In this document, I outline the steps necessary to get on the net via i-Mode (~GPRS) using a Bluetooth-capable phone.

Hard- and software

Provider

Belgian wireless carrier Base with I-mode

Steps

Get Bluetooth working

There's various HOWTO's available on getting Bluetooth functioning on (Familiar) Linux. Tip: use Bluez. If you are using the Opie image of Familiar 0.8.2, you will have to replace /bin/bluepin with a shell script like this one:

#!/bin/sh
echo -n PIN:
cat /etc/bluetooth/pin
exit 0

Find the hardware address of the phone

Use hcitool to find the various bluetooth devices in your neighbourhood. Provided you've made the phone broadcast its presence, it should show up in the scan.

~ # hcitool scan
Scanning ...
   <address> <friendly name>

Find the channel for dial-up networking

Check on what channel the phone provides dial-up networking (DUN):

sdptool search --bdaddr <bd> DUN

where <bd> is the hardware address of your mobile phone as detected by hcitool scan.

Bind rfcomm

I decided to bind /dev/rfcomm0 to the DUN channel of my phone.

/etc/init.d # cat bind_dun
rfcomm bind 0 <bdaddr> <channel>
mknod -m 666 /dev/rfcomm0 c 216 0

Configure PPP

I assume you have the point-to-point protocol set up on your device already. If not, ipkg search *ppp* is your friend.

On Familiar 0.8.x, the pppd options were changed versus 0.7.x. The file now only contains a minimal lock as option. I prefer the following:

---------------- cut and paste from here ----------------
cat > /etc/ppp/options << EOF
-detach
defaultroute
nocrtscts
lock
noauth
lcp-echo-interval 5
lcp-echo-failure 3
usepeerdns
115200
local
asyncmap 0
EOF
------------------------ end cut ------------------------

Now you'll need a chat script to tell the phone what to do.

---------------- cut and paste from here ----------------
cat > /etc/ppp/chat.imode << EOF
ABORT "BUSY"
"" "\d"
SAY "reseting modem\n"
"" "atz"
SAY "dialing\n"
OK 'AT+cgdcont=1,"IP","portalmmm.nl"'
OK "ATD*99#"
TIMEOUT 60
CONNECT ''
SAY "connected\n"
EOF
------------------------ end cut ------------------------

You'll also need to provide some additional options for pppd:

---------------- cut and paste from here ----------------
cat > /etc/ppp/peers/imode << EOF
debug
noauth
usepeerdns
/dev/rfcomm0 115200
115200
local
nocrtscts
defaultroute
noipdefault
connect '/usr/sbin/chat -f /etc/ppp/chat.imode -r /dev/console'
EOF
------------------------ end cut ------------------------

Get connected

Start pppd as follows:

~ # pppd call imode

If all goes well (and only if you changed the /etc/ppp/options file), you should see something like this:

reseting modem
dialing
connected
Serial connection established.
using channel 1
Using interface ppp0
Connect: ppp0 <--> /dev/rfcomm0

Check routing

As I had a default route already (via the USB connection in the cradle), I had to replace it:

route del default
route add default ppp0

Set proxy

In order to browse the net, you'll need to set the proxy still. In casu I use http://10.10.100.10:5080.

Photo

... and obviously no HOWTO document is truly complete without some sort of picture.

Picture of Compaq iPAQ and Motorola V500 camera phone