bluetooth and Linux

updated @ 2007-08-07

Installing bluetooth on Debian GNU/Linux for use with bluetooth enable Palm device [tested on my Sony Clie TH55 European version and on various Palm devices by other people]. Most of the information on this page is based on this tutorial, from which I've copied some parts, updating it to fit the current situation in Debian sid.

Installing bluetooth on GNU/Linux

I assume you are using Debian GNU/Linux unstable [sid], but this will work for a lot of other distributions too. For some distro's you may have to install bluez-{pan,utils,sdp} instead of only bluez-utils.

Be sure you have the latest packages list by doing a apt-get update, then install bluez-utils:

apt-get install bluez-utils

Update at 2007-07-02: maybe installing the bluetooth package is even better:

apt-get install bluetooth

Check with hciconfig whether it works. The output will look something like this:

# hciconfig
hci0:   Type: USB
        BD Address: 00:10:DC:AF:BB:E5 ACL MTU: 192:8  SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN
        RX bytes:778010 acl:9154 sco:0 events:5193 errors:0
        TX bytes:182357 acl:5245 sco:0 commands:21 errors:0

This might also be a good time to set the PIN in /etc/bluetooth/pin [create the file if it doesn't exist yet] and check that your PC can find your palm using hcitool e.g.

$ hcitool scan
Scanning ...
        00:07:E0:0C:A1:5A       My Palm

Next you need to start the hcid and sdpd if they are not already running. If you are using a Debian system, then the easiest way to do this (if they are not already running) is to use the scripts in /etc/init.d/ although if you are not running Debian, they don't need any parameters to be passed.

Sharing the network connection

The dund daemon will listen for incoming PPP connections and hand them off to pppd. To do this, create a file /etc/ppp/peers/dun containing (and customised to your setup of course):

debug
57600
noipdefault
proxyarp
# IP address of PC : IP address to be assigned to Palm
172.31.64.12:172.31.130.67
# My DNS server
ms-dns 172.31.129.1
ktune
noauth
local
nodefaultroute
noipx

Be sure to change the IP addresses to something sensible for you, like 192.168.0.1:168.0.200 and look up the DNS server you use from your Internet Service Provider [for example by doing cat /etc/resolv.conf].

Now invoke dund with the options:

dund --listen --persist --msdun call dun

On a Debian system, you can do this at startup by adding the line:

DUND_OPTIONS="--listen --persist --msdun call dun"

to /etc/default/bluetooth [formerly /etc/default/bluez-pan and later /etc/default/bluez-utils]. To enable this service at boottime, switch DUND_ENABLED=0 to DUND_ENABLED=1 in the same file.

Handheld Setup

  1. Goto the Preferences->Bluetooth->Trusted Devices [Preferences->Communications->Bluetooth->Trusted Devices for Tungsten] screen and add the computer. My device is called galadriel(0). It should be something like your hostname.
  2. Now goto the Connection screen [underneath "Bluetooth" on the Communications preferences panel] and add a new connection to your computer. "Connect to PC", Via "Bluetooth", "Device galadriel(0)" [or whatever you called it in the previous step].
  3. Next goto the Network screen and add a new service. The username and password are irrelevant unless you setup your PPP connection to require authentication, but set the "Connection" to the connection you created in the previous step and check that the Details screen has Connection type set to PPP, the idle timeout is at least 3 minutes, Query DNS is ticked and IP address is automatic. "Script" should just say "End:".
  4. OK, now you're all set. Go back to the Preferences->Network screen, select your new connection and hit "connect". If all goes to plan, you should now have a PPP link between your Palm and the computer -- if not, take a look in your /var/log directory for log files that might contain helpful info [a ppp log and/or syslog are good places to start].

Wireless hotsync: infrared & bluetooth

Infrared

David A. Desrosiers has written an excellent HOWTO.

Bluetooth

At the moment, it's not possible to do a "bluetooth sync" under Linux as pilot-link doesn't support this yet, but since it does support network syncing, once we have a working PPP connection, we can achieve the same effect. This section assumes you have a working PPP setup, as described in the previous section.

Handheld Setup

  1. Load the hotsync application, and goto the "Modem Sync Prefs" menu and select "Network".
  2. On the LanSync prefs menu, choose "Local HotSync".
  3. Now goto the "Primary PC Setup" menu and enter the details of the PC you want to HotSync with. Since theoretically the hostname and IP address contain redundent information if you have working DNS, it's not clear that both are necessary, but to save time on a DNS lookup, I entered the IP address. The Subnet Mask is optional - it defaults to 255.255.255.0.
  4. Finally, on the main HotSync screen, select "Modem" and then choose the network connection to your PC. To perform the hotsync, setup the PC as detailed below and then tap the button in the centre of the screen.

PC Setup

This part is easy - simply tell pilot-link [or jpilot; do this in the "Serial Port" field in Preferences] to use "net:any" as the port to use to connect to the Palm. e.g. pilot-xfer -p net:any -l. If using jpilot, don't forget to install pilot-link too:

apt-get install jpilot pilot-link