Hassle-free mobile phone syncing
In depth: There's a long history of syncing mobile devices with Linux. That long history is mostly filled with one device not synchronising, followed by another device not working, followed by another.
The problem is that the protocols and software used by most devices to talk with one another are closely guarded secrets, and anyone attempting to write an open source client needs to decode those protocols bit by bit, and then stay ahead of any changes. Hopefully, newer and more open platforms like Google Android, the freshly open sourced Symbian or Qt will mean that decent open protocols can be developed to ease the pain for Linux users and device compatibility.
Despite the negativity in our first sentence, things have recently got a lot better. There are several workable solutions you can use today. They might be a little messy, and use a hotchpotch of Gnome and KDE applications, but they can be made to work and we're going to show you how.
The devices we're going to be focusing our efforts on run Windows Mobile versions 5 or 6, and for simple synchronisation, we're going to stick to using a USB connection.
We hope this is going to be the most common configuration used by many people with a smart phone, but both Nokia and Blackberry devices can easily be accommodated by changing the synchronisation back-end. This renaissance in mobile synchronisation is mostly thanks to the last two versions of the Mandriva distribution.
Both 2008 and 2009 releases make the bold claim that they'll synchronise your desktop settings with those on your Windows mobile devices, and Mandriva has expended a lot of effort in trying to make this happen.
The developers have removed the aged odccm daemon that used to keep connection to Windows Mobile devices alive, and replaced it with synce-hal, which handles connections and disconnections automatically.
Mandriva developers also patched Blackberry support into their synchronisation framework, which means you should have little trouble adding a Blackberry device in the same way we're adding a Windows Mobile device. For these reasons, if mobile synchronisation is important to you or your work, we'd recommend using Mandriva Linux One 2009.
Mandriva includes a Control Centre configuration panel that can automatically sync your mobile devices.
Installation and configuration is relatively painless, and you're guaranteed a certain amount of future proofing, as it seems Mandriva has committed itself to synchronisation support.
If you're not willing to switch distros, you can still create a working configuration - it's just going to take a little longer. We'll be using the Mandriva method as the foundation for our instructions, but we'll also cover installation for Ubuntu/Debian users at the same time. We were able to get synchronisation working on both without too much difficulty, and there's very little operational difference between the two when you get everything working.
Step 1: Preparation
There are several pieces of software we're reliant on for the synchronisation to work. The most important, and the part that holds all the other pieces together, is called OpenSync. OpenSync acts as like the railway porter for your synchronised data. It will take the connection from your mobile phone and point it in the direction of your email client, converting the data in the process.
The function of those directions is entirely dependent on plugins. A Windows Mobile device, for example, will need a Windows Mobile plugin, and if you use Evolution for contacts and events, you will need an Evolution plugin to handle the data. This makes OpenSync supremely extendible.
In theory, all you need to add for a new device is a corresponding plugin, and there are plenty of plugins for many mobile devices, including Windows Mobile, Nokia Symbian, Blackberry and Palm. But OpenSync is also flexible: there's no rule to say it must always be used to synchronise a mobile device with a piece of personal information software.
One common use for OpenSync, for instance, is to use a Google Calendar plugin on one side and an Evolution plugin on the other. This ensures that events added to your online Google Calendar are also added to your Evolution calender, and vice-versa.
But before we delve into the installation details, one word of warning. You must back up the data on your mobile device. There's a very high likelihood that something will go wrong at some point, and you don't want to be left with a mobile phone and no friends to call.
During the course of writing, our first synchronisation copied the empty contents from our Evolution calendar and contacts database to our Windows Mobile device, and in the process completely wiped all our personal data. You also need to ensure your Windows Mobile device is set to use RNDIS mode. Our device had this configured by default, but you can check it's turned on by enabling the 'Enhanced Network Functionality' check-box in the Start > Settings > Connections > USB settings page.
Make sure your Windows Mobile 6 device has RNDIS enabled. This is the 'Advanced Network Functionality' referred to in the USB to PC settings page.
Step 2: Package installation
With the backup and mobile configuration out of the way, the next step is software installation. Despite Mandriva being a distinctly KDE-centric distribution, their are solutions for both Gnome and KDE.
There's currently no KDE 4 version of the main synchronisation GUI, and the data synchronisation will only work with KDE 3-era PIM applications. Mandriva even recommends the KDE 3 GUI, called KitchenSync, to both Gnome and KDE users, as it's more functional that its Gnome counterpart (Multisync).
In Mandriva, click on Install & Remove Software in Mandriva's launch menu. When the Software Management window opens, search for the task-wm5sync-gnome package and install it. The 'task' prefixes that Mandriva adds to some packages means that they're really meta packages, and will install a lot of other packages too.
KDE users should install task-wm5sync-kde, and users of both desktops should follow this by installing KitchenSync. This is the application that handles the translation of the data to your device. If you'd rather not install the glut of KDE 3 libraries that accompany KitchenSync, try Multisync instead.
Ubuntu users should open Synaptic and install syncesync-engine, synce-trayicon, synce-hal and either synce-kdm for KDE or synce-gdm and synce-gnomevfs for Gnome. The addition of the vfs package will mean you can browse the contents of your mobile device from the Nautilus file manager. There are no KitchenSync packages for the latest Ubuntu release, so you'll need to install the multisync package instead.
You also need to install each of the OpenSync components you're going to use. As we mentioned earlier, OpenSync is the porter for the synchronisation procedure, and the modules you install depends on which applications and devices you want to install. For example, only install opensync-pluginevolution if you use Evolution as your email client. Mandriva installs a basic selection by default, but we'd recommend the following (Mandriva packages are preceded by lib):
Additionally, you may want to install barry-opensync for Blackberry devices, opensync-plugin-palm for Palm or opensync-plugin-opie for Open Palm-based devices.
Step 3: Making contact
Now that everything is installed, it's just a matter of starting things in the right order. Mandriva users get things a little easier in this step. They just need to launch the toolbar applet for the desktop, and this should be lurking in the tools menu desktop.
Gnome's applet will appear as a small PDE icon in your toolbar, while KDE's looks like the green ActiveSync logo from Windows Mobile devices.
Ubuntu users will need to manually start the synce-sync-engine process before launching the graphical manager of choice - either synce-kdm or synce-gdm. Just type the corresponding command on the CLI. This step is handled automatically by Mandriva, and Ubuntu users should add the synce-sync-engine task to their session properties so that it's started with each boot.
It's now time to connect your device. Once you've done so, both the device and your desktop should recognise the connection automatically. Your graphical manager should update to display the details of your connected device, and a link to your device will also be added to your desktop.
Both the KDE and Gnome applications can display the device status of the connection, using the System Information page in the KDE PDA manager, or the 'View Device Status' window accessible from the Gnome applet's right-click menu. If your device hasn't been detected, make sure the synce-sync-engine is running.
KDE's sync applet displays how much internal and storage memory is left on your device while it's connected.
If SynCE has found your mobile device, its name will appear in the device settings window, and if the SynCE engine is running but the mobile still isn't detected, you should manually restart the ActiveSync application on your mobile device.
If the ActiveSync status is correct but your mobile device still hasn't been detected, the problem may be with your firewall. The firewall may seem like a strange candidate for mobile synchronisation troubleshooting, but the RNDIS mode running on the mobile is turning your phone into a temporary network device, and packets travel to and from your mobile just as they would a computer on your network. It's for this reason that a firewall configuration could be stopping packets getting to or from your mobile.
You can quickly check to see if packets are being blocked by looking at the contents of the messages log file. Type tail /var/log/messages' to see the last few lines of the file. If you see something like [UFW BLOCK INPUT]: IN=eth1 OUT= MAC=80:00:60... PROTO=TCP SPT=1104 DPT=990 in the output, packets aren't getting through. In that particular example, packets headed for port 990 (DPT=990) are being blocked by the UFW firewall.
The easiest solution is to simply turn the firewall off. This is a good idea if you're already behind a firewall tucked away in a router, for example, but not such a good idea if you aren't. Mandriva users can turn off their firewall from the Security page of the Mandriva Linux Control Centre. Click on the 'Set Up Your Personal Firewall' option and enable the 'Everything' checkbox.
Ubuntu users can do the same thing on the command line by typing sudo ufw disable on the commandline. If you'd rather keep your firewall up and functional, you need to enable the following TCP ports for SynCE to be able to contact your Windows Mobile device correctly: 990, 999, 5678, 5721 and 26675.
Step 4: Using the connection
Without any further configuration, Gnome users can now browse the filesystem of their mobile device by selecting 'Explore With Filemanager' from the applet's right-click menu. To do any data synchronisation, we need to create something called a 'partnership'. The KDE app will even ask you to create one before letting you use the rest of the application.
A partnership is used by the mobile device and your desktop to store the current status of any file synchronisation, as well as what data needs to be synchronised. It's a group of settings that define what data is shared between the two sources. You could, for instance, use a partnership to synchronise your address book and calendar. But you could also create one that will only install new applications. This is so you don't have to waste time waiting for certain operations to finish if you only want to install something.
Both the Gnome and KDE GUIs include the ability to create a new partnership, either by clicking on the Add button in the Partnership Manager or the Create button in the Gnome Partners list. You will need to enter a name for the partnership, and select the data you want to be synchronised. But the functionality behind the synchronisation is performed by a different process, and that's where OpenSync comes in. We now need to use OpenSync and the plugins we installed earlier to manage the data transaction between your mobile device and the desktop.
We'll use KitchenSync as the OpenSync front-end, but the process isn't that different if you use Multisync on Gnome. With the toolbar applications running in the background and the mobile device in a connected status, run the KitchenSync application from the Tools menu. We now need to create a group.
A group is just a collection of plugins, and these are called 'members' by both KitchenSync and Multisync. You can use different groups for different tasks. You may want to create a group that doesn't touch your phone, and synchronises your Google Calendar with Evolution, for example. But we'll create a standard mobile syncing group first.
Click on the 'Add Group' button and give your group a name. Now click on the 'Add Members' button, and the 'Evolution 2.x' member followed by the 'Plugin To Synchronize Windows Mobile 5 And Later Devices' member. We also had to click on the Evolution member and use the configuration fields to locate our address book, calendar, and task list locations. Finally, click on 'OK' to save the group.
We're now ready to start the first synchronisation process. From the Group list in KitchenSync, click on the 'Synchronize Now' link. This will initiate the ActiveSync connection between your desktop and mobile device, and you should see activity on both.
Depending on which facilities you enabled; contacts, calendar events and notes are now being copied from your mobile device into your Evolution configuration or KDE 3's PIM suite. If there is any conflict, such as when there are two contacts with the same name but different addresses, you will be presented with the raw contents of the file and asked to choose which takes precedence. It can be a little difficult to read, so you're better off choosing the device you know is more likely to be up to date.
And that's all there is to it. Use the panel applications to install new applications and use Gnome to browse the contents of your mobile device. For everything else, you need to use OpenSync to manage the data conversion between your desktop applications and those used on your mobile.
Everything is a little rough around the edges, and there really shouldn't be any need for detailed instructions for getting your mobile devices to synchronise with your desktop. But the important thing is that it works, and we've got all the contacts back that we lost at the beginning.
First published in Linux Format magazine