Syncing the Treo 650 with Bluetooth

The new Treo smartphone is GNU/Linux compatible and comes with Bluetooth connectivity--here's how you can set it up for your network.

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.

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!

______________________

-=mUnky=- -Dovid Kopel munky@munkys.com http://munkys.com

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

About Tero650

Mobile broadband's picture

The palm Tero650 is a opearating system based smart phone which was officially introduced during October 24, 2004. The CDMA Versions are seen in the new models like Tero700p & Tero 755p whereas GSM version is seen under Treo 680 and Treo 750v.
best mobile broadband

free megaupload files downloading

terra_09's picture

One of the best Meupload file searchers and download centres is here http://megauploadfiles.com/
Find al the necessary information there!

snowboard

snowboard's picture

in fact, it was interesting. I like it! P.S.: cool

does somebody know how to do

johnjohn's picture

does somebody know how to do it with ubuntu feisty and 700p?

Missing script !!!

Anonymous's picture

where is the /etc/chatscripts/sprintbluetooth ????

You reference it but did not provide it!

[HOWTO] Guru Labs Guide to Linux and Bluetooth Dialup networking

Dax Kelson's picture

Closely related to this article, you may be interested in the Guru Labs Guide to Linux and Bluetooth Dialup Networking.

The Guide covers the steps needed to get your laptop on the internet over a Bluetooth connection to a Treo 650.

You can read the guide here.

Just an update...

Dovid Kopel's picture

I hope that this article has been helpful to those looked through it. I would like to add that there have been some modifications to the Bluetooth syncinh procedure since I have applied the new Sprint patch. I am running a rom from Shadowmite's site that contains the new Sprint update. I have not needed to run my "treoconnect" script as mentioned in the article. All I needed to do was connect through KPilot and have the Bluetooth setting set to on, on my treo. In fact, if I had already connected through the the treoconnect script you will probably get a serial error. I hope that this helps anyone who is running the new update and this article isn't helping them out.

Just a note, I have seen other Bluetooth related problems with this update. My headset no longer auto-links when I make a call...which is fairly annoying. You may want to check your hardware support prior to the update.

-=mUnky=-
-Dovid Kopel
munky@munkys.com
http://munkys.com

-=mUnky=-
-Dovid Kopel
munky@munkys.com
http://munkys.com

Looks really simple, just rec

Anonymous's picture

Looks really simple, just recompile your kernel, execute a few arcane commands, write a few scripts, cross your fingers and pray for connectivity.

Linux Mobile Phone Survey

Werner Heuser's picture

This report is included into the TuxMobil - Linux and Mobile (Cell) Phones Survey.

Why didn't you include this other howto?

Anonymous's picture

Why didn't you link to or include this other howto which has a lot more screenshots and details? According to that page, this guy's howto has been around since late 2003.

Does it use SyncML? If yes, h

Anonymous's picture

Does it use SyncML? If yes, how well does it work with free Linux friendly SyncML services such as ScheduleWorld?

SyncML will NEVER be used in Linux, period!

Anonymous's picture

SyncML is an "open" (as in mostly-documented) technology, riddled with patents and proprietary technology. The licensing specifically forbids it from being used in any Free Software or OSS projects.

Syncronizing over Bluetooth with your Treo650 (or any other Bluetooth-enabled PalmOS device) does not use SyncML.

"Implementation of all or part of any Specification may require licenses under third party intellectual property rights, including without limitation, patent rights (such a third party may or may not be a Supporter). The Sponsors of the Specification are not responsible and shall not be held responsible in any manner for identifying or failing to identify any or all such third party intellectual property rights."

SyncML for GPL SW

Matthew (anon)'s picture

How do you explain the availablility of SyncML for Open-Xchange, the (excellent) GPL groupware server?

What a shame - that with the patents ...

John T.'s picture

I didn't know that this SyncML has so many restrictions. It came to my attention, when I ordered a web-hosting and got this "Sync" for free. If I wanted, I could use it with GPRS and my latest Siemens Phone. Well, well - what a shame ... that with the patents.

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix