Sharp Zaurus, Bluetooth, GPRS and a Nokia 6310i

The document describes the steps that I took (minus all the wrong ones, and there were many) to get a successful GPRS data connection using my Sharp Zaurus PDA, a Nokia 6310i, a Socket Bluetooth card and an O2 (UK mobile phone operator) GPRS data account, I hope it helps you.

I’m assuming that you already have a Sharp Zaurus (Z) (or are intending to buy one) and that you are OK with using Linux on the command line.

Hardware Needed

Sharp Zaurus PDA
http://www.sharp.co.uk/pda

Socket Bluetooth card
http://socketcom.com

Nokia 6310i phone

Software

OpenZaurus 3.1RC1 is the alternative to the stock ROM that Sharp ships with the Z.
http://www.openzaurus.org

Affix – Bluetooth Protocol Stack for Linux
http://affix.sourceforge.net

From http://affix.sourceforge.net/feeds/unstable/zaurus/
blueapplet_1.2.6.1-2_arm.ipk
bluetooth-connector_1.2.6.7-1_arm.ipk
libgthread_1.2-10_arm.ipk
libopenobex_1.0.0.pre5-2_arm.ipk

From http://www.openzaurus.org/official/unstable/feed/
affix-modules_1.2.6-1_arm.ipk
affix_1.2.6-1_arm.ipk

Method

I placed all the ipks onto a CF card and installed them using aqpkg, you may need to force deps on a few of them. Reboot the Z and you should have a little (grey) Bluetooth icon on your task bar.

an lsmod gives me:

root@zaurus /root# lsmod
Module                  Size  Used by
affix_uart_cs           3952   1
affix_uart             20496   0  [affix_uart_cs]
affix                  81584   0  [affix_uart]
serial                 25952   0  [affix_uart_cs]
sharp_mmcsd_m          27424   2
devinfo                 3168   0  (unused)
sa1100_bi              45536   0  (unused)
net_fd                 36016   1  [sa1100_bi]
usbdcore               20448   0  [sa1100_bi net_fd]
usbdmonitor             6112   0Code language: CSS (css)

For some reason, when I put the card into the CF slot, the card is recognised, but I cannot ‘Turn Bluetooth ON’ using the taskbar applet*. So I need to run a little script, which I have placed in /root/bin

root@zaurus /root# cat /root/bin/bt
#!/bin/sh
cardctl eject 0
modprobe affix_uart_cs
cardctl insert 0
btctl init_uart tlp 115200 ring,ctl,low
btctl upCode language: PHP (php)

* apparently this is an issue with hwinit and it will be rectified in future affix releases.

When I run this on my Z, I see the card ‘ejected’ and then ‘inserted’, and the little taskbar icon turns blue. I can also see:

root@zaurus /root# btctl
Affix version: Affix 1.2.6
---->>>> Affix Bluetooth Driver control program <<<Code language: CSS (css)

and

root@zaurus /root# ifconfig
bt0       Link encap:UNSPEC  HWaddr
          00-02-EE-76-F3-FD-00-00-00-00-00-00-00-00-00-00
          UP RUNNING  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10
          RX bytes:0 (0.0 iB)  TX bytes:0 (0.0 iB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:400 (400.0 iB)  TX bytes:400 (400.0 iB)

usbd0     Link encap:Ethernet  HWaddr 40:00:01:00:00:01
          inet addr:192.168.129.201  Bcast:192.168.129.255 Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:776 errors:0 dropped:2 overruns:0 frame:0
          TX packets:670 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:44745 (43.6 kiB)  TX bytes:47111 (46.0 kiB)Code language: CSS (css)

So we have a bluetooth card plugged in and ready to roll, next we need to make the bluetooth connection.

Firstly, make sure that Bluetooth is enabled on your phone. Next, let’s see if the Z can see it.

root@zaurus /root# btctl discovery
Searching 8 sec ...
Searching done. Resolving names ...
done.
+1: Address: 00:02:ee:6c:d1:f5, Class: 0x500204, Key: "no", Name: "Nokia 6310i"
    Phone (Cellular) [Object Transfer,Telephony]Code language: CSS (css)

Now we need to pair the phone with the Z. The following adds the PIN of ‘1’ (not great I know) for the pairing

<code>root@zaurus /root# btctl addpin 00:02:ee:6c:d1:f5 "1"</code>Code language: CSS (css)

Now lets make the connection:

root@zaurus /root# btctl connect 00:02:ee:6c:d1:f5
Connecting to host 00:02:ee:6c:d1:f5 ...
Service found on channel 3Code language: CSS (css)

The phone should beep and ask you to accept the connection to ‘Zaurus’ press accept and type in a 1 when asked for the PIN

Connecting to channel 3 ...
Connected. Bound to line 0 [/dev/bty0].Code language: JavaScript (javascript)

Now we need do is set up a ppp link. The following information is specific to my 02 http://www.o2.co.uk GPRS data account. The settings I got from other snippets that I found elsewhere did not work with O2 _at_all_ they needed quite a bit of jiggling around.

Firstly backup your /etc/ppp/options, create a new one and put in it the following

# File:
# /etc/ppp/options
-detach
noauth
name web # the O2 GPRS data username
defaultroute
nocrtscts
lock
usepeerdns
/dev/bty0
115200
local
noccp
asyncmap a0000Code language: PHP (php)

Next make a new directory called chat and place in it the following 2 files

# File:
# /etc/ppp/chat/gprs-connect
#
# Description:
# chat script to open O2 GPRS service with Nokia 6310i GPRS phone.
#
# Modifed from script found at ConnectedUser.com
exec chat -v
TIMEOUT         5
ECHO            ON
ABORT           'nBUSYr'
ABORT           'nERRORr'
ABORT           'nNO ANSWERr'
ABORT           'nNO CARRIERr'
ABORT           'nNO DIALTONEr'
ABORT           'nRINGING....rn'
''              'rAT'
TIMEOUT         12
SAY             "Press CTRL-C to close the connection at any stage!"
OK              'ATE1'
OK              'AT+CGDCONT=,,"mobile.o2.co.uk"'
OK              'ATDT *99#'
TIMEOUT         22
SAY             "nTrying to connect...n"
CONNECT         ''
SAY             "nConnected."
SAY             "nIf the following ppp negotiations fail,n"
SAY             "try restarting the phone.n"Code language: PHP (php)

Note these 2 lines

OK              'AT+CGDCONT=,,"mobile.o2.co.uk"'
OK              'ATDT *99#'Code language: JavaScript (javascript)

mobile.o2.co.uk is the APN and *99# is the number to ‘dial’ see http://nds1.nokia.com/phones/files/guides/Nokia_AThelp.pdf [pdf] for more info.

The second file is a disconnect script:

#File:
# /etc/ppp/chat/gprs-disconnect
#
# send break
exec /usr/sbin/chat -V -s -S
ABORT           "BUSY"
ABORT           "ERROR"
ABORT           "NO DIALTONE"
SAY             "nSending break to the modemn"
""              "K"
""              "+++ATH"
SAY             "nPDP context detachedn"Code language: PHP (php)

Now create a file /etc/ppp/peers/gprs

#File:
# /etc/ppp/peers/gprs
#
# Settings here should work for a Nokia 6310i and a
# GPRS data account with O2 (ex BTCellnet) in the UK
# Darren Beale - spam@acksys.co.uk

debug

/dev/bty0 # bluetooth
115200

connect /etc/ppp/chat/gprs-connect
disconnect /etc/ppp/chat/gprs-disconnect

crtscts
defaultroute
usepeerdns
asyncmap a0000
noccp
noipdefaultCode language: PHP (php)

Nearly there, create a file /etc/ppp/pap-secrets with one line:

web      *       web

(This is the O2 username and password for a GPRS data account)

also create /etc/resolv.conf and add the lines:

nameserver 193.113.200.200
nameserver 193.113.200.201Code language: CSS (css)

I’m sure that here any valid nameserver will do, but these IP’s are correct for O2

Finally create the file /etc/ppp/ip-up.d/routing with the line

route add default gateway 10.6.6.6Code language: CSS (css)

again specific to 02.
Now lets try to connect.

At this point I suggest that you make sure syslog is running by typing

/etc/init.d/syslog start

you can now open a second terminal window and ‘watch logread’*

* if you can get OZ3.1 running busybox_0.61.pre-20021208-6 to log to a file please let me know how!

To connect, type:

pppd call gprs &

Your phone should say that it is establishing a GPRS connection, if it works, you’ll get teh little ‘G’ in the upper left corner.

root@zaurus ppp# ping www.openzaurus.org
PING vhost.sourceforge.net (66.35.250.210): 56 data bytes
64 bytes from 66.35.250.210: icmp_seq=1 ttl=48 time=2252.4 ms
64 bytes from 66.35.250.210: icmp_seq=2 ttl=48 time=1298.7 ms
64 bytes from 66.35.250.210: icmp_seq=3 ttl=48 time=1357.3 ms
64 bytes from 66.35.250.210: icmp_seq=4 ttl=48 time=1097.4 msCode language: CSS (css)

Result!

Notes:
You’ll need to chmod some of those files so they are executable
Make sure that everything in /etc/ppp is owned by root, i.e.
chmod -R root:root /etc/ppp

Credits
Thanks to:
-The OpenZaurus Team and the Affix team for writing the software for free
-ConnectedUser.com for a similar howto that was useful as a starting point
-Bill Unruh on comp.protocols.ppp for help with the ppp scripts


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *