Syncing the Treo 650 with Bluetooth

by Dovid Kopel

For the geek on the go, connectivity always has been a hassle. In order to be able to connect to the Internet at all times, one would need to use dial-up or broadband Wi-Fi access through a cellular provider. There is, however, another solution. Instead of using a phone line or cellular plan, you instead can use your cell phone. The "smartphone" quickly is growing in popularity for this exact reason.

PalmOne recently released the Treo 650, the newest member of its Treo smartphone family. Many say the 650 is "what the 600 should have been". In other words, the 650 is the 600 Treo without the flaws. Furthermore, one of the major additions to the 650 Treo is Bluetooth connectivity. Bluetooth is a technology that can be used to integrate several devices through wireless means. It is used mostly with cell phones for wireless headsets.

The Treo 650 is capable of accessing all aspects of the Internet, providing one has a data plan, at a reasonable speed and cost. Until the release of the 650 model, you had to connect the Treo to your computer in order to communicate with it. With the addition of Bluetooth, however, the process has become significantly easier. With the touch of a single button, I now can hotsync my Treo or surf the Web without ever touching a wire.

Syncing the Treo 650 with Bluetooth

The Treo 650 runs Palm OS 5, which works rather nicely with GNU/Linux providing you have the proper kernel modules and applications available. A lot of material already exists on how to set up a virtual serial port, so the Bluetooth setup is the main focus of this article.

In order to connect your computer to your Treo, you must use a Bluetooth adapter. I am using a Linksys Bluetooth USB Adapter USBBT100. BlueZ (see Resources) offers a list of supported adapters, with plenty to choose from. I recommend that you have the newest sources available; anything past 2.6.8 should suffice. A few modules must be made available in order for Bluetooth to function. In order to use Bluetooth on GNU/Linux, you need to use BlueZ.

Before you try installing BlueZ, though, you must set some options in your kernel configuration. Begin by compiling the kernel with support for Bluetooth and PPP, found in Device Drivers > Networking Support:


<M>       PPP (point-to-point protocol) support
[ ]       PPP multilink support (EXPERIMENTAL)
[ ]       PPP filtering
<M>       PPP support for async serial ports
<M>       PPP support for sync tty ports
< >       PPP Deflate compression
< >       PPP BSD-Compress compression
< >       PPP over Ethernet (EXPERIMENTAL)

Now, under Device Drivers > Networking Support > Bluetooth Support, set:


<M>  	Bluetooth subsystem support
<M>   	L2CAP protocol support
<M>	SCO links support
<M>   	RFCOMM protocol support
[*]     RFCOMM TTY support
<M>   	BNEP protocol support
[*]     Multicast filter support
[*]     Protocol filter support

Under Device Drivers > Networking Support > Bluetooth Support > Bluetooth Device Drivers, set:


<M>   HCI USB driver
[ ]   SCO over HCI USB support
[ ]   USB zero packet support
<M>   HCI UART driver
[*]   UART (H4) protocol support (NEW)
[*]   BCSP protocol support (NEW)
<M>   HCI BCM203x USB driver

If you chose to compile in anything, you now need to reboot. Some distributions require you to add the modules to a modules autoload, which often is found in /etc/modules.autoload.d/YOUR KERNEL.

Next, obtain and install PPP, bluez-bluefw, bluez-utils, bluez-sdp and bluez-pan. Note: These are the names of the packages required for Gentoo; they may have different names on different distributions.

Once all the software is installed, you should install hotplug and the latest hotplug scripts. For most distributions, these come standard. If you do not have hotplug installed, you can obtain it here.

At this point, you have all the basic software you need. Now you need to configure. You should start by configuring the HCID configuration file.


options {
         autoinit yes;
*        security user;
         pairing multi;
*        pin_helper /etc/bluetooth/pin;
}

device {
         name "%h (%d)";
*        class 0x100;
         iscan enable; pscan enable;
*        lm accept,master;
         lp hold,sniff,park;
*        auth enable;
*        encrypt enable;	
}

On Gentoo, this file is located at /etc/bluetooth/hcid.conf. It should be here for most other distributions, but that is not a guarantee.

Now you need to set up the PIN to be used when pairing the Treo to your computer. Write this file to /etc/bluetooth/pin, replacing 1234 with whatever PIN you desire. Make the file executable by entering chmod +x /etc/bluetooth/pin :


#!/bin/sh
echo "PIN:1234"

You now have Bluetooth set up, but Bluetooth and Bluetooth PAN need to be running in order for you to use Bluetooth. Getting this to happen is a different process for each distribution, but you always can start it manually as root. To do this, you must run dund and pand. You also need to execute the following command at boot or whenever running DUN:


echo 1 > /proc/sys/net/ipv4/ip_forward

Note: The previous command could make your system more vulnerable by allowing anyone to forward.

At this point you should be able to use Bluetooth. Either reboot or manually start hotplug, bluetooth, pand and dund, and make sure to set ip_forward to 1. You can do a lsusb and hope that you see your Bluetooth adapter.

Now it's time to work with the Treo itself. Make sure your Treo's Bluetooth is on and the discoverable is set to yes. Also, make sure the Bluetooth on your computer is seeing your Treo. Run the hcitool scan command, and you should see a number followed by a name--for me it's my name. If you don't see anything when you run hcitool scan, chances are you didn't turn on Treo's discoverable mode.

Now it's time to pair the devices. Pairing is the method of initiating a connection with authorization to make sure that device A is going to work with device B. This is a security feature used to prevent anyone from hooking up to your computer or vice versa. To pair the devices, make sure all the scripts that you should have enabled are running. After that, you must initiate a setup on the Treo. To do this, go to the Bluetooth dialog and select Setup Devices. Go to HotSync Setup and click Next; your device should be listed there. A window should come up asking you to enter your passkey. This is the passkey that you should have set a few steps back. At this point in time, your Treo and computer should be paired. To check, you can go into the Bluetooth dialog on the Treo and see if your computer, usually your hostname, is listed under trusted devices. If it is, then you have successfully paired your Treo!

In order to use DUN, you first must connect to the Treo and set up a virtual serial port. This is done by using a script that I wrote, shown below. First, you must find out your Treo's MAC address. This is accomplished by running hcitool scan. Replace the number 00:00:00:00:00:00 with the number that was just printed on screen. Place this file in /usr/bin/treoconnect and run the chmod command chmod +x /usr/bin/treoconnect.


#!/bin/bash
rfcomm bind all
rfcomm connect 1 00:00:00:00:00:00
pppd connect sprintbluetooth &

The last line of the script actually dials into your Treo. The following scripts are required to run the last line. This script was automatically generated by KPPP.

FILE: /etc/ppp/peers/sprintbluetooth


hide-password
noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/sprintbluetooth"
#:192.200.1.1
debug
/dev/rfcomm1
115200
defaultroute
noipdefault
user "web"
remotename sprintbluetooth
ipparam sprintbluetooth
usepeerdns

FILE: /etc/ppp/bluetooth.modem


TIMEOUT         5
ABORT           '\nBUSY\r'
ABORT           '\nERROR\r'
ABORT           '\nNO ANSWER\r'
ABORT           '\nNO CARRIER\r'
ABORT           '\nNO DIALTONE\r'
ABORT           '\nRINGING\r\n\rRINGING\r'
''              ~\r~AT
TIMEOUT         12
OK              ATD #777
TIMEOUT         22
CONNECT         ""

FILE: /etc/ppp/peers/dun


nodetach
noauth
local
noipdefault
proxyarp
nodefaultroute
noipx
idle 0
192.168.1.101:192.168.1.103
ms-dns 192.168.1.1
netmask 255.255.255.0

The IP addresses must reflect your network settings. The first number, 192.168.1.101, should be set to what your computer is. For me this number changes depending on whether I am plugged in through Ethernet or Wi-Fi, but it continues to work. The second number is the one assigned to the Treo. The ms-dns is your gateway or nameserver IP.

Alternatively, you can use the KDE application KPPP. The settings are fairly simple. The number to dial is #777, and you may or may not be required to use a username. If you are required to use a username, the username/password is web/web and the authentication is PAP/CHAP. Make sure that the modem is pointing to the virtual serial port; for me, this is /dev/rfcomm1. This can be determined by watching logs when you attempt to run treoconnect tail -f /var/log/messages.

At this point in time, you should have established an Internet connection on your computer through the Treo. Now for some notes about using DUN. The patch on the Treo is a hack that isn't entirely stable. I have found what I feel is the most efficient way of using DUN:

  1. Turn off Bluetooth, if off leave it off.

  2. Turn off the radio on the phone; hold down the red button.

  3. Turn on the radio on the phone; hold down the red button.

  4. Turn on Bluetooth.

  5. Turn on DUN.

If you see any translib errors, you probably will experience problems when attempting to connect. If you cannot get rid of the errors, do a soft reset and start with step 3.

In order to hotsync the Treo through Bluetooth, you must be able to connect properly. Also, DUN must not be enabled when attempting a Bluetooth sync. And, make sure to run treoconnect prior to the sync. The hotsync setup happens almost entirely on the Treo side.

Now, go to Prefs > Communications > Connection > New..., and fill in the form as follows:


Name: <Bluesync>
Connect to: PC
Via: Bluetooth
Speed: 115,200 bps
Flow Ctl: Automatic

Go to Prefs > Communications > Network. Press New and fill in the following:


Service: <Whatever you like>
User Name: <Leave Blank>
Password: -Prompt-
Connection: <What you named the connection in step 1>

Now select Details... and set the following:


Idle timeout: 3 minutes
Query DNS: <Checked>
IP Address: <Checked> Automatic

Select Script... and ensure that it merely says "End:". Select OK twice to confirm.

In the HotSync application, go to Options > Modem Sync Prefs... and make sure that Network is highlighted. Then, go to LANSync Prefs... and make sure that LANSync is highlighted.


Primary PC Setup...
Primary PC Name: <Hostname of the computer>
Primary PC Address: <IP Address of the computer>
Subnet Mask: <Netmask of your network>

I had been able to get this to work only by putting in my IP address. This IP address is the same one from the /etc/ppp/peers/dun file created during the DUN setup.

To sync through Bluetooth, you must select Modem and should select Bluesync, or whatever you named your connection. Now use whatever syncing application you chose; I like KPilot. In the settings for device, enter net:any.

When you are ready to sync, you must run KPilot and tell it to do a sync and start a sync network sync. When I run a sync for the first time on a boot, I often connect and instantly disconnect. Though I have yet to find the root of this problem, all you need to do is run the sync again.

This tutorial is fairly simple, and you should have few if any problems. If you do happen to have problems, several resources are available in the Resources section at the end of this article. Several sites were used in conjunction with my own experiences to compile this tutorial.

Once you have hotsyncing working. you should explore the different applications available for syncing. I use KDE, so I stayed away from any GNOME application. I ended up being quite fond of KPilot; I like how KPilot integrates all of your data with KDE's PIM applications. This helps you to keep a current record of your data, and it gives you another way of accessing it. If you don't need all the features of KPilot, JPilot also is a decent application. In the end both KPilot and JPilot accomplish the same task; your personal preferences about the way the applications are designed will inform your choice.

Overall, I would have to say that I am satisfied with my purchase. After some tinkering and reading, I figured out how to get the features that I needed. After that, I haven't had any problems. From the point of view of someone who has used exclusively free software for quite some time, I have found the Palm OS to be a disappointment. Several applications available at no charge, but nearly none are available with source code. Additionally, I found OS 5 to be fairly buggy. There have been several resets and lockups that came completely out of nowhere.

Furthermore, the Treo 650's Bluetooth connectivity is not as glorious as one might have expected. The fact is the 650 is equipped with only Bluetooth 1.1, even though the current standard is 1.2. The 650 also lacks many of the features and qualities available in other Bluetooth-enabled phones. The voice-dialing feature, for example, currently is not available through Bluetooth without additional software. Additionally, the DUN is buggy at times because it was not officially released; there is a patch available at shadowmite.com (see Resources). The final problem I found with the Bluetooth support is the volume issues with Bluetooth-enabled headsets. In fact, volume have been reported as a problem by many members of the Treo community. All in all, the Bluetooth support on the Treo 650 is not terrible but it's nothing too great either.

In conclusion, the Treo 650 is a wonderful smartphone, but it isn't for everyone. As a GNU/Linux user, you should have no problem using every aspect of the 650, given all the information provided here. I consider the 650 to be the best device in its category, and it's GNU/Linux compatible. In other words, go and buy it!

Dovid Kopel is an active GNU/Linux user and supporter of free software. He is the project manager of mUnky. Email him at munky@munkys.com.

Load Disqus comments

Firstwave Cloud