Using Linux and Bluetooth DUN with the Treo650

Archived ContentThis page has been archived. The information on this page is no longer maintained by Guru Labs. It is provided purely for its historical value to the curious.

, Treo 650 configuration, Linux configuration


Each successive release of the Treo line of smartphones has increased functionality improved the convergence of PDA and phone features. Being Palm OS based, the Treo line has had good Linux support with the various utilities, application integration and even development environments.

Here at Guru Labs, our instructors travel all around the USA teaching Linux classes. Nearly everyone who works here has a Treo for on the road checking of email, using IRC while the "airplane cabin door is still open", reading WikiPedia and other websites, listening to music (ogg files of course), accessing the company calendar, SSHing into our boxes, looking up addresses and phone numbers, and getting real-time GPS based maps and verbal driving directions.

The Treo 650 was released on October 25th, 2004, and while lacking had the following highly anticipated improvements over the one year old Treo 600:

  • Faster CPU
  • Brighter, increased resolution screen
  • Improved keyboard
  • Greatly improved camera
  • Replaceable battery
  • Non-volatile data storage
  • Upgraded software applications
  • and Bluetooth

The addition of Bluetooth was possibly the most sought after feature. It turns out though that the devil is in the details. Bluetooth is a complicated specification. The full range of functionality that Bluetooth provides is separated into different Bluetooth profiles. What profiles are implemented determines what functionality is provided. Common profiles desired in a cell phone include:

  • Hands Free Profile (HFP) - This allows for integration with car hands free kits that allow you to receive and make phone calls over your car's stereo while you are in your car. The kits are increasingly being offered as a factory option and there are many aftermarket upgrades available as well.
  • Headset Profile (HSP) - This allows for wireless headsets to enable you to receive and make phone calls while your phone remains on your hip or in your pocket.
  • OBEX Object Push (OPP) - Allows the transmission of contact information, pictures, and calendar appointments.
  • Serial Port Profile (SPP) - Implements a wireless version of a serial RS232 connection using the RFCOMM protocol. This is used as the basis for hot syncing as well as connections with Bluetooth GPS receivers.
  • Dial-up Networking Profile (DUN) - Provides Internet access to other Bluetooth devices (such as a laptop). The DUN profile builds on the serial port profile and adds modem emulation with a limited AT command set and a PPP server that runs on the phone.

When the Treo 650 was announced with Bluetooth support, the first three profiles listed here were taken as a given. The support for DUN was not a sure thing as, in the past, cell phone carriers had often purposely omitted DUN support due to network over-utilization and pricing model concerns.

When Treo 650 launched, it seemed that everyone's worst fears were coming true with all the initial reviews stating that the DUN profile was not available with Sprint (the first cell carrier to offer the Treo 600 and 650). Many customers and potential customers were irate.

Two days later Sprint released a statement that DUN was not supported simply because the feature wasn't fully stable yet, and after more development and testing (some undetermined time in the future), they would release an update to enable it.

Not content to wait for the Sprint update, a Treo fan discovered that the DUN profile was actually in the Treo 650, but that the icon to turn it on was disabled. He released a "hack" that turned on the icon. Users that tried the hack reported that while DUN did work , it was unstable. Apparently Sprint was telling the truth. This hack approach is not recommended, and is no longer required.

On June 16th, 2005, nearly 8 months after the launch of the Treo 650, PalmOne and Sprint released new firmware that, among several changes, enabled non-buggy and stable Bluetooth DUN support.

Treo 650 configuration

Note that the following directions assume that the cell phone carrier you are using with your Treo 650 is Sprint.

In order to configure the Treo 650 to use DUN, first verify that you have firmware v1.12 or higher installed. If you purchased your Treo 650 after July 1st, 2005 you probably already have the new firmware. To check the software version, dial the number "##786", one of the many available hash codes.

picture of dialer with ##786 input

This will bring up the following screen. Examine the Software Rev: line and verify you have v1.12 or higher:

software version

Now enter the Bluetooth app.

Initial Bluetooth screen

Turn Bluetooth On.

Bluetooth now turned On

After you toggle it on, leave the Discoverable setting to Yes. After it has been paired with your computer and the Linux Bluetooth configured, a safer, more private setting is to turn off discoverability. In the Device Name box you can set any name you wish. The device name is what will display on other Bluetooth devices when interacting with your Treo.

The Dial-up Networking toggle is a new option here that is enabled by firmware v1.12 or higher. Go ahead and turn it on. After a slight delay the following warning is displayed about not being able to use palm applications that access the Internet while DUN is turned on.:

Bluetooth DUN warning dialog

After you click OK on the warning, your screen should look like the following.

Bluetooth enabled screen

At this point the only Treo configuration that is left to perform is to pair it with your Linux computer, that will be covered in the following section.

Linux Configuration

Note: This Linux configuration section uses the Fedora Core v4 Linux distribution. The first part of this section that covers Bluetooth configuration should be identical or nearly so to other Linux distributions. The second part that covers the PPP dialup account creation steps are specific to Fedora Core and Red Hat Enterprise Linux, however, they should be easily translated to other distributions.

The Linux Bluetooth stack, called BlueZ, was initially available with kernel version 2.4.6 released in July 2001. Since then it has matured and become quite full featured.

Hardware Support

Make sure you have a supported Bluetooth adapter. Many of the Guru Labs instructors have IBM ThinkPad T42s with builtin Bluetooth adapters. A ThinkPad T42p is what was used to write this guide. Check the hardware support list, however, almost all modern Bluetooth adapters are supported.

Installing Software

On Fedora Core run the following command, as root, to make sure you have the proper RPM packages installed:

# yum install bluez-libs bluez-pin bluez-utils bluez-hcidump bluez-utils-cups

Handling the SELinux problem

By default, Fedora Core v4, ships with SELinux in "targeted" policy type. This includes the Bluetooth daemons. Unfortunately, the Bluetooth policy doesn't properly account for the /var/lib/bluetooth/ directory that is dynamically created. The stock policy prevents the directory from being created and prevents Bluetooth pairing from functioning properly. We plan on filing a bug with a patch to fix this SELinux problem, but until then, the Fedora Core v4 SELinux configuration needs to be modified to not apply any restrictions to the Bluetooth daemons.

Run the command system-config-security-level. You need to make sure the GUI version of the application launches, and because of a Fedora Core v4 bug, you may need to launch it as a user other than root, then supply the root password in the pop-up dialog box.:


Change to the SELinux tab, in the main area scroll down to the SELinux Service Protection, expand it and click the Disable SELinux protection for bluetooth daemon box. Then click OK.

Start the Bluetooth Daemons

To use Bluetooth DUN with your computer acting as the client, only two Bluetooth daemons need to be running, namely, hcid and sdpd. Both of these daemons are started by the /etc/init.d/bluetooth SysV init script. Depending on if you had the bluez-utils RPM installed or not, the daemons might already be running. Restart/start them now to have the SELinux changes take effect and check the status to make sure they are indeed running:

# /etc/init.d/bluetooth restart
Stopping Bluetooth services:                              [  OK  ]
Starting Bluetooth services:                              [  OK  ]
# /etc/init.d/bluetooth status
hcid (pid 10036) is running...
sdpd (pid 10038) is running...

Verify Your Bluetooth Adapter is Detected

With your daemons running, check to see if you adapter is detected by running the following command:

# hcitool dev
hci0 00:20:E0:XX:YY:ZZ

If you don't see a hci0 line, then your adapter was not detected. You need to troubleshoot and resolve the problem before continuing.

Modify /etc/bluetooth/hcid.conf

A few edits need to be performed on the /etc/bluetooth/hcid.conf file. If you wish, make a backup copy first.

# cp /etc/bluetooth/hcid.conf /etc/bluetooth/hcid.conf-stock

In the options section, locate the lines:

        # PIN helper
        #pin_helper /usr/bin/bluepin;

        # D-Bus PIN helper

Uncomment and modify the pin_helper line and comment out the dbus_pin_helper line (it is broken and segfaults, a bug will be filed).

        # PIN helper
        pin_helper /etc/bluetooth/

        # D-Bus PIN helper

The last edit needed in the /etc/bluetooth/hcid.conf file is at the bottom  of the device section. Locate the two lines:

        #auth enable;
#encrypt enable;

Remove the two comments so that it reads:

        auth enable;
encrypt enable;

An optional edit you can make in the device section is the name option. If you want you can change the default name of "%h-%d" to something more meaningful. I changed mine to "MENTORNG".

Create the /etc/bluetooth/

Think of a Bluetooth pairing PIN number. For example, if you thought of the number 123456, then you would use that to create the following shell script /etc/bluetooth/

echo "PIN:123456"

Whatever PIN number you choose, you will have to input it into your Treo 650 shortly. Make the shell script executable:

# chmod 700 /etc/bluetooth/

Restart the Bluetooth daemons to make your edits take effect:

# /etc/init.d/bluetooth restart
Stopping Bluetooth services:                              [  OK  ]
Starting Bluetooth services:                              [  OK  ]
# /etc/init.d/bluetooth status
hcid (pid 10136) is running...
sdpd (pid 10138) is running...

Do a Bluetooth Scan for you Treo 650 to obtain the address

Use the hcitool command to scan for you Treo 650 and obtain the Bluetooth address of your Treo 650. You will need the Bluetooth address (it is a 48bit number displayed in the same format as a Ethernet MAC address) to input in to another Bluetooth configuration file.

# hcitool scan
Scanning ...
00:07:E0:XX:YY:ZZ T650dk

Modify /etc/bluetooth/rfcomm.conf

The Bluetooth DUN profile makes use of the Bluetooth Serial Port profile. You need to bind a serial character device, mostly commonly /dev/rfcomm0, to your Treo 650. This is done by editing the file /etc/bluetooth/rfcomm.conf. Open the file and locate the line:

        bind no;

Change it to read:

        bind yes;

Then locate the line:

        device 11:22:33:44:55:66;

And change the Bluetooth address to the one you recorded in the previous step, for example:

        device 00:07:E0:XX:YY:ZZ;

Optionally you can edit the comment option to supply your own description of the connection.

Restart the Bluetooth daemons to make your edits take effect:

# /etc/init.d/bluetooth restart
Stopping Bluetooth services:                              [  OK  ]
Starting Bluetooth services:                              [  OK  ]
# /etc/init.d/bluetooth status
hcid (pid 10236) is running...
sdpd (pid 10238) is running...

Pair your Treo 650 with your computer

Bluetooth has the concept of pairing, so that only devices you intend can communicate with you. This is done via a shared secret, the pin, that you input on both devices.

The Treo 650 calls paired devices, "trusted devices". Remember the PIN number that you input into the shell script /etc/bluetooth/

Now on the Treo 650 open the Bluetooth application.

Bluetooth initial Pairing step

Press the Setup Devices button:

Press Trusted Devices

Next press the Trusted Devices button.

List of paired devices, press Add Device

You will now see a list of devices you have previously paired with. Press the Add Device button to scan for nearby devices.

Nearby devices, Highlight computer and press OK

Highlight your detected computer and press the OK button.

Enter Bluetooth PIN

The Enter passkey dialog pops up, enter the PIN number, press OK.

Laptop now paired

You will now see your computer in the Trusted Devices list. Press Done. You can now exit the Bluetooth application.

Your Treo 650 and your Linux computer are now paired.

Define a PPP connection on your computer

The road to a Bluetooth DUN connection is almost complete. So far the Linux configuration steps have been mostly Linux distribution agnostic. The last remaining configuration task is to define a PPP connection with the following properties:

  • Modem device = /dev/rfcomm0
  • Phone Number = #777
  • Username = anything you want (doesn't matter)
  • Password = anything you want (doesn't matter)

Many other guides out on the Internet INCORRECTLY state that the username and password have to be your SprintPCS username and password. This is not so. Your phone, in this case a Treo 650, is already authenticated to the network. Any PPP username and password you provide are ignored and not used for any sort of authentication.

The creation of the PPP connection can be done by manually editing the wvdial and PPP configuration files, or by using a network setup tool provided by your distribution.

On Fedora Core or Red Hat Enterprise Linux or derivatives, launch the tool system-config-network. You will need to launch it as the root user or supply the root password on launch.

system-config-network opening screen

Click the New toolbar button.

New network connection dialog

Select Modem connection and then click Forward. Your system will automatically be scanned to locate a modem. Assuming you have no modem installed it will fail to find the Bluetooth emulated modem on your Treo 650 because of the non-standard location at /dev/rfcomm0. And the following dialog will be displayed for you to manually define your modem.

If you do have a modem already installed, go back to the initial screen, change to the Hardware tab and Add a new modem defined at /dev/rfcomm0.


Modem definition screen

In the Modem device field, erase the existing contents and enter /dev/rfcomm0. The rest of the fields can be left with the default values. Click Forward.

Connection Properties Dialog

In the dialog, enter #777 as the phone number, set the Provider name to "treo" (although you could use any easy to type name), and enter any arbitrary  information for the Login name and Password. Click Forward.

IP settings

Use the defaults of automatically oobtaining an IP address and DNS information. click Forward.

Connection Summary

Click Apply and then close the system-config-network application.

Test your Connection

You are now ready to connect to the Internet via your Treo 650 and Bluetooth DUN. It is best to open two terminal windows. In one terminal window su to root so that you can monitor the PPP connection progress with the following command (on other distributions it may be a different log file):
[window 1]# tail -f /var/log/messages
In another window, initiate the connection with the ifup command.
[window 2]# ifup treo
You should see some activity on your Treo 650 such as the screen lighting up if it was off, and in [window 1] you should see the following:
Jun 28 15:00:09 mentorng ifup-ppp: pppd started for treo on /dev/rfcomm0 at 115200
Jun 28 15:00:09 mentorng pppd[8869]: pppd 2.4.2 started by root, uid 0
Jun 28 15:00:10 mentorng hcid[2467]: link_key_request (<snipped for privacy>)
Jun 28 15:00:11 mentorng wvdial[8870]: WvDial: Internet dialer version 1.54.0
Jun 28 15:00:11 mentorng wvdial[8870]: Initializing modem.
Jun 28 15:00:11 mentorng wvdial[8870]: Sending: ATZ
Jun 28 15:00:11 mentorng wvdial[8870]: ATZ
Jun 28 15:00:11 mentorng wvdial[8870]: OK
Jun 28 15:00:11 mentorng wvdial[8870]: Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Jun 28 15:00:11 mentorng wvdial[8870]: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Jun 28 15:00:11 mentorng wvdial[8870]: OK
Jun 28 15:00:11 mentorng wvdial[8870]: Sending: ATM0
Jun 28 15:00:11 mentorng wvdial[8870]: ATM0
Jun 28 15:00:11 mentorng wvdial[8870]: OK
Jun 28 15:00:11 mentorng wvdial[8870]: Modem initialized.
Jun 28 15:00:11 mentorng wvdial[8870]: Sending: ATDT#777
Jun 28 15:00:11 mentorng wvdial[8870]: Waiting for carrier.
Jun 28 15:00:11 mentorng wvdial[8870]: ATDT#777
Jun 28 15:00:18 mentorng wvdial[8870]: CONNECT
Jun 28 15:00:18 mentorng wvdial[8870]: ~[7f]}#@!}!}:} }8}!}$}%j}"}&} } } } }%}&WQ)=}'}"}(}"@V~
Jun 28 15:00:18 mentorng wvdial[8870]: Carrier detected. Chatmode finished.
Jun 28 15:00:18 mentorng pppd[8869]: Serial connection established.
Jun 28 15:00:18 mentorng pppd[8869]: Using interface ppp0
Jun 28 15:00:18 mentorng pppd[8869]: Connect: ppp0 <--> /dev/rfcomm0
Jun 28 15:00:20 mentorng pppd[8869]: local IP address 68.X.Y.Z
Jun 28 15:00:20 mentorng pppd[8869]: remote IP address
Jun 28 15:00:20 mentorng pppd[8869]: primary DNS address
Jun 28 15:00:20 mentorng pppd[8869]: secondary DNS address
Jun 28 15:00:20 mentorng NET[8910]: /etc/sysconfig/network-scripts/ifup-post : updated /etc/resolv.conf
The items to look for in this output are the lines that say OK. That means that the emulated modem on the Treo 650 is responding to the modem commands being sent to it. The end lines from the pppd daemon with the local and remote IP address and DNS info indicate that the connection was established.
Use the ifconfig command to see your newly created ppp0 network interface details:
# ifconfig ppp0
ppp0 Link encap:Point-to-Point Protocol
inet addr:68.X.Y.Z P-t-P: Mask:
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:318 (318.0 b) TX bytes:3940 (3.8 KiB)
Now ping the remote side off the PPP connection ten times:
# ping -c 10
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=0 ttl=250 time=528 ms
64 bytes from icmp_seq=1 ttl=250 time=702 ms
64 bytes from icmp_seq=2 ttl=250 time=373 ms
64 bytes from icmp_seq=3 ttl=250 time=593 ms
64 bytes from icmp_seq=4 ttl=250 time=372 ms
64 bytes from icmp_seq=5 ttl=250 time=572 ms
64 bytes from icmp_seq=6 ttl=250 time=618 ms
64 bytes from icmp_seq=7 ttl=250 time=396 ms
64 bytes from icmp_seq=8 ttl=250 time=483 ms
64 bytes from icmp_seq=9 ttl=250 time=412 ms

--- ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9013ms
rtt min/avg/max/mdev = 372.644/505.239/702.109/109.684 ms, pipe 2
Congratulations on your Linux and Treo 650 Bluetooth DUN Internet connection! To shutdown the connection, run the command:
# ifdown treo
Whenever you want to bring up the connection, turn on Bluetooth DUN on your phone type:
# ifup treo
You can also use an applet under the GNOME or KDE desktop to bring up and down the connection in a graphical manner.

The Treo 650 Bluetooth DUN Experience

From the ping above you probably noticed that the latency isn't stellar. Any sort of interactive activity over the connection will be painful yet doable.

While the latency is below average, I have found the throughput to be quite a bit better than a modem and very close to a dual channel ISDN connection. Here is a speed test over the connection.

speed test results

It is almost "bearable" according to this report. Though compared to a modem connection or no access at all it can't be beat.

Browsing the web works pretty well and while there is a small noticeable delay in responses to clicks, once a web page starts to load it completes rather quickly.

One thing that helps browsing is that Sprint transparently proxies HTTP requests and recompresses images to reduce the amount of data that needs to be transmitted. Unless I really look closely, I don't notice any image quality degradation.

One interesting thing about the image recompression implementation is that it seems that the Sprint proxy server injects javascript into all web pages so that if you hover your mouse over a image, you get a mouse tooltip that tells you "Shift+R improves the quality of this image. CTRL+F5 reloads the whole page".

The impact of using Bluetooth DUN on the Treo 650 is the following:
  • Any incoming call is routed directly to voice mail. This is the same as if you were you using Internet applications on the Treo itself.
  • You CAN make outgoing calls. While doing do so, no data can be transmitted after hanging up data connections pick up where they left off. This may be specific to CDMA cell phone networks such as Sprint and a Treo 650 on a GSM based cell phone network may behave differently.
  • You can't using any Internet applications on the Treo while Bluetooth DUN is turned on (even if it actually isn't being used).
  • Battery life on the Treo650 is pretty good even when Bluetooth DUN is being used since it operates just fine with the screen off.
I don't recommend that you download large files or use any sort of peer-to-peer application over this connection. The rumor is that if you become "noticeable" to Sprint that they may try to bill you or kick you off their service.

I hope you enjoyed this Guru Labs Guide. Other guides are available as well. You may want to keep an eye on or subscribe to the Guru Labs blogs (in planet form) as while we write Linux courseware and teach Linux training our instructors discover and post many technical tips there as well.