Got the bluez
published
One of the neat things about my Treo 650 is that it has Bluetooth. To date, the only thing I ever used bluetooth for was a wireless earpiece, so that I could enjoy hands-free convenience while using my mobile phone. Bluetooth can do a whole lot more than that, but I’ve never had the gadgets or the need to try them.
My PowerBook has built-in Bluetooth, and a nice graphical program to manage Bluetooth devices and services. I can transfer files between the PowerBook and the Treo with point-and-click convenience. I can also use the Treo as a modem, to give the PowerBook internet access in situations where wired and wireless LAN are unavailable. The speed is slow compared to today’s broadband standards, but in many situations slow access is better than no access. I followed this tutorial, and everything worked on the first try.
I have a PowerBook, but I don’t use it nearly as much as I could. Instead, I rely on my Averatec running Ubuntu for the bulk of my day-to-day computing. If I’m going to travel, I’m almost certainly going to take the Linux laptop, so Bluetooth on the PowerBook is nice but not something on which I’ll rely.
I purchased an el cheapo USB Bluetooth adapter, and set to figuring out how to do in Linux everything that I can do with the PowerBook.
The Surf the Web with Bluetooth section of the pilot-link howto never worked for me. I was able to make a TCP connection over Bluetooth from the Treo to the laptop, but I could never get Blazer, the Treo’s browser, to actually deliver any pages to me; even though Mergic Ping (at the bottom of that page) was able to ping internet addresses.
I didn’t need to make any kernel modifications on my Dapper Drake installation, and most of the example commands worked as expected. The big difference on Ubuntu is that the bluez-utils package bundles both the dund and pand services. Use /etc/default/bluez-utils to configure the basics:
This file supersedes /etc/default/bluez-pan. If
that exists on your system, you should use this
file instead and remove the old one. Until you
do so, the contents of this file will be ignored.
############ HIDD
To have Bluetooth mouse and keyboard support, get the
Linux 2.6.6 patch or better from bluez.org, and set
HIDD_ENABLED to 1.
HIDD_ENABLED=0 HIDD_OPTIONS=”–master –server”
to make hidd always use a particular interface, use something
like this, substituting the bdaddr of the interface:
HIDD_OPTIONS=”-i AA:BB:CC:DD:EE:FF –server”
remove ‘–master’ if you’re having trouble working with Ericsson
T630 phones with hidd operational at the same time.
############ COMPATIBILITY WITH OLD BLUEZ-PAN
Compatibility: if old PAN config exists, use it
rather than this file.
if test -f /etc/default/bluez-pan; then . /etc/default/bluez-pan return fi ############
############ DUND
Run dund – this allows ppp logins. 1 for enabled, 0 for disabled.
DUND_ENABLED=1
Arguments to dund: defaults to acting as a server
DUND_OPTIONS=”–listen –persist –msdun call treo”
############ PAND
Run pand – ethernet: creates new network interfaces bnep
that can be configured in /etc/network/interfaces
set to 1 for enabled, 0 for disabled
PAND_ENABLED=0
Arguments to pand
Read the PAN howto for ways to set this up
http://bluez.sourceforge.net/contrib/HOWTO-PAN
PAND_OPTIONS=”–listen –role GN”
The –msdun call treo bit in the DUND_OPTIONS specifies the name of a file in /etc/ppp/peers/ to use to control the PPP connection.
The two IP addresses – 10.10.13.13:10.10.13.14 – define the IP address to assign to each end of the point-to-point link. The first address is used by the laptop, and the second address is used by the Treo. Make sure these are unique and not in use on your network. Ideally they should be addresses in a completely separate subnet.
Configure a modem hotsync connection on your Treo following the example in the pilot-link howto. When you’re done, everything should work:
Listening to port: net:any
Please press the HotSync button now… Connected
Reading list of databases in RAM… lockbox Blazer Bookmarks CarrierProfiles2 DefaultHelperDB ContactsDB-PAdd CalendarDB-PDat MemosDB-PMem … AddressTitlesDB BtDeviceLibraryUserDeviceDB USBClientBulverdeIntel
List complete. 119 files found. Time elapsed: 0:00:20
You may or may not need to twiddle the hcid.conf file. Here’s my /etc/bluetooth/hcid.conf:
HCId options
options { # Automatically initialize new devices autoinit yes;
# Security Manager mode
# none - Security manager disabled
# auto - Use local PIN for incoming connections
# user - Always ask user for a PIN
#
security auto;
# Pairing mode
# none - Pairing disabled
# multi - Allow pairing with already paired devices
# once - Pair once and deny successive attempts
pairing multi;
# PIN helper
pin_helper /usr/bin/pinwrapper;
# D-Bus PIN helper
#dbus_pin_helper;
}
Default settings for HCI devices
device { # Local device name # %d - device id # %h - host name name “%h-%d”;
# Local device class
class 0x3e0100;
# Default packet type
#pkt_type DH1,DM1,HV1;
# Inquiry and Page scan
iscan enable; pscan enable;
# Default link mode
# none - no specific policy
# accept - always accept incoming connections
# master - become master on incoming connections,
# deny role switch on outgoing connections
lm accept;
# Default link policy
# none - no specific policy
# rswitch - allow role switch
# hold - allow hold mode
# sniff - allow sniff mode
# park - allow park mode
lp rswitch,hold,sniff,park;
# Authentication and Encryption (Security Mode 3)
#auth enable;
#encrypt enable;
}
Here’s my /etc/bluetooth/rfcomm.conf:
The next bits were where I went astray initially. Ubuntu doesn’t use the same graphical network configuration system as Fedora, so I mistakenly thought that using a GUI would be complex. Using the Palm Treo 650 with Debian provided console-based configuration advice for a Debian system. Since Ubuntu is derived from Debian, I thought this would be the tutorial to follow. It helped, but my complete lack of experience with modems in Linux introduced a few hurdles. The chatscripts threw me for a loop, too.
Using the previous howtos as basic reference, here’s how I configured Ubuntu to use my Treo for internet access. Click System -> Administration -> Networking. Select the modem connection (assuming you don’t actually use a modem for regular internet access), and click Properties. You can fill any information you want into the name and password field, as clarified in the GuruLabs howto.
I initially had problems connecting, so I used the chatscripts from newt.com and came up with this for /etc/chatscripts/ppp0:
Executing sudo ifup ppp0 produced the following in /var/log/messages:
To my delight, it worked! I confirmed everything was working by turning off the wireless LAN. I executed sudo ifup ppp0 again, pointed Firefox to http://www.whatismyip.org/, and confirmed that the IP address displayed was not the static IP assigned to my DSL provider. Success!
If you have any suggestions for improvement, or other Bluetooth tips or tricks, feel free to share them in the comments.