November 2006

 

 

This is how I configured gprs via bluetooth on my IPAC 3900 running OPIE familiar 0.8.4.

The cell phone used was Sony Ericsson K600i. The mobile operator was tele2.

 

 

Setting the bluetooth pin code (optional step).

 

echo 123456 > /etc/bluetooth/pin

 

 

Turn bluetooth radio on:

 

/etc/bluetooth/hciattach&

 

 

 

 

 

 

Show our own bluetooth number:

 

hcitool dev

 

 

Turn on the phone and make it discoverable.

 

Look for other bluetooth devices:

 

hcitool scan

 

------------ example begin ----------------

/etc # hcitool scan

 

Scanning ...

        00:12:EE:5F:6C:DC       Henriks K600i

------------- example end -----------------

 

 

This gives us the bdaddr of devices within range.

 

 

Find out on which channel the phone gives DUN service:

 

sdptool search --bdaddr 00:12:EE:5F:6C:DC DUN

 

You might be asked for a PIN on first ipaq and then phone here.

 

Enter same PIN one both.

 

------------ example begin ----------------

root@h3900:~# sdptool search --bdaddr 00:12:EE:5F:6C:DC DUN

 

Searching for DUN on 00:12:EE:5F:6C:DC ...

Service Name: Dial-up Networking

Service RecHandle: 0x10001

Service Class ID List:

  "Dialup Networking" (0x1103)

  "Generic Networking" (0x1201)

Protocol Descriptor List:

  "L2CAP" (0x0100)

  "RFCOMM" (0x0003)

    Channel: 1

Profile Descriptor List:

  "Dialup Networking" (0x1103)

    Version: 0x0100

 

root@h3900:~#

------------- example end -----------------

 

We will need the bdaddr and the channel number (1 in this case)

 

when we make the bind_dun script later.

 

 

 

 

 

rfcomm0 is a virtal serial port, it is used just like any

 

other perial port by pppd)

 

 

 

 

 

Make a script for binding rfcomm0 to the DUN in my phone.

 

This file needs to contain hw adresses uniqe for each user.

 

So first change <bdaddr> and <channel> below to that of

 

your phone (you got these from hcitool and sdptool above)

 

then just cut and paste:

 

-------------------------------------------

 

rfcomm bind 0 <bdaddr> <channel>

mknod -m 666 /dev/rfcomm0 c 216 0

 

-------------------------------------------

 

 

in my case like this:

 

---------------- cut and paste from here ----------------

 

cat > /sbin/bind_dun << EOF

 

rfcomm bind 0 00:12:EE:5F:6C:DC 1

mknod -m 666 /dev/rfcomm0 c 216 0

 

EOF

 

------------------------ end cut ------------------------

 

 

chmod +x /sbin/bind_dun

 

 

 

Run the bind_dun as root each time the iPAQ has been rebooted.

 

I dont know how to get this done automatically. Perhaps one

 

shall put something in an rfcomm.conf file somewhere.

 

 

 

 

 

 

 

Setup ppp

 

 

 

 

 

First a file telling pppd which files to use. The following

 

tells pppd where the ppp options are, which script to use

 

for dialing and the option file for that dialing script:

 

---------------- cut and paste from here ----------------

 

cat > /etc/ppp/peers/gprsbt << EOF

 

file /etc/ppp/options.gprs

connect "/usr/sbin/chat -f /etc/ppp/chat.gprs"

 

EOF

 

------------------------ end cut ------------------------

 

 

 

 

 

 

The options file for pppd may look like this:

 

---------------- cut and paste from here ----------------

 

cat > /etc/ppp/options.gprs << EOF

 

# pppd shall not propose IP address to other peer.

noipdefault

 

# Accept peers idea of address

ipcp-accept-local

 

# Ask peer for DNS servers.

usepeerdns

 

# Add default route

defaultroute

 

EOF

 

------------------------ end cut ------------------------

 

 

 

 

 

 

The chat script should exist already but the options

file for the chat script may look like this:

 

---------------- cut and paste from here ----------------

 

cat > /etc/ppp/chat.gprs << EOF

 

ABORT "BUSY"

"" "\d"

SAY "reseting modem\n"

"" "atz"

SAY "connecting\n"

OK 'AT+CGDATA="PPP",1'

SAY "dialing\n"

CONNECT "atdt*99#"

TIMEOUT 60

SAY "connected\n"

 

EOF

 

------------------------ end cut ------------------------

 

The options are critical, if it later dont work but you see that

the phone is trying, but then fails saying something is wrong,

then the problem may be here.

 

 

 

If the above dont work, try replacing the line:

CONNECT "atdt*99#

 

With one of these:

CONNECT "atdt*99***1#

CONNECT "atdt*99***2#

CONNECT "atdt*99***3#

CONNECT "atdt*99***4#

 

 

 

 

If it still dont work you need to set the Access Point Name (APN).

It is different for different networks (vodafone, tele2 etc).

 

Refere to your operator. In my case it was found here:

http://www.editorial.tele2.se/?page=tele2se_privat_mobiltelefoni_wapportalen_installningarochhjalp_internetviagprs&t2page=privat_mobiltelefoni_wapportalen_installningarochhjalp&nomenu=1

 

 

It is done with a command cgdcont:

at+cgdcont=1,"ip","<put the APN here>","0.0.0.0",0,0

 

 

So in my case (with tele2):

 

---------------- cut and paste from here ----------------

 

cat > /etc/ppp/chat.gprs << EOF

 

ABORT "BUSY"

"" "\d"

SAY "reseting modem\n"

"" "atz"

SAY "connecting\n"

OK 'at+cgdcont=1,"ip","internet.tele2.se","0.0.0.0",0,0'

"" 'AT+CGDATA="PPP",1'

SAY "dialing\n"

CONNECT "atd*99***2#"

TIMEOUT 60

SAY "connected\n"

 

EOF

 

------------------------ end cut ------------------------

 

 

 

 

 

 

And one script for initating a connection:

 

---------------- cut and paste from here ----------------

 

cat > /usr/bin/gprs << EOF

 

echo To disconnect kill the hciattach process

echo

echo it if dont work, did you do:

echo bind_dun

echo "/etc/bluetooth/hciattach&"

echo

pppd /dev/rfcomm0 lcp-echo-interval 0 call gprsbt

 

EOF

 

------------------------ end cut ------------------------

 

chmod a+x /usr/bin/gprs

 

 

 

 

 

 

 

Run the gprs script (dont need to be root) when you wish to connect.

 

 

 

 

 

 

 

 

To disconnect kill the hciattach process or turn radio of

 

from bluetooth applet in panel.

 

-------------------------------------------

 

root@h3900:~# jobs

 

[1] + Running /etc/bluetooth/hciattach

 

root@h3900:~# kill %1

 

root@h3900:~#

 

[1] + Terminated /etc/bluetooth/hciattach

 

-------------------------------------------

 

 

 

 

 

 

 

-----------------------cut and paste----------------------------

 

cat > bookmarks.html << EOF

 

<html>

 

<head>

 

<title>Henriks www pages</title>

 

</head>

 

<!--- --->

 

<body>

 

<a href="http://www.eit.se/">www.eit.se</a><br>

<a href="http://news.bbc.co.uk/2/low.html">news.bbc.co.uk</a><br>

<a href="http://www.google.com/palm">www.google.com</a><br>

<a href="http://www.dn.se/">www.dn.se</a><br>

 

<</body>

</html>

 

EOF

 

----------------------------------------------------------------

 

 

 

 

 

 

 

 

 

 

 

 

REFERENCES (some of these may be old)

 

 

http://www.handhelds.org/

 

http://www.handhelds.org:8080/wiki/IPMasqHowto

 

http://www.wbglinks.net/pages/reads/chainstables/iptablesmasq.html

 

http://www.eit.se/hb/misc/text/ipaq_gprs_bluetooth.txt

 

http://www.handhelds.org:8080/wiki/FamiliarLoopbackHowto

 

http://handhelds.org/hypermail/ipaq/126/12612.html

 

http://www.zaurususergroup.com/modules.php?op=modload&name=phpWiki&file=index&pagename=Bluetooth

 

http://www.linuxjournal.com/article/7525

 

 

/Henrik

 

 

Copyright 2005 Henrik Björkman www.eit.se.

 

Please use and redistribute as under GPL,

 

but remember to mention where the info came from.