Tills Palm Pages http://www.harbaum.org/till/palm 
Configure a linux PC as a bluetooth access point for a palm
 Tills Home
 Palm stuff
 
  Get in touch
 
  Argon V
BlueBlocks
Elite
IR Pong 1/2
Mulg
Phoinix Tools
 
  axxPac FTP
Battery Hack
Bluetooth
IR Ping
NoStreak Hack
OS Flash
 
  Tilt-Sensor
Cradle
Palm III-4MB
 
  FlashLib
Mensa
Mobile25
PBrickLib
SpaceLib
Step Counter
 
  Phoinix
palmOne
Open Source
FSF
GPL
 

 

The rfcomm related part of this HOWTO is outdated. The current versions of the BlueZ Linux Bluetooth stack contains a much better rfcomm kernel implementation. See e.g. Bens pages for a more recent setup.

The old howto is still provided for reference.

1. Hardware Requirements

Palm

This setup has only been tested using the palm bluetooth stack and a palm/toshiba bluetooth sd card in a palm m50x. Other bluetooth hardware has not been tested. Other bluetooth hardware for the palm using the palm bluetooth stack should work with the presented setup as well. Other bluetooth stacks may require a different setup procedure on the palm and on the linux pc.

Linux

On linux side, a acer bluetooth usb dongle and the ericsson bluetooth kit has been used. Other linux/bluez supported USB dongles should work as well. Serial bluetooth adapters will require a different setup, please refer to one of the various bluetooth/bluez HOWTOs for the setup of one of these devices.

2. Software Requirements

Palm

The palm bluetooth card comes with a driver CD. No additional software is required besides the programs from this CD. You might need a Windows PC to extract the archives from this CD and to install the software on the palm. The software maybe available online from Palm Source. The Software used for this HOWTO is 1.0. The version number can be reached via the Launcher in the Info mene entry when selecting Version or from the "About" menu entry in the Bluetooth application.

Linux

This setup in this HOWTO uses the bluez bluetooth stack for linux. The software used for the presented setup are: Later software versions may work as well, but require a different setup.

3. A Step-by-Step guide for the palm/linux bluetooth networking setup

Step 1: Basic Bluetooth setup on Linux

Bluetooth requires special hardware support on the Linux host. Therefore, you'll need root access to the machine, you are going to install the Bluez bluetooth stack on.

If you are going to use a USB adapter, the Linux machine you are going to use needs a working USB setup. For some USB host controller hardware, Linux offers more than one driver. E.g. the UHCI controller has two different drivers (uhci and usb-uhci). During my experiments, i have noticed, that the reliability of bluetooth connections depends on the choice of this driver and in order to establish fast and reliable bluetooth connections, i have to use the usb-uhci driver. Be prepared to face similar problems ...

All current Linux distros support USB. It is recommanded to boot the box with the bluetooth dongle plugged in, since hotplugging does not reliable work with e.g. the Acer bluetooth dongle.

If the Bluetooth dongle is correctly detected by the kernel, it shows up somewhere in /proc/bus/usb/devices:

T:  Bus=01 Lev=02 Prnt=33 Port=04 Cnt=03 Dev#= 36 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=e0(unk. ) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0a12 ProdID=0001 Rev= 1.84
Watch out for the device with the Class e0, this is your bluetooth dongle. usbview will show your device as well. Depending on the bluetooth device, the dongle may show up under some real name (e.g. "Bluetooth Device") or under the name of some bluetooth driver (e.g. hci_usb, bluetooth) or, if no driver is loaded yet, as "Unknown Device".

Now you have to install the USB drivers for this device. In some distros, there's already some USB bluetooth support present. Since there are several bluetooth implementations for linux available, the existing support may not be the bluez one we want or it might be an outdated version of bluez. lsmod shows you, if a driver has already been loaded.

If you see a module named bluetooth.o, a part of the axis bluetooth stack is present on your system. You don't want this. You can try to remove the module manually using rmmod. In order to be able to do this, you might have to unload the usb drivers before and stop some kind of hotplugging system. You might consider removing bluetooth.o completely by removing it from /lib/modules/your_kernel_version/kernel/drivers/usb/bluetooth.o.

If you see a module named hci_usb.o, you have at least a part of the bluez stack installed. A grep -i bluez /var/log/messages will show you the version of the installed driver:

> grep -i bluez /var/log/messages
Jul 28 20:13:30 romulan kernel: BlueZ Core ver 2.0 Copyright (C) 2000,2001 Qualcomm Inc
Jul 28 20:13:30 romulan kernel: BlueZ HCI USB driver ver 2.0 Copyright (C) 2000,2001 Qualcomm Inc
If the installed version is older than 2.0, you will have to install new kernel drivers. You don't need to remove the old version, it will be overwritten during the installation of the new version.

If you have compiled your own kernel or installed the kernel sources of your distro, you might want to disable the bluetooth USB drivers in the USB section of the kernel configuration and the complete bluetooth section to prevent the old/wrong bluetooth drivers to be reinstalled if you decide to recompile and reinstall your current kernel modules.

To install the new kernel drivers, unpack the Bluez-Kernel-Package and configure and install it as described in the README in that package. Add the following lines to your /etc/modules.conf to make the kernel automatically loads additionally required modules:

   alias net-pf-31    bluez
   alias bt-proto-0   l2cap
   alias bt-proto-2   sco
   alias bt-proto-4   bnep
Now load the driver e.g. with modprobe hci_usb, in /proc/bus/usb/devices you should see lines like this:
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
And grep -i bluez /var/log/messages should tell you something about the 2.0 driver being installed.

Now install the Bluez API library and the Bluez Utilities. This will install a program called hciconfig. Use this program to enable the bluetooth support by typing hciconfig hci0 up. A hciconfig -a should now tell you about the bluetooth interface:

> hciconfig hci0 up
> hciconfig -a
hci0:   Type: USB
        BD Address: 00:60:57:02:28:59 ACL MTU: 192:8  SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN
        RX bytes:69 acl:0 sco:0 events:8 errors:0
        TX bytes:27 acl:0 sco:0 commands:7 errors:0
        Features: 0xff 0xff 0x09 0x00
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy:
        Link mode: SLAVE ACCEPT
        Name: 'PC romulan.tm.uka.de/0'
        Class: 0x000100
        HCI Ver: 1.1 (0x1) HCI Rev: 0xbc LMP Ver: 1.1 (0x1) LMP Subver: 0xbc
        Manufacturer: Cambridge Silicon Radio (10)
You might give your Bluetooth interface a catchy name by changing the name entry in /etc/bluetooth/hcid.conf and starting the hcid daemon. If you only have one bluetooth equipped PC, that's it for now. If you have done this with two PCs, you might use hcitool scan to find the other machine:
> hcitool scan
Scanning ...
        00:60:57:02:28:4B       Tills Notebook

Step 2: Basic Bluetooth setup on PalmOS

It's now time to install the bluetooth card and all the drivers on your palm. Go to the palms preferences, select the Bluetooth panel and enable Bluetooth, allow the device to be discovered and give it a catchy name.

Once you are done with this, the linux PC and the Palm should already be able to see each other. hcitool scan will result in something like:

> hcitool scan
Scanning ...
        00:07:E0:00:55:32       Tills Palm
        00:60:57:02:28:4B       Tills Notebook
As you can see, i called my Palm "Tills Palm". You can now try the reverse direction. Tap "Trusted Devices" and "Add Device" and the palm should show you a list with at least your desktop PC. If you want to, you can select your PC. You'll then be prompted to enter a password. This password is stored in /etc/bluetooth/pin and is "BlueZ" on a fresh Bluez setup. Enter that password in the palm and your PC should be added to the list of trusted devices. If the palm is unable to log into the PC, you perhaps had a typo in the password (it's case sensitive!) or e.g. you forgot to start hcid on the PC during step 1.

Congratulations, the Palm and your Linux desktop can establish basic Bluetooth connections.

Step 3: Make the palm and linux PC establish a network connection

This step will be to make the palm setup a IP network connection to the PC using PPP over bluetooth. Bluetooth includes a protocol for service discovery. This is used to exchange communication specific settings between both partners. If e.g. the palm wants to use a PPP connection to the PC, it uses the SDP protocol via bluetooth to request paramters for this "LAN" connection.

In order to respond to this request, the PC needs to run a sdp server daemon. Please install the Bluez SDP package now. This will install the server daemon sdpd and a service tool sdptool. In order to make the PC announce a network connection, run the sdpd daemon and use sdptool to register the announcement of a LAN service:

> sdpd
> sdptool add LAN
LAN Access service registered
On the Palm enter the Bluetooth application and select PC. Enter a name for the connection to be created and select "next" two times. You should be able to select the desktop PC in the following dialog. If your desktop does not show up in this dialog, but can be discovered from the "Trusted Devices" dialog mentioned in step2, verify that:
  • sdpd is running (see the system log)
  • You have registered LAN Access
  • hcicontrol -a shows "Class: 0x000100" (make sure hcid is running and /etc/bluetooth/hcid.conf is set correctly)
Select the PC and tap ok. A dialog box with a smiley icon should appear on the palm. If you are done, got to the network preferences. You should find a new service with the name you just entered for your new PC connection.

Now you'll need support for a virtual serial connection over bluetooth, since this is what PPP expects to use to establish the connection, this virtual serial connection is called rfcomm. To get support for this protocol install the modified rfcommd package. Installing this package will give you a rfcomm daemon, other devices can connect to and a config file for rfcommd in /usr/local/etc/rfcommd.conf as well as a ppp options file in /etc/ppp/peers/bluetooth.options. These files are configured for the palm bluetooth setup. Now start the rfcomm daemon:

> /usr/local/sbin/rfcommd -s
A this point it might be a clever idea to have a system log window open somewhere (e.g. tail -f /var/log/messages), so you can see, what all your daemons are doing.

Now take you palm and select "Connect" from the network prefs. You should see some communication being reported in the syslog and after a few seconds, your palm should show several progress dialogs and finally close the dialog box without complaining about anything.

Hey, you are online!

Step 4: Enable Forwarding

Just being connected to one other machine is nice, but not the real fun. We want the whole world, so let's make the PC to forward our data into the net. See the Linux 2.4 NAT HOWTO for details on this. If you e.g. have your PC connected to the rest of the world via eth0, then do something like this:
> echo 1 >/proc/sys/net/ipv4/ip_forward
> iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Now enter the networking prefs on the palm, tap "Details...", deselect the DNS query box and enter your favorite DNS server there (perhaps the one from the /etc/resolv.conf on your PC). Reconnect your palm to the PC and in the network prefs on the palm select "Protocol" in the Options menu. You should see some status info there. But did you know, that this log works like a simple console? Try enter e.g. ping sf.net there. Cool, huh?

That's it. Install a ssh client, web browser or whatever you like on your palm and have fun ...

Step 5: Doing it all at once

I dodn't write some clever init scripts to do all this automatically. Instead i am using the following short script to start the whole setup at once, nicer (init) scripts are welcome:
#!/bin/bash
#
# start bluetooth daemons, wait for palm to connect
# and use masquerading and enable forwarding
#
# load usb hci and l2cap kernel modules
modprobe hci_usb
modprobe l2cap
#
# give the USB some time to register the devices
sleep 3
#
# enable hci device
hciconfig hci0 up
#
# start hci daemon
hcid
#
# enable forwarding
echo 1 >/proc/sys/net/ipv4/ip_forward
#
# nat all traffic leaving via eth0
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
#
# start sdp daemon
sdpd
#
# announce LAN service
sdptool add LAN
#
# start rfcomm daemon
/usr/local/sbin/rfcommd -s

4. OBEX

There are other interesting applications for a bluetooth connection between a palm pilot and a linux pc. For the following experiments, no bluetooth network connection must be established between the palm and the pc, since this connection is exclusive and does not allow any other data exchange at the same time.

Having a PC access the palm means, that the PC will have to do a service lookup in the palm. This might be done with the sdptool from the Bluez SDP package. A sdptool browse provides information from the public browse group of all device within range. Unfortunately, the palm does not offer any service via this group.

One of the services, a palm offers is the object exchange push (OBEX push or OPUSH). This is the service palms use between each other when sending programs or other data forth and back. More info in this service can be requested from all device within range with sdptool search --service=OPUSH:

Inquiring ...
Searching for OPUSH on 00:07:E0:00:55:32 ...
Service Name: OBEX Object Push
Service RecHandle: 0x10002
Service Class ID List:
  "Obex Object Push" (0x1105)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel/Port: 2
  "OBEX" (0x0008)
As you can see, the palm offers the OBEX object push service on rfcomm channel 2.

To be continued ...

5. Related FAQs, HOWTOs and References

 Tills Palm Pages Get in touch!