Connecting the P800 to Orange using Linux and Bluetooth


V1.2 17/4/03

This page describes how I have connected my Sony Ericsson P800 to Orange (UK) using Linux on an IBM 600E Laptop
The dream was to be able to easily connect from the laptop to the phone and then to the internet via GPRS

The Equipment

The equipment consists of:
IBM 600E Laptop running Linux - Redhat 7.3
Bluetooth USB Dongle - a super cheap one from Ebuyer @ £17 - it uses the csr chipset
Update: They have changed the design... The one I have is also available under the Blue Monkey brand name, and it bends in the middle.
SonyEricsson P800 on Orange (UK)

The main information to get this working came from the fine site at http://mobile.linux.pt/p800/ , be aware that some of the information is a bit out of date, sign up or study the mailing list archive for later developments. The USB Base, for example can now be used if the kernel USB module PL2303 is modified slightly, the information is here , you can do that when you recompile the kernel for the bluetooth stuff!
Also recommended is the p3nfsd program which can be used to NFS mount the phone on the Linux box, that is described on the http://www.koeniglich.de/p3nfs.html site.

The Method

Anyway, here's the what I did.

Get the Linux kernel 2.4.20 from http://www.kernel.org/
Get the latest bluetooth patches from http://www.holtmann.org/linux/kernel/ mh6 in my case.
Follow the instructions on http://mobile.linux.pt/p800/ until you can get the 'sdptool browse 00:0A:D9:17:7F:51' command working.

At this point I could not get the phone to bond to the profile of my laptop, this proved to be due to the hcid.conf that was used.
My revised file is here, now I can open the bluetooth connection dialogue on the phone, search and find 'Laptop(0)' and when I select it, and give the correct password, the phone bonds successfully.

As a side issue, I have not had any success while using Auto mode on the P800, I just turn it on or off as required.

The sequence required now is to discover the channel used for Dial-up access over the bluetooth connection, associate a device with it using rfcomm and then initiate a ppp session. Initially this was done manually, but having proved it, I decided a small Perl script would be a more practical solution.

The Bluedialer Program

The program, bluedialer, is available here and while its not perfect, it does the job of allowing a session to be started from the laptop with minimal fuss. One CPAN module is required, for keyboard handling, you can get it here if required.

Before using bluedialer you will need to edit the file, to set your phone bluetooth address and your /etc/resolve.conf settings probably.

To use bluedialer , after the laptop has booted up, and you have plugged in the USB bluetooth adapter, simply start a session as the superuser and run bluedialer, it requires ppp setup files also from examples available at http://mobile.linux.pt/p800/#2 and my versions are available in this /etc/ppp/peers/p800 file and this /etc/ppp/peers/p800.chat script, the dial up code for Orange in the UK is 'atd*99*1#' slightly different from the example on the http://mobile.linux.pt/p800/ site.

To end the bluedialer program simply enter a single 'q' character, and the program will tidy up after itself. Its proved fairly reliable so far, it will tell you if you forgot to switch bluetooth on from the phone :)

The drawbacks are, the bluetooth address of your phone is hard coded in the script, this is because 'hcitool inq' very rarely seems to return a value on my setup. If anyone has any ideas, I would be pleased to get them!
Also the DNS is not automatically set, I have added the DNS given during the connect dialogue to my /etc/resolv.conf.orig file, the bluedialer program will overwrite this onto your /etc/resolv.conf file when starting up, if required. This is commented out by default, if you have DNS issues see the comments in the start of the code. The first time you run you will not know the DNS numbers, but you should see them in the log on dialogue like this:
primary DNS address 158.43.192.1
secondary DNS address 158.43.128.1
You can probably use those, but dont blame me if they change!

A Session

A complete session should look like this..

[root@localhost root]# ./bluedialer
SIOCDELRT: No such process  < - - - no default route to delete
Channel is 3
Info: rfcomm connect 1 00:0A:D9:14:2B:35 3
launched rfcomm as pid number 3920
Connected /dev/rfcomm1 to 00:0A:D9:14:2B:35 on channel 3
Press CTRL-C for hangup
Info: pppd startup 
launched pppd as pid number 3921
Complete - Press q to quit
Serial connection established.
using channel 9
Using interface ppp0
Connect: ppp0 <--> /dev/rfcomm1
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xeec4bd34> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <pcomp> <accomp> <auth pap>]
sent [LCP ConfRej id=0x1 <auth pap>]
rcvd [LCP ConfRej id=0x1 <magic 0xeec4bd34>]
sent [LCP ConfReq id=0x2 <asyncmap 0x0> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x2 <asyncmap 0x0> <pcomp> <accomp>]
sent [LCP ConfAck id=0x2 <asyncmap 0x0> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x2 <asyncmap 0x0> <pcomp> <accomp>]
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <compress VJ 0f 01> <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=0x4 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
rcvd [IPCP ConfReq id=0x1 <addr 172.23.194.1>]
sent [IPCP ConfAck id=0x1 <addr 172.23.194.1>]
rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [IPCP ConfNak id=0x2 <addr 172.23.201.247> <ms-dns1 158.43.192.1> <ms-dns3 158.43.128.1>]
sent [IPCP ConfReq id=0x3 <addr 172.23.201.247> <ms-dns1 158.43.192.1> <ms-dns3 158.43.128.1>]
rcvd [IPCP ConfAck id=0x3 <addr 172.23.201.247> <ms-dns1 158.43.192.1> <ms-dns3 158.43.128.1>]
local  IP address 172.23.201.247
remote IP address 172.23.194.1
primary   DNS address 158.43.192.1
secondary DNS address 158.43.128.1
Script /etc/ppp/ip-up started (pid 3933)
....session happens in here....
Script /etc/ppp/ip-up finished (pid 3933), status = 0x0
Terminating on signal 15.
Script /etc/ppp/ip-down started (pid 3938)
sent [LCP TermReq id=0x3 "User request"]
Disconnected
Closed at User request
[root@localhost root]# rcvd [LCP TermAck id=0x3]
Connection terminated.
Connect time 1.6 minutes.
Sent 889 bytes, received 1773 bytes.
Waiting for 1 child processes...
  script /etc/ppp/ip-down, pid 3938
Script /etc/ppp/ip-down finished (pid 3938), status = 0x0
As the session is closed a dialogue will pop up on the phone giving the transfer amounts also.

The Bluenfs Program

The nfsapp program mentioned before has also now got its own little perl launcher in a similar style to the bluedialer program, its called bluenfs and is available here it works similarly to the bluedialer program, again the bluetooth address is hardcoded in and needs setting before use. To start it launch the nfsapp program on the P800 and scroll the jog dial down one click, you should see a message like 'Open Bluetooth/11 Waiting 30s on port 4', now before 30 seconds is up run the bluenfs program as root. The phone should give you an OK. The phone filesystem is now available on the laptop under /mnt/psion/
To finish the program simply do a cd to /mnt/psion/exit and the nfs connection will close down.

Good Luck, let me know if you succeed!
Now onto SyncML......

Any comments or help, drop me a mail to john@fireship.demon.co.uk