Kasperian Moving Parts

kinda like Batman, but with a wife and 3 kids

KDE 4.2 KPilot coming! (how to both be excited and have realistic expectations)


I just sent this to the KDE PIM mailing lists, but I know not everyone who uses KPilot subscribes, so I’ll re-post it here…

Howdy all,

I just wanted to get a note out to as wide a distribution list as possible to spread some important news about the upcoming KDE 4.2 release and KPilot’s (exciting!!) part in it. If you don’t care about KDE PIM, data syncing, Palm devices, or KPilot, you may stop reading now and I won’t be offended. =;P

For the last 2 years, the talented Bertjan Broeksema and I have spent our Google Summer of Code months doing some major rework and redesign for KPilot. You can see our sync algorithm redesign Use Case here: http://snurl.com/acftl and some UML sequence and class diagrams that we used here: http://snurl.com/acfwd. Previous to our redesign, each conduit in KPilot contained all of the logic necessary for the syncing of record-based data, as well as the transformation, comparison, and resolution of that data. This means that each conduit did things its own way. We didn’t share any code between the conduits for syncing, and we weren’t consistent about how the data was synced. In addition, NONE of our conduits had the ability to synchronize category information from PC to Palm. We had inconsistent smatterings of success going from Palm to PC, but again, we were inconsistent and buggy. And obviously with this duplication of work, whenever a bug popped up in one conduit, it likely existed and had to be fixed (and most probably did not get fixed) in the other conduits. In addition, we did a very poor job of ensuring that we didn’t lose our users’ data, and subsequently, we had a bunch of “KPilot ate my future” e-mails (http://snurl.com/acgf0) that nobody was happy about.

So one of our most important goals in our KPilot redesign was the safety of our users’ data. We now go to great lengths at the beginning and end of the sync process to make sure that our record counts match between Palm and PC, and that we’re able to save all of our data successfully. If anything breaks in the process, we do not commit or save our changes to the Palm and PC sides.

We also didn’t want to keep writing and maintaining “how to sync” logic in our conduits anymore. This was a major design flaw previously and led to a lot of rework and problems. So we designed a record-based (since all of our syncing is from record-based sources) syncing conduit set of base classes that all of our new conduits inherit from. This means that now all of our conduits use the same syncing logic and flow. If we got it wrong, we fix it and now all of our conduits are fixed. If we need to improve the performance and efficiency (which we do, still), we fix it in one place and now it’s fixed and improved in all of our conduits. This is a much cleaner design and it means that our implementing conduit classes are now MUCH simpler, have MUCH less code in them, are MUCH easier to understand, and all follow the same patterns, meaning the learning curve for debugging, writing and contributing conduit code just became darned near close to flat. The job of our conduits is reduced to data transformation, comparison, and record domain knowledge, as it should be. The syncing logic all happens in the base classes.

Another nice feature that we added, although it’s not completely finished, is a final “volatility” check in the base conduit classes. At the end of the sync, we look at how many records we have created/updated/deleted in comparison to starting and ending counts, and if the changes are too volatile, we’ll ask our users whether they want us to save the sync or undo it.

Anyone familiar with programming in professional environments should be familiar with the idea of commit and rollback. Well, previous to KDE 4.2’s KPilot, we had one mode: change live data on the fly and don’t bother with commit/rollback. This made things nice and fast, to be sure, but we also lost a lot of data that we shouldn’t have. In fact, we didn’t even have a way to not lose data, previously. So this was another important design decision we made in the new version of KPilot. We do all of our syncing work in temporary storage and only at the end of a successful sync process do we commit (or rollback) our changes to the real (PC and Handheld) data stores.

We also have a nice new Keyring (http://gnukeyring.sourceforge.net/) conduit for KPilot which uses our new base syncing classes.  Unfortunately, we didn’t get a chance to finish polishing it off, and thus it will most likely be disabled for the final KDE 4.2 release. We’d love your help in getting it finished, though. Bertjan has even written a nice Qt4-based PC Keyring data file viewer/editor that we’d love to get finished, polished, and released. Please help!

So there’s a LOT of coolness in the upcoming KDE 4.2 version of KPilot. Not to mention the fact that it’s the first KDE4 version of KPilot. But I also want to set realistic expectations so that we’re all on the same level.

This will be the first release of a major rewrite of KPilot, and we have had very little user feedback thus far (although there have been a few very helpful folks and I really appreciate them!!!). This means that there are guaranteed to be as-yet-undiscovered bugs. I have been doing a bunch of testing and bug fixing, even since the last RC1 release of KDE 4.2, but there’s just no way I can hit all of the use cases we have. Things are looking extremely smooth and stable and I have not once lost data (yay!), but I’m sure bugs are in there, so make sure you make and keep a good backup of your Palm and PC data before trying new software.

Previous to KDE 4.2, KPilot relied on the external data sources to know about the condition of that data source’s records and PC->Palm  mappings, etc. With KDE 4.2, KPilot now keeps this information itself. This is a good thing! We had a bunch of problems in KDE3 which were caused by the mapping being wrong and/or the state being wrong (X-PILOTID and X-PILOTSTAT).  So we have our own XML-based mapping files now that are kept in $KDEDIR/apps/kpilot/conduits/<

username>/mapping/ and these help us to keep track of the mappings as well as per-conduit last-synced times, etc. We currently rely on this mapping to be valid at the start of a sync (which is also a good thing), but which has one unfortunate side effect that we’ll most probably not be able to get fixed before 4.2 is release: CopyHHtoPC and CopyPCtoHH don’t work as advertised right now. This also means that the first time you sync with the new KDE 4.2 KPilot, we will do a “first sync”, regardless of whether you’ve already synced with KPilot so that we can correctly establish this mapping file, and you’ll end up with a combination of PC and Palm data on both sides at the end.

We’re using Akonadi for syncing your data in KDE 4.2! This is also really good goodness! This will allow us (eventually, once the Akonadi back ends are written) to sync your Palm pilot with an Exchange data source, or a Google calendar, etc., etc. The realistic immediate view, though, is that KPilot is using and relying on a really new Akonadi solution. KDE PIM 4.2 is still not fully ported to using Akonadi purely, although we have bridge resources as an interim solution. This means that before you can sync with KDE’s 4.2 KPilot, you need to add an Akonadi resource for each data type (Calendar, Contacts, etc.), then change your KDE PIM applications to use that (korganizer, kaddressbook, etc.), and then reconfigure KPilot’s conduits to use those new Akonadi data sources. There are glitches to be found in all these layers, to be sure!!  In my testing, it looks like you have to hit reload in korganizer to see kpilot changes to akonadi’s cache after a HotSync, for example. Also, it’s a manual process to convert your PIM data sources to Akonadi resources so KPilot can sync with them. This MUST be done, since KPilot now syncs only with Akonadi data sources. Together, we’ll be finding (hopefully just a few) bugs in KPilot, the new KDE PIM code, and Akonadi. The pay-offs for all of this work are immense, but we need to have realistic expectations about it too.

We have a serious developer shortage in KPilot–both real-person-resource as well as available-time-resource–and as a result, we were only able to bring so much forward from KDE3’s KPilot into KDE 4.2. We tried to focus on the most widely used functionality and, to be honest, that which we the KPilot developers actually use. This means that KDE 4.2’s KPilot will not have: the Knotes conduit (which was badly broken anyway), the DOC conduit (which I’d love to get working again but we’ll need someone to help code it to get it done), the Avantgo/MAL conduit (does _anyone_ actually use Avantgo anymore???), the popmail conduit, or the notepad conduit. So, if you absolutely have to have one of those, please continue to use the KDE3 KPilot, or better yet, help us port your favorite conduit to KDE4!!! What we do support in KDE 4.2’s KPilot is: Calendar conduit (syncs against Akonadi), Contacts conduit (syncs against Akonadi), Memofile conduit (syncs to a directory/files on your hard drive), the Time conduit, the Palm database install conduit, and the ToDo conduit (syncs against Akonadi). These are by far the biggest heavy hitters (the 4 main Palm apps), but again, if you absolutely must have one of the others (or a new conduit altogether), please help us make it a reality by contributing.

Our little First Time Setup Wizard’s device detection functionality is broken.  Actually, it’s been broken for a while. But we didn’t have time to try to get it working, so we disabled that functionality. Really, this is ONLY a one-time setup issue, and there are far better ways to figure out what connection string you should be using, and they’re pretty standard now (“/dev/ttyUSB1” if you’re using the visor kernel module, “usb:” for libusb syncing, /dev/ttyS* for serial devices, etc.).

Previously, KPilot tried to be a “anything that has to do with a Palm device” solution, and we had built-in viewers and editors for Palm databases. These were buggy and error-prone, and confusing, since it looked like KPilot could sync with your Palm, KDE PIM apps, and any changes you made to the databases through the viewers/editors. Well, no more. We’ve removed these viewers and editors to fix a bunch of bugs, to cut down on the porting and maintenance efforts, and to provide a cleaner user interface. KPilot is now focused on being a syncing solution between your Palm and KDE’s PIM back ends. If you need a generic palm database viewer/editor solution, JPilot is much-better suited to that.

Unfortunately, using “usb:” (libusb) to sync your USB palm still has some weirdness to it. I have not had time to dig until I found the solution, but even though we do the exact same thing with “usb:” devices through pilot-link that we do with old-style USB devices (/dev/ttyUSB1, etc.), we periodically hit a crash when closing libusb sockets. Sometimes this shows up as a double-free bug down inside libusb, and sometimes there’s other weirdness. Bottom line is this: “usb:” should be fine for syncing your Palm with KPilot, but you may see crashes after your data has been synced or when KPilot closes the socket handles to libusb (pi_close, in paricular, causes this). This is an area I’d REALLY like some help with, since I don’t see anything that KPilot is doing wrong.

One of the challenges we’ve always had is in getting our users to help us understand what’s going wrong when something goes wrong. In the past, this has meant that we’ve had to tell them to get KPilot’s source code, reconfigure it to make sure debugging is turned on, recompile, re-install, and test again before we could get ANY useful information for as to what might be going wrong. This presented an insurmountable barrier to entry for 99% of our users and has resulted in a lot of bugs never getting fixed and a lot of frustration and wasted time, all around. Well, no more. In KDE 4.2, KPilot now should have debugging (with tunable output levels) turned on by default. The positive to this is that we should be able to ask our users to just run their already-installed version of “kpilotDaemon –debug=9” and send us the output for us to be able to get a much better look at what might be going wrong inside the wee beastie. The down-side is that we will be producing more console spew as a result. I’ve tried to keep this to a minimum, but I’m sure this will upset some people anyway. For those folks: workaround would be to run “kpilotDaemon >/dev/null 2>&1”. We can definitely improve in this area and prune down what gets printed by the default debug level, and I’d greatly appreciate any patches to help do so.

And lastly, as I mentioned previously, we made some intentional design decisions that favored the protection of our users’ data first and foremost. As a result, some things will take longer in KDE 4.2’s KPilot than they used to in KDE3. Most notably in this area is our “first sync”, where we take in both collections of data (Palm and PC) and match them up and result in a combined set. This area has not been performance-tuned (we’re currently at an operational efficiency of O(n^2) in our data matching code, I believe, which is obviously bad), and there are definitely things we need to improve on (and would REALLY appreciate the community’s help on!!!). If you have a database with thousands of records, then “first sync” (which happens obviously the first time, but also if the record mappings are invalid) will take a while and your Palm may time out. Less than optimal? Yes. Slower? Maybe, the first time. You lose data? Definitely not. Can you help make it better? YES! =:)

So, in closing, I hope this helps to get all you Palm users excited about our new version of KPilot. Never before has KPilot looked so good, been as careful with your data, or been easier to help debug, extend, and help out with. There will be some challenges, as there are with any new major version of software (and this is a doozie, all around!!!). But I’m really pleased with what we have and where we can go from here.

Thanks, enjoy, and please give us feedback!! As always, bugs should be reported to bugs.kde.org, e-mails should be sent to kdepim-users@kde.org, and more-or-less real-time help can be found in #kpilot on FreeNode IRC.=:)

Author: Jason 'vanRijn' Kasper

My name is Jason 'vanRijn' Kasper. I am the ring leader of the amazing Kasper family. I am unashamedly a Christian Nerd. These are our stories....


  1. It’s good to hear so much improvement in kpilot, especially concerning the internal design 🙂
    It’s good have good syncing support in KDE. Unfortunately, we still don’t have a generic sync applications for all PDA ( Palm, WinCE, Nokia, … ). That’s unfortunate 🙁

  2. while (1){
    Thank you, thank you, thank you, thank you, thank you,
    thank you, thank you, thank you, thank you, thank you,
    thank you, thank you, …

  3. Heh. Thanks for the encouragement! =:)

  4. Cool, hopefully it will work with my TX! 🙂

  5. Yes! Looking forward to using it!

  6. Thanks a lot for this work! I’ll likely give it a try when KDE4.2 final arrives for Kubuntu.

  7. Like Jason said: do have realistic expectations… I have KDE 4.2 installed on two PC’s and kpilot does not work on
    either although Jason really tried to help. I feel that part of the problem is Akonadi, and the lack of information but YMMV.

    Only this morning I dl’d the last KDE 4.2, and kpilot kept complaining about Akonadi inoperational, no resource agents found… but Akonadi had disappeared without a trace from System Settings, hah!

  8. Just wanted to post a huge thank-you. I’ve played with most of the sync tools available in KDE and Gnome, but none seem even CLOSE to professional-quality. (PIM and PDA sync is one of the biggest gaps in open source.)

    Kpilot is the nicest way to plug that hole for those of us fortunate enough to still follow the Palm. I hope the Palm Pre reverses their fortunes…and isn’t too hard to sync.

    I can’t wait for Kpilot to be included in the Kubuntu repositories for KDE4.2 I’m just compiling and installing the svn for my first-ever KDE4.1. (I’ll let you know how it turns out and what Kubuntu dependencies were required, if you like.)


  9. Is there any documentation for configuring Akonadi to work with Kpilot? I managed to get my Visor talking to Kpilot, but I need to configure resources in Akonadi. Too many choices, not enough info.

    On the plus side, I can FINALLY get my Visor connected. It stopped connecting several months ago while I was using Ubuntu.

  10. Hi Harbard. To be honest, I’m not sure. I went into systemsettings > advanced > akaondi and added to resources–one “local ical file” and one “local ics file” and pointed them to my existing files from KDE3.

  11. Hi,

    Great site and encouraging. Problem: Recent upgrade to Kubuntu 8.10 and now I can’t sync my Palm tungsten E. Worked before. Have config’d Akonadi with my Kontacts and Kalendar but Kpilot hangs at contacts with message in log:

    09:53:51 Doing regular sync…
    09:53:51 [Conduit kpilot-conduit-contacts]
    09:53:52 Invalid record mapping. Doing first sync.
    09:53:52 Doing first sync. This may take a while.

    Then after a couple minutes the palm displays error “…connection lost…” Any ideas? Thx.

  12. Hi Huck,

    Yeah, unfortunately, we have a bug that is keeping this from working well for users with large databases (https://bugs.kde.org/show_bug.cgi?id=182932). If you’d be so kind as to add a comment to that bug saying that you’re hitting it too and maybe you can give us some idea of how many records you have in your calendar and on your desktop, etc., that would be most helpful. Sorry! =:(

  13. Just want to send heaps of gratitude and appreciation for your attention to detail on this project. Also, this post finally clarified for the first time how to get KPilot to actually find my Palm in the device settings; the instructions on the official KPilot website seem outdated and are too confusing. Typing in “usb:” into the Pilot device line was too easy and yet too hard for me to discover.

    Also, your post clarified just exactly the scope of KPilot so that I’m not expecting it to view the database, which I’m okay with.

    The news about Keyring was a pleasant surprise too as I use it all the time. Just can’t wait until Akonadi is up to speed as KDE will seriously rock! Thanks again!

  14. Hey, thanks for the kind words and encouragement Michael! =:)

  15. You’ve made my day (night really), you solved, with one line in this post, my palm problem of maybe 6 months
    “using “usb:” (libusb) to sync your USB palm”

    I’ve just installed the KDE 4.2 update in mandriva (busting kdm in the process and picking the pieces to put back together) ran KPILOT and installed libusb and… TADA! works finally
    Many thanks

    From Chile

  16. Hey Alexander! Yay!! =:) Glad to hear it’s working for you. =:)

  17. Getting
    15:38:02 Daemon status is `Waiting for sync’
    15:38:06 Trying to open device usb:…
    15:38:27 Unable to read system information from Pilot
    15:38:27 Could not open device: usb: (will retry)
    all the time, no success to sync w my Treo 650; Using KDE and KPilot 5.2.2.

    Can anybody help?


  18. 2 add 2 above: jPilot works fine…

  19. Thank you for this great job! KPilot works fine with my old Palm Vx!

  20. Got my issue w kPilot no syncing solved.
    Obviously it was Karmic ‘pae’ kernel. After switching to standard kernel USB sync works fine. Thanx to the guy who tipped me into this while trying to work out why my Gemalto GemPC Twin smart card reader was not working.

    Now I have my Trēo650 syncing fine w akonadi (Kontact)!
    Thanx guys on your product! 😀
    (yet – reponsiveness… is…. well… :-/ )

  21. I like to see the new kpilot using 4.6

Leave a Reply

Required fields are marked *.