mercredi 23 mars 2011

Transferring contacts to an iDevice

Recently, I wanted to transfer my addressbook from my good old but dying Sony Ericsson W910i phone to one of Apple iOS devices (aka iPhone 4).

Reading the contacts out of the old phone was a bit hackish but pretty straightforward using gammu/wammu and a bit of hacking. I didn't manage to import 100% of the data in GMail/evolution-data-server (had to retype a few addresses/phone numbers by hand), but I decided I could live with that.

Then I looked at the computer to iDevice writing, thinking it would be a pretty similar process, ie grab an existing tool, do a bit of fiddling and be done with it. Alas not :) I quickly realized that there was no tool on linux to send contacts to an iDevice. The alternatives involved booting into OS X, or sending a vcf file by mail and opening it on the iDevice. I didn't want to do the former, and the latter didn't work for some reason (and it's cheating anyway ;)

After talking with the nice people on #libimobiledevice, I realized the low-level building blocks were there in libimobiledevice, so I decided to go ahead and write the missing code (which involved parsing and writing XML plists from the device after figuring out their format). After a few days of hacking, eds-to-idevice was born! This C program can read contacts from evolution-data-server and writes them to an iDevice.
Be aware that this does not try to handle contact synchronization: when I use it, I tell it to erase all contacts from the iDevice and to unconditionnally write all contacts from evolution-data-server to the iDevice. If it's called multiple times, it will create duplicate contacts on the device.
However, I tried to make the code as generic and reusable as possible, with the hope that someone would pick up the ball and improve it to write a synchronization plugin for one of the linux synchronization framework. Volunteers :) ?

You can find the code on gitorious and I made a tarball. Enjoy!

3 commentaires:

John a dit…

I've been really looking forward to working with this (it's actually one of the main reasons I upgraded to f15, believe it or not!), but I've run into a hiccup.

I'm sure it's a newbie error, but fails on libebook:
configure: error: Package requirements (libebook-1.2) were not met:

No package 'libebook-1.2' found

Doing a "yum search" for libebook only turned up Contacts, but that doesn't seem to provide the library. Note that I'm running stock f15, otherwise up to date.

Would you be willing to give me some pointers?

John a dit…

OK, now I feel like an idiot. A simple Google search for "fedora 15 ebook" showed me that it's within evolution-data-server, so I knew I needed to install evolution-data-server-devel. Thanks for nothing, "yum search"! :-)

On the other hand, I immediately ran into this error:
configure: creating ./config.status
config.status: error: cannot find input file: `'

A Google search leads me to think that might be a result of my having the wrong version of automake, but I've already proven myself to be less than knowledgeable concerning build tools. ;-)

Any tips for this? Any other gotchas I might run into?

(I *can* program, I just don't understand Lunix build tools very well. But I'm really looking forward to playing around with this tool!)

- John

Christophe a dit…

John, the error message you get is unexpected:) I'd need more details to be able to help though. Basically, a full log showing the command you ran + all its output. Feel free to follow up by email.