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 Fedora
Core 2 test 1 with a 2.6.1-1.65 kernel.
Software
Firstly I installed these RPMS (download them all together then install
them all at the same time):
http://dag.wieers.com/packages/bluez-bluefw/bluez-bluefw-1.0-0.rhfc1.dag.i386.rpm
http://dag.wieers.com/packages/bluez-libs/bluez-libs-2.5-0.rhfc1.dag.i386.rpm
http://dag.wieers.com/packages/bluez-utils/bluez-utils-2.4-1.rhfc1.dag.i386.rpm
The hci_usb module was already in my kenel, however the devices needed
in /dev didn't appear, so I manually created them (A bug has been filed
already about this to RedHat/Fedora):
mknod /dev/rfcomm0 c 216 0
mknod /dev/rfcomm1 c 216 0
Then I started the bluez software:
/etc/init.d/bluetooth start
At this point I checked I had a hci interface:
hci0: Type: USB
BD Address: 00:50:F2:E2:33:49 ACL MTU: 192:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN AUTH ENCRYPT
RX bytes:123 acl:0 sco:0 events:17 errors:0
TX bytes:562 acl:0 sco:0 commands:16 errors:0
Then I looked to see if I could see my 6310i, my phone has the
the name 'awr':
[root@fermit root]# hcitool scan
Scanning ...
00:60:57:9F:4C:C6 awr
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/bluepin
And then added in:
#!/bin/bash
echo "PIN:12345"
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 of course made it executable:
chmod +x /usr/bin/bluepin
And a quick restart of the bluez software to pick up the configuration
changes:
/etc/init.d/bluetooth stop
/etc/init.d/bluetooth 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! :)