Note: This is not an introduction or overview on Bluetooth. It is an overview on how to get things installed on the slug. I found
http://www.hanscees.com/bluezhowto.html very useful to get an understanding of Bluetooth. A lot of linux bluetooth related info can also be found on:
- Install OpenSlug 3.10 or later.
- Run the following to install the basic packages:
For OpenSlug 3.10:
ipkg install \
For SlugOS 4.8:
ipkg install \
- Then register all modules by:
Test your work
You should now be able to do:
hciconfig hci0 up
to make the Bluetooth interface available to the Bluetooth protocol stack.
Run hciconfig by itself again should give something like this:
hci0: Type: USB
BD Address: 00:03:0D:00:07:8A ACL MTU: 192:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:8567 acl:125 sco:0 events:409 errors:0
TX bytes:4518 acl:128 sco:0 commands:130 errors:0
The `BDAddr` (short for `BD Address`) is the unique hardware address of the Bluetooth adapter.
You can scan for the presence of Bluetooth nodes in your vicinity:
To prove that the low-level link is up, try pinging the other Bluetooth adapter (using the address hcitool inq returned):
You can also use
hcitool scan which will give similar info.
If l2ping responds with "invalid exchange" it is possible that your target device does not support encryption. For that change the auth and encrypt lines in hcid.conf to:
You'll need to go to /etc/init.d and issue the commands
./bluetooth stop; ./bluetooth start in order for these settings to take effect. Without this I was unable to connect to my BT GPS receiver.
If l2ping responds with "Connection refused", it might be that you messed up your link keys. Go to /var/lib/bluetooth/<your device id> and remove the file linkkeys and try again.
If l2ping responds with "Function not implemented", it could help to restart your device, not only to restart the bluetooth via bluetooth stop; bluetooth start.
In order to run PPP (e.g) to turn your NSLU2 into a Bluetooth access point for devices like the Treo 650) install the following additional packages:
ipkg install \
- Edit /etc/ppp/options to read:
(edit the last two lines to suit your network topology, the first IP address is your BlueSlug, the second IP address will be assigned to the client, and the third IP address is your DNS server)
- Normally the pin is in the file
/etc/bluetooth/pin. This one is read by /bin/bluepin. However bluepin requires pygtk which is not available on the slug. Hence I replaced it with the following script:
Where you of course can replace 0000 with your pin.
Do not forget to make
/bin/bluepin executable (
chmod 555 /bin/bluepin)
And if you do not have bash on your slug then the first line may need to read:
Note that the file
/etc/bluetooth/hcid.conf contains the location of the pin function. My
hcid.conf contained out of the box:
# pin_helper /bin/bluepin;. If you have this as well you need to remove the #
- Reboot the slug
- Connect to the slug with your Bluetooth client (e.g. a Treo 650)
Getting serial communication to work
In order to run serial communication (rfcomm) install the following additional package:
ipkg install kernel-module-rfcomm
/etc/bluetooth/rfcomm.conf. This file should contain:
# RFCOMM configuration file.
# Automatically bind the device at startup
# Bluetooth address of the device attached to the slug
# RFCOMM channel for the connection
# Description of the connection
Where the number after device (here 00:11:22:33:44:55) identifies the device to which you want to connect (as given by rfcomm scan)
Then I had to connect the port using the command:
hcitool cc <device_address>.
You can verify that this actually works and that you made a connection through
Next bind the port with the command:
rfcomm bind rfcomm0
This will (through udev) also create /dev/rfcomm0 (which can be used for communication).
(rfcomm bind command is not necessary if rfcomm.conf has the entry bind yes;)
After that you should be able to connect to your bluetooth serial device.
I first tried connecting to my gps device and did
You can also use
minicom /dev/rfcomm0 (you might need to install minicom first)
Alternately as a starter you might be able to use
rfcomm connect 0 <device id>
List of hardware which is tested to work using this method. (please add)
BelkinF8T013 (note: this is Broadcom-based, and needs the firmware as below - otherwise, seems to work fine)
Other hardware/OS combinations
- Advent CE1DR (as sold by PC World in the UK) - plug and play OK
NOTE: If you have a Broadcom-based bluetooth dongle, you might have to load the firmware. You can get the firmware from the bluez homepage. Just "./configure && make install", "mkdir -p /usr/lib/hotplug/firmware", "mv /lib/firmware/* /usr/lib/hotplug/firmware/"