Syncing using the OpenSync Plugin


From SynCE-Wiki

Windows Mobile 2005 Support: Installing SynCE, Connecting Your Device, Using SynCE, Troubleshooting

The following guide has been tested on Kubuntu 6.06 LTS Dapper Drake (Tested with 6.10 success)

Contents

Prequisities

  • dbus >= 0.60 and its python bindings (e.g. python2.4-dbus, or for Gentoo users: dbus-python)
  • python2.4-gobject (Note, this package could be necessary...)
  • python2.4-pyrex
  • python-pyrex
  • python2.4-xml
  • python2.4-zopeinterface
  • libxml2-dev
  • libexpat1-dev
  • python2.4-dev
  • swig
  • libsqlite3-dev (Note, this package could be necessary...)

Downloading and installing software

In the following instructions, the sudo command is used. If you are unfamiliar with this command, then use su. To follow the instructions, you must replace this command:

sudo make install

with these commands:

su
(enter root password)
make install
exit

sudo executes one command as the super-user. In the second set of commands, the user enters super-user mode by executing su, carries out the command in the instructions, and then leaves super-user mode.

pyrapi2

To install pyrapi2 do the following steps:

svn co https://svn.sourceforge.net/svnroot/synce/trunk/pyrapi2
cd pyrapi2/
./bootstrap
./configure
make
sudo make install

Note: If you see this error: No package 'librapi2' found, you must execute the following:

echo "/usr/local/lib" | sudo tee -a /etc/ld.so.conf
sudo ldconfig

wbxml2

To install wbxml2 do the following steps:

  • Grab the 0.9.2 release: wbxml2-0.9.2.tar.gz
  • Get the patches from SynCE's Subversion repository:
svn co https://svn.sourceforge.net/svnroot/synce/trunk/oleavr-files/patches
  • Extract, patch, compile and install it:
tar zxf wbxml2-0.9.2.tar.gz
cd wbxml2-0.9.2
bzcat ../patches/wbxml2-0.9.2-anonymous-support-and-misc-fixes.patch.bz2 | patch -p1
chmod +x bootstrap
./bootstrap
./configure
make
sudo make install
cd ..

pywbxml

To install pywbxml do the following steps:

svn co https://svn.sourceforge.net/svnroot/synce/trunk/oleavr-files/pywbxml
cd pywbxml/
./bootstrap
./configure
make
sudo make install
cd ..

Note: Ubuntu Edgy

If you get the error below

undefined symbol: wbxml_conv_xml2wbxml_withlen

Check out this bug

I solved by downloading the libwbxml2-0_0.9.2-1_i386.deb package.

In your download directory

dpkg -x libwbxml2-0_0.9.2-1_i386.deb .

This will extract the package and create a usr directory where you extracted the package.

This will give you the following directory structure: your extract directory/usr/lib/libwbxml2.so.0.0.9.

Then override your current libwbxml2.so library link by doing.

sudo rm /usr/lib/libwbxml2.so
sudo rm /usr/lib/libwbxml2.so.0

sudo ln -s ''your extract directory''/usr/lib/libwbxml2.so.0.0.9'' /usr/lib/libwbxml2.so
sudo ln -s ''your extract directory''/usr/lib/libwbxml2.so.0.0.9'' /usr/lib/libwbxml2.so.0

sync-engine-python

To checkout SyncEngine do the following steps:

svn co https://svn.sourceforge.net/svnroot/synce/trunk/oleavr-files/sync-engine-python

Twisted Libraries

cd sync-engine-python
svn co svn://svn.twistedmatrix.com/svn/Twisted/trunk/twisted

SyncEngine

Before starting the SyncEngine you need to adjust the file sync-engine-python/sync-engine. Namely you need to change a hack for now. We hope to get rid of that soon. Open the file in your favourite editor and find the lines

    # hack hack hack
    os.setgid(1000)
    os.setuid(1000)

Adjust the uid and gid accordingly. On most single-user systems the above should be fine.

Note: On Fedora systems the gid and uid for ordinary users start at 500. Check /etc/passwd and /etc/group for your user ID and group, and substitute accordingly.

Now you can start the SyncEngine by entering:

sudo ./sync-engine

Note: It is important that you use sudo here! su simply does not work, because we fall back to the normal user and su changes some environment variables. On Debian systems, sudo seems to do something similar. Just add the following line to /etc/sudoers (using visudo):

Defaults !env_reset

Troubleshooting

sync-engine refuses to start

If sync-engine refuses to start, check whether dbus-daemon is running like a normal user, and that DBUS_SESSION_BUS_ADDRESS exist in the environmet. If this environmental variable doesn't exist, start dbus-daemon like:

dbus-daemon --session --print-address

Copy the output of this command, and paste it in at the end of this command:

export DBUS_SESSION_BUS_ADDRESS=

Make sure this variable exist in the terminal you run the commands below.

HTTP transport not found

This seems to be a bug for Windows SmartPhone devices. There is an easy fix for this for now though: Open the engine/syncengine.py on line 138 and change this:

if entry.type.startswith("-HTTP"):

to this:

if entry.type.startswith("HTTP"):

The difference being the removal of a hyphen before HTTP. Then you must make sure there is a proxy on your device in Start -> Settings -> Connections -> Proxies that has the type HTTP. If there is not one already there, then create one. At the moment it doesn't matter what settings are used as DTPT (DeskTop PassThrough) isn't actually implemented yet.

SyncEngine tools

After starting the SyncEngine you can test it in another terminal window:

cd sync-engine-python/
cd tools/
./list_partnerships

You should be fine if you get a list of all partnerships created on your device, like this:

ID: 0x3bfa63e8
Name: 'Sony'
Host: 'SONY'
Items: [ Calendar Tasks Notes Contacts ]
1 partnership

If you are just starting to use your device with SynCE, you should create a new partnership:

./create_partnership "Linux desktop" Contacts

"Linux desktop" is a string with a maximum of 20 chars describing the partnership. The last parameter is a comma-seperated list (with no whitespaces) of itmes to sync. Right now, you just want Contacts.

Note: At the moment, the sync process does not work very well (you cannot determine which partnership will be used), when you have more than one partnership on the device. So, as of now, you should delete your old windows partnership (after you made a backup, of course!!).

Syncing with OpenSync

You need the opensync (note that libopensync has been renamed), multisync and some plugins from svn:

mkdir opensync-svn
cd opensync-svn/
svn co -r 1115 http://svn.opensync.org/trunk opensync
svn co -r 167 http://svn.opensync.org/multisync/trunk multisync-0.90
svn co -r 858 http://svn.opensync.org/plugins/evolution2
svn co -r 751 http://svn.opensync.org/plugins/python-module

Note: You may notice that older revision numbers are specified in these checkouts- this means you will not be running the most cutting edge OpenSync. This is due to be fixed as soon as possible.

Before compiling the above libs, apps and plugins, you need to patch opensync:

cd opensync/
patch -p0 < ../../patches/opensync-xml-string-plugin-r2.patch
patch -p0 < ../../patches/opensync-trunk-python-wrapper-fix-by-andrew-baumann.patch
patch -p0 < ../../patches/opensync-trunk-evolution-file-as-fix.patch
cd ..

Essentially, you should be able to compile all of them by doing the following steps, replacing PACKAGE_DIRECTORY with the directory that was created by svn (i.e. opensync, multisync-0.90, evolution2, python-module):

cd PACKAGE_DIRECTORY/
./autogen.sh [needed for opensync and multisync-0.90, for evolution2 and python-module use "autoreconf -i"]
./configure [unless it was called by autogen.sh in the previous step]
make
sudo make install

Compiling these packages will install OpenSync on your computer, however we need another OpenSync plugin to start syncing with our Windows Mobile 2005 device.

svn co https://svn.sourceforge.net/svnroot/synce/trunk/oleavr-files/opensync-plugin

Now make a symbolic link to the plugin, first making sure that /usr/local/lib/opensync/python-plugins/ exists:

sudo ln -sf opensync-plugin/synce.py /usr/local/lib/opensync/python-plugins/synce.py

To see if everything went fine, you can list all available plugins by executing msynctool --listplugins:

msynctool --listplugins
Available plugins:
evo2-sync
testmodule
synce-plugin

Do the Sync

With SyncEngine running and working, you should now be able to do:

msynctool --addgroup evo2-sync
msynctool --addmember evo2-sync evo2-sync
msynctool --addmember evo2-sync synce-plugin
msynctool --configure evo2-sync 1

After the last command an editor will show up to edit your sync configuration. Set <adress_path/> to contain just default, and the rest of the elements blank (calendar_path, tasks_path, etc.)

Finally, with fingers crossed:

msynctool --sync evo2-sync

Note: You may have to add a contact to the evolution address book to initialize it, much like a mailbox.
Second note: It would be a good idea to backup your device before syncing and maybe deleting all contacts from evolution to avoid dupes and the likes of.

Possible Problems

I had the problem, that my python-plugins were not found by msynctool (while the evo2-plugin was found). Thanks to the great help in #opensync on freenode, we found out it was due to a wrong $PYTHONPATH. Just setting

PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.4/site-packages

solved the problem here.


(If you have solved problems yourself, please add them here to save time for others!)