While using 3.x on my iPhone free (as in self-hosted and "free as in free speech") syncing was a bit of tinkering here and there but worked. With iOS 4 Apple introduced a new scheme for the Calendar (which used to be a nicely and sanely formatted sqlite file), so all the sync-tools aren't really working anymore. Iphonesync (required J/B Phones and synced to e.g. Funambol) can still read notes(?) and addresses but can't sync the calendar anymore. So i was looking for another option to sync this thingy - and found one (or two) ...
Basically there are two options - one is to use libimobiledevice, a library that achieved protocol-compatability with iPhones native interfaces (the same protocol as used by iTunes) that is just Wowzers. They also implemented a API for syncing calendar, contacts, notes and apps(?). Problem is - the API is there, but no "client" to use it. Conduit seems to have something in the planning or may have even started implementing it... but you'd have to hack or wait here.
The other option you have is checking what option that strange phone has natively, and for iOS 4.x you may discover theres calDAV and cardDAV, which are two nice (almost) standardized protocols for syncinc Calendars and Contacts... So why not just use them?
Turns out it's a bit more complicated than that. Apple has published a card/calDAV sync-server under GPL, but has made it kind of complicated to get this up and running nicely. Thanks to the thrive of the Free Software Scene there are quite some alternatives, to me to most noteworthy one is davical - a nice little service written in php to provide both cardDAV and calDAV as well as a tiny tweeny little web-interface for administration and settings. That and a variety of sync-clients on the Linux side makes just what you need! 🙂 So let's set this up!
For those of you using Debian there's the nice way to use the official davical packages on their repository. I chose another path and installed from git - i simply checked out their git-repos and moved the files in my DocumentRoot, then almost verbatimly followed theiwiki-page for Debian-Installations. One real problem was the .well-known URL scheme for cardDAV (who the f... came up with that f... up scheme for auto-discovery?). Thanks to the nice support in the davical irc channel and some brute-forcing i got it to work quite easily. Luckily i didn't need the SRV-Records proposed here (why ever?!), so all i had to do is forwarding the .well-known urls correctly:
RewriteEngine OnRewriteRule ^/.well-known(.*)$ /caldav.php/.well-known$1 [NC,L]RewriteRule ^/principals/users(.*)$ /caldav.php$1 [NC,L]