Bluetooth Project


Introduction

I have a phone that work provides, and it has BlueTooth. I have a lot of numbers in that phone, and I want to store them, just in case. This project was to enable me to back my phone up, the first part is described here, connecting my phone via bluetooth.

Hardware

The phone I have is a Nokia 6310i connected to the Orange network. The BlueTooth dongle I am using is USB based, and originally came with a Microsoft BlueTooth keyboard and mouse, as the original purchaser was using the keyboard and mouse with a Mac, he sold me the dongle for 10 quid. The PC is a standard PC running Debian GNU/ Linux, with a 2.4.24 kernel.

Software

Firstly I installed these packages: apt-get install bluez-utils bluez-sdp bluez-hcidump bluez-pan libbluetooth1 libsdp2 The I added in the hci_usb module and added it to /etc/modules: modprobe hci_usb echo "hci_usb" >> /etc/modules Then I started the bluez software: /etc/init.d/bluez-utils start At this point I checked I had a hci interface: tigger:~# hciconfig hci0: Type: USB BD Address: 00:50:F2:E2:33:49 ACL MTU: 192:8 SCO MTU: 64:8 UP RUNNING PSCAN ISCAN RX bytes:993 acl:32 sco:0 events:63 errors:0 TX bytes:818 acl:26 sco:0 commands:20 errors:0 Then I looked to see if I could see my 6310i, my phone has the the name 'awr': tigger:~# hcitool scan Scanning ... 00:60:57:9F:4C:C6 awr All well and good, and it was pingable too, with the command: tigger:~# l2ping 00:60:57:9F:4C:C6 Ping: 00:60:57:9F:4C:C6 from 00:50:F2:E2:33:49 (data size 20) ... 0 bytes from 00:60:57:9F:4C:C6 id 200 time 39.88ms 0 bytes from 00:60:57:9F:4C:C6 id 201 time 42.20ms ^C Next I added an entry to /etc/bluetooth/rfcomm.conf so that I had an alias for my phone: rfcomm0 { bind yes; device 00:60:57:9F:4C:C6; channel 1; comment "Nokia 6310i awr"; } Then I bound the phone: rfcomm bind 0 And then checked: tigger:~# rfcomm show rfcomm0: 00:60:57:9F:4C:C6 channel 1 closed The next stage was to create a dummy PIN application, so that I could make the phone and computer trust each other, and I didn't have X installed that it would appear bluez expects: vi /usr/bin/bluez-pin And then added in: #!/bin/bash echo "PIN:12345" and of course made it executable: chmod +x /usr/bin/bluez-pin I know the pin is nothing special, it was only to get the devices to talk .... I then altered /etc/bluetooth/pin: echo "12345" > /etc/bluetooth/pin And a quick restart of the bluez software to pick up the configuration changes: /etc/init.d/bluez-utils stop /etc/init.d/bluez-utils start And now to pair the computer and the phone: cat < /dev/rfcomm0 At which point the phone should as if the computer can connect, and when you accept ask for a pin. At this point I entered '12345' and the devices connected. As I trust(!) my computer and phone, I went to the BlueTooth menu, chose Paired Devices, and Changed 'Request conn. authorisation' to 'No'. The menu shortcut is 'Menu 11 4 3'.
At this point, the phone and the computer will connect, with no request for a pin number whenever the device /dev/rfcomm0 is accessed. As a finishing touch I created a sym. link for it: mkdir /dev/phone ln -s /dev/rfcomm0 /dev/phone/awr And thats it, /dev/phone/awr is now my phone!

Current Status

It works, and now I have a serial device in which I can access my phone.

Future

I can connect to the phone now, so I need to actually write some software to get the phonebook from it, and back to it should I need to, that will probably be another project! :)

Thanks

These pages turned out rather handy, and got me to this stage (thanks!):
Oh, and thanks to the Badger Brewery who created the three bottles of ale I drank whilst geeking at this (they were in order of favourite taste, Golden Champion, Tangle Foot and Original).