Sync Palm via Bluetooth

Palm October 13th, 2006

We have introduced how to synchronize Palm via IrDA, let’s move on to the next level: Synchronize Palm via Bluetooth.

Kernel matters

Linux kernel has built-in support for Bluetooth devices, you could build it into kernel or modules. The following configuration also includes the optional bluetooth headphone support, it does not hurt since everything is built into modules.

<M>   Bluetooth subsystem support  —>
  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
      <M>   HIDP protocol support  
            Bluetooth device drivers  —>
                <M> HCI USB driver                                                
                [*]   SCO (voice) support
                <M> HCI UART driver

In the user land, we need to install BlueZ, the Linux Bluetooth protocol stack, in Gentoo, just

emerge bluez-libs bluez-utils

We need to modify /etc/bluetooth/hcid.conf to make it fit into our needs:

options {
    autoinit yes;
    security user;
    pairing multi;
    pin_helper /usr/bin/bluepin;
}
device {
    name "BlueZ (%d)";
    class 0×100;
    iscan enable; pscan enable;
    lm accept,master;
    lp hold,sniff,park;
    auth enable;
    encrypt enable;
}

bluepin is a PyGTK-based dialog to prompt the password, if you don’t install X or do not change the PIN whenever a new device is connected, you could just feed the pin directly like this [2]:

pin_helper /etc/bluetooth/pin;

in /etc/bluetooth/pin:

MY Personal Pin

OK, plugin the bluetooth adpater. Enable your Palm’s Bluetooth for the first test drive:

$ hcitool scan
Scanning …
        00:07:E0:0E:B6:CC       My Palm

OK, at least the Bluetooth adapter works, kernel modules loaded, and BlueZ take actions for the new device.

NOTE: For the curious users, please check /etc/udev/rules.d/70-bluetooth.rules to demystify the magic.

Tie a knot

In Palm side, create a new connection named “Bluetooth to PC” in Preference | Connection | New … like this, then click Device: Tap to find. If this is the first time to bind the handheld and desktop, bluepin would popup to ask for the authentification token.

Discover and Bind


Then create a new Network in Preference | Network | New , click Details …, then click Script …, and delete all scripts, like this:

Network setting


The light of the tunnel

Bluetooth synchronization is quite different than the previous two local HotSync, it is a Modem HotSync via dial-up network on bluetooth tunnel. We need to build the dail-in server in Linux side:

Build the kernel modules 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)

In the userland, install the ppp package and enable the ip forwarding:

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

Set up the peer-to-peer network, /etc/ppp/peer/dun

noauth
local
noipdefault
proxyarp
nodefaultroute
noipx
idle 0

# Host IP: target IP
192.168.15.100:192.168.15.88

ms-dns 192.168.15.1
netmask 255.255.255.0

Gentoo’s magic bluetooth service would launch the following service for us:

  • hcid: the Host Control Interface daemon to talk with L2CAP kernel module.
  • sdpd: the Service Discovery Profile daemon to discover nearby bluetooth devices.
  • pand: the Personal Arean Network daemon to organize an Ad-Hoc PAN.
  • dund: Dial-up Network daemon to build a virtual serial link for dial-up network.
  • pppd: Point-to-Point Protocol daemon

Edit the /etc/conf.d/bluetooth:

# Bluetooth configuraton file
# Start of hcid (allowed values are "true" and "false")
HCID_ENABLE=true
# Config file for hcid
HCID_CONFIG="/etc/bluetooth/hcid.conf"
# Start sdpd (allowed values are "true" and "false")
SDPD_ENABLE=true
# Start hidd (allowed values are "true" and "false")
HIDD_ENABLE=false
# Arguments to hidd
HIDD_OPTIONS=""
# Run hid2hci (allowed values are "true" and "false")
HID2HCI_ENABLE=false
# Bind rfcomm devices (allowed values are "true" and "false")
RFCOMM_ENABLE=true
# Config file for rfcomm
RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"
# Start dund (allowed values are "true" and "false")
# If you want to use dund, you must install: net-dialup/ppp .
DUND_ENABLE=true
# Arguments to dund
DUND_OPTIONS="–listen –persist –msdun call dun"
# Start pand (allowed values are "true" and "false")
PAND_ENABLE=true
# Arguments to pand
PAND_OPTIONS="–listen –role NAP"

Once the bluetooth adpater is plugged in, the corresponding services are launched, you can test the connection with either Merge Ping, or use the command line: Preference | Network | Option | View Log, then write ping www.foo.com

The last, but not the least

In HotSync | Options | Modem Sync Prefs…, hightlight Network
In HotSync | Options | Primary PC Setup…

Primary PC Name: leave blank
Primary PC Address: IP Address of the computer
Subnet Mask: Netmask of your network

NOTE Primary PC Name is parsed by the DNS, the best practice is to leave it blank.

When HotSync, select, Modem and Unix as the network. In the desktop side, use net:any to replace /dev/pilot in the previous HotSync settings.

Reference
[1] Synchronize your PalmOS� Handheld over Bluetooth in Linux
[2] HOWTO mobile phone, Bluetooth and GNOME
[3] [HOWTO] Bluetooth and Palm (or PocketPC) Network and Sync

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks

One Comment to “Sync Palm via Bluetooth”

  1. Refactor the Life » Blog Archive » HOWTO Gentoo 2007.0 on Dell 700m | July 14th, 2007 at 3:24 pm

    [...] Bluetooth Dongle: check Sync Palm via Bluetooth [...]

Leave a Comment