Syncing your BlackBerry on Linux

2324

By Joe Barr

If all you want to do is share data between your Linux box and the BlackBerry, no sweat. The 2GB Micro SD storage I inserted in my 8800 is available to my Linux system just like any other USB storage device. When I connect the USB cable to the BlackBerry, I simply say yes when Ubuntu asks if I want to enter Mass Storage Mode, and I can copy music and photos to the phone. I have run into a problem getting the audio for videos that were created with Kino to work correctly, but other than that, moving data back and forth between the PDA and the desktop “just works.”

The Barry and OpenSync projects aim to provide a little more functionality than just moving data. According to its home page, the Barry project “is a GPL C++ library for interfacing with the RIM BlackBerry Handheld. It comes with a command-line tool for exploring the device and a GUI for making quick backups. This project’s goal is to create a fully functional syncing mechanism on Linux.” Release 0.11, which I’ve been playing with the past week, goes a long way toward meeting those goals. With it, you can explore, backup and restore, and — with a little help from OpenSync — sync databases. There is, however, some assembly required.

Some assembly required

If you’re not willing to get your hands dirty by downloading and building software executables in their early stages of development, and working from the CLI once you do, then the Barry/OpenSync combo is not ready for you just yet. If you are, heed this advice: back up your BlackBerry before you begin, because it’s possible you could lose some data.

If you’re willing and able to take the risks, you can get in on the fun and functionality ahead of the curve. The buzz on the Barry developers mailing list indicates that work is already underway to provide Barry as an Ubuntu package, as it already is on Mandriva, so it shouldn’t be long before everyone can simply install the executables and leave the building and testing processes to developers.

I won’t walk you through the installation of each of the components, but I will tell you which ones I used and where I found them. Implementation details will vary with your distro, of course. Here’s what you need:

Install the OpenSync packages first, because you’ll need them in order to compile Barry. Make sure that not only OpenSync is release 0.22 — there are earlier and later releases, but you need 0.22 to work with Barry — but that any plugins you install match the 0.22 release number of OpenSync.

Before you compile Barry, be sure to specify –enable-opensync-plug-in when you run the configure script, as per Barry’s detailed installation help.

Exploring the BlackBerry with btool

The first time you connect your BlackBerry and Linux machine with a USB cable, you’ll get a screen on the PDA whining about an insufficient amount of current to charge the device. You can safely ignore that; you won’t be short of power for long. In fact, after entering the btool command, you’ll have all the power you need to charge the phone via USB.

You can enter btool -h for a complete list of options. If you enter btool -t, for example, you’ll get a list of all the databases Barry finds on your BlackBerry. There were about 75 on my 8800. Barry can’t presently parse all of them, but the most important ones are there, as entering btool -S reveals:

Supported Database parsers:
Address Book
Messages
Calendar
Service Book
Memos
Tasks
PIN Messages
Saved Email Messages
Folders
Supported Database builders:
Address Book

You can explore any of the databases on the BlackBerry, not just those with parsers, by dumping their records to the console. To see what’s in Browser Folders, for example, simply enter btool -d ‘Browser Folders’ at the command line. btool will reply with something like this:

Blackberry devices found:
Device ID: 0x8063860.
PIN: 666d6a66,
Description: RIM 8800 Series Colour GPRS Handheld
Using device (PIN): 666d6a66
Raw record dump for record: 805f8a8
00000000: 06 00 26 00 40 02 44 01 01 00 02 e6 17 8a 00 14
..&.@.D.........
00000010: 00 00 81 d6 e2 b7 60 00 0d 57 41 50 20 42 6f 6f
......`..WAP Boo
00000020: 6b 6d 61 72 6b 73
kmarksRaw record dump for record: 805f8a8
00000000: 06 00 2d 00 40 02 44 01 02 00 88 2a 69 2c 00 1b
..-.@.D....*i,..
00000010: 00 00 81 d6 e2 b7 60 00 14 42 6c 61 63 6b 42 65
......`..BlackBe
00000020: 72 72 79 20 42 6f 6f 6b 6d 61 72 6b 73
rry Bookmarks

Of course, raw data like this is more important to developers than to ordinary users, so let’s move on to more user-friendly things, such as the backup and restore utility.

The GUI backup application included with Barry is simple and effective. Note: Barry has a configure option to build the GUI, but it was built by default on my install. If it’s not on yours, rerun the configure script and add the –enable-gui option, then rebuild.

Start by entering barrybackup at the command line, wait a second until it finds your device and displays its PIN number, and when it does, click on Save. You can edit the list of databases that the app will either save or restore by selecting Edit -> Config from the option menu to display the pop-up window in Figure 1, from which you can edit either list.

After selecting Save, I watched the Progress bar slide across the screen and the database names scroll past in the Database text box until the process was complete. I then immediately tested the Restore function.

When you click Restore, you’re presented with a list of all the saved backups Barry finds in the .barry/backup/PINNUMBER directory, where PINNUMBER is the PIN of the device you’re working with. After clicking Restore, I watched as database names appeared, were deleted on the BlackBerry, then restored from my desktop. All went well until I came to the Time Zones table, when I started to see “usb_bulk_restore” errors. The cure was simply to install release 4.4.5 of libusb. Since doing so, I’ve seen no more of these errors.

Barry aims to provide the infrastructure for more advanced, user-friendly applications that can be developed by others. It includes a couple of sample applications to demonstrate. One allows you to enter new contact information, and the other new calendar entries. They work well, but a full-blown app that would allow you to not only add, but edit or delete existing entries, would really be useful.

Synchronicity

Probably the most sought-after feature Barry provides is synchronization. I wasn’t familiar with the synchronization process before I began exploring BlackBerries and Linux, so the concepts of groups, members, and device plugins were new to me in this context.

The synchronization process acts on a group of devices. Before I could actually sync something, I needed to define a group, its members, and the plugin required for each member. When I installed the OpenSync packages, I also installed a tool to do all those things called msynctool, as well as plugins for Evolution and Google Calendar. Both msynctool and the plugins come from the OpenSync project, but are separate downloads. Msynctool runs from the CLI, and it includes a helpful man page; I recommend entering man msynctool if synchronization is new to you.

Create a group and its members is easy:

msynctool --addgroup Blackberry
msynctool --addmember Blackberry barry-sync
msynctool --addmember Blackberry evo2-sync
msynctool --showgroup Blackberry

The last command reported that the Blackberry group contained two members, but that the first one was not yet configured, which I had to do before I could sync. Still using the msynctool tool, I entered msynctool –configure Blackberry 1, where the 1 represented the barry-sync plugin. That opened the default text editor — nano if you’re using Ubuntu 7.10 and haven’t changed the symbolic link at /etc/alternatives/editor to point to another editor — which allowed me to edit the default configuration for the BlackBerry and insert its actual PIN number in place of the default.

If you prefer to use an editor other than the default on your distro, you can accomplish the same thing outside of msynctool simply by editing ~/.opensync/group1/1/barry-sync.conf.

Finally, it was time to sync the BlackBerry and my Evolution contact files. All I had to do was enter the command msynctool –sync Blackberry, then answer a single question about which plugin should rule when duplicate contacts were found. That was it; I was in sync at last.

If all of this sounds too geeky for you, don’t despair. Help is coming for both installation and use. With a working framework in place, thanks to OpenSync and Barry, GUIs are on their way, in the form of the kitchensync project at KDE.org, for example, or, if you’re a GNOME user, the multisync-GUI tool from the OpenSync project.