NSLU2-Linux
view · edit · print · history

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: http://www.holtmann.org/linux/bluetooth/

Basic Installation

  1. Install OpenSlug 3.10 or later.
  2. Run the following to install the basic packages:

    For OpenSlug 3.10:

    ipkg install \
    kernel-module-bluetooth \
    kernel-module-l2cap \
    kernel-module-rfcomm \
    kernel-module-bnep \
    kernel-module-hci-usb \
    bluez-utils-nodbus


    For SlugOS 4.8:

    ipkg install \
    kernel-module-bluetooth \
    kernel-module-hci-usb \
    kernel-module-l2cap \
    kernel-module-bnep \
    kernel-module-rfcomm \
    bluez-hcidump \
    bluez-utils \
    bluez-utils-compat

  3. Then register all modules by:

    depmod -a

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:

hcitool inq

To prove that the low-level link is up, try pinging the other Bluetooth adapter (using the address hcitool inq returned):

l2ping [BDAddr]

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:
auth disable;
encrypt disable;
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.

Installing PPP

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 \
kernel-module-bnep \
kernel-module-ppp-generic \
kernel-module-slhc \
kernel-module-crc-ccitt \
kernel-module-ppp-async \
kernel-module-ppp-deflate \
kernel-module-bsd-comp \
libbluetooth1 \
bluez-utils-nodbus \
ppp

  1. Edit /etc/ppp/options to read:

    noauth
    crtscts
    lock
    local
    proxyarp
    ktune
    192.168.1.XX:192.168.1.YY
    ms-dns 192.168.1.ZZ

    (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)
  2. 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:
    #!/bin/bash
    echo "PIN:0000"
    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:
    #!/bin/sh

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 #

  1. Reboot the slug
  2. 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
Create /etc/bluetooth/rfcomm.conf. This file should contain:
#
# RFCOMM configuration file.
#

rfcomm0 {
# Automatically bind the device at startup
bind yes;

# Bluetooth address of the device attached to the slug
device 00:11:22:33:44:55;

# RFCOMM channel for the connection
channel 1;

# Description of the connection
comment "NSLU2";
}
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 hcitool con

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 cat /dev/rfcomm0 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)

Conceptronic CBT200U2
Conceptronic CBTGPS32
Targus ACB10
BelkinFS8100
BelkinF8T013 (note: this is Broadcom-based, and needs the firmware as below - otherwise, seems to work fine)
Sitecom CN-512
Sitecom CN-520
D-Link DBT-120

Other hardware/OS combinations

Debian/NSLU2

  • Advent CE1DR (as sold by PC World in the UK) - plug and play OK

Notes

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/"

Page last modified on September 24, 2008, at 08:22 PM