bluetooth
Connecting a Linux PC and PalmOS PDA via Bluetooth
This document describes how to set up a PPP connection between a Palm PDA and a Linux PC. Once you give your PDA an IP address, you can share your internet connection with it or/and do all sorts of interesting stuff with it. I decided to write this guide down and publish it, as I had been asked a number of times how to do this.
I tested this using a Fedora Core 1 Linux PC, equipped with a generic ("Billionton") Bluetooth USB dongle and a Palm Tungsten T3, running PalmOS 5.2.1, which comes with bluetooth built in. AFAIK, the palm does not support Bluetooth PAN. So this document describes how to connect using RFCOMM and PPP. Your milleage may vary with other versions/hardware.
This document is split into two parts: PC configuration and PDA configuration. I suspect that the PC configuration part can be used to connect any other bluetooth-enabled device.
Setting up your Linux PC.
You need the BlueZ Linux Bluetooth protocol stack. Presumably, another one would do as well. The installation of BlueZ is beyond the scope of this document - most recent distributions (like Fedora) come with it. If that's not the case with yours, refer to the documentation on the BlueZ site. Your bluetooth adaptor should be supported by your kernel for these instructions to work. Mine was supported via hci_usb.o
Configuring BlueZ
- Edit /etc/bluetooth/hcid.conf, set a name for your machine.
- For security, edit /etc/bluetooth/pin and enter a pin number needed for a device to connect to your PC.
- Turn on your palm. Turn on bluetooth and make it discoverable.
- On the PC again, run hcitool scan to discover the palm. Note the device's bluetooth address (something like 00:00:00:00:00:00).
- We need to set up a configuration file for the ppp daemon. Create a new file called /etc/ppp/peers/btpalm and add the following:
noauth #we require no authentication
This will give your linux PC the address 192.168.2.1 (for the ppp interface connecting the pc to the palm) and the PDA 192.168.2.2. Change these values if they're not suitable/are taken etc, but make note of them.
local #local connection
asyncmap 0 #charmap
idle 1000 #disconnection after 1000 idle seconds
noipx #disable novell ipx
passive #the client (palm) initiates the connection
silent #no info needed
192.168.2.1:192.168.2.2 #Server:client ip address - Edit /etc/bluetooth/rfcomm.conf and add the following:
rfcomm0 {
bind no;
device 00:00:00:00:00:00; #that's your palm's bluetooth address (found above)
channel 3; #that't the channel that the T3 seems to be using
comment "t3"; #change that to what you want (no difference)
} - Make sure that you have the rfcomm devices (/dev/rfcomm?. Fedora doesn't. If you don't have them, create them (under /dev, do mknod /dev/rfcomm0 c 216 0, etc).
- Start your bluetooth interface. hciconfig hci0 up should do it, or start your bluetooth service if your distribution provides one.
- Start the service discovery protocol (sdptool add SP) and start the LAP (LAN Access over PPP) daemon. You need to listen for incomming connections, and start the btpalm ppp script that we wrote above. The command is dund -s call btpalm (or whatever you called your ppp script). You may automate this, by putting these commands at a startup script, like /etc/rc.d/rc.local or what your distribution provides.
- Enable IP forwarding (echo 1 > /proc/sys/net/ipv4/ip_forward).
- Enable masquerading/nat. My distribution (most recent ones), use iptables. A simple rule (what I use), would be /sbin/iptables -t nat -A POSTROUTING -s 192.168.2.2/255.255.255.255 -o ppp0 -j MASQUERADE. This assumes that you're sharing the connection at ppp0 (my ADSL modem) to the computer at address 192.168.2.2 (the Palm PDA, according to the pppd configuration above). Change it, if you want to share your primary ethernet connection (eth0), or if you assigned the palm another ip address. You can automate the last two steps, by putting them in a startup script, as described above.
- That's all for the server!
Setting up the Palm
- Turn on bluetooth
- Set up a trust between the PC and the palm. You will need to input the pin you set up before.
- Set up a "connection" (as palm puts it) between your palm and the PC via bluetooth. I presume that this is the ppp interface configuration side on the palm.
- Set up a network connection, using the "connection" set up before. No username or password is needed unless you set one up in the server configuration side. Add a DNS server or two to the connection (the ones you use in your desktop should be ok). If any gateway is required (it shouldn't AFAIK), use the IP address you gave the PC in the pppd configuration above.
- Connect! That's all :-)
Now you can do all kinds of neat stuff on your palm, such as read and write email, browse the web, use vnc, ssh, smb etc :-)
Last modified: Tue Dec 9 10:18:43 GMT 2003



