Search:  
Gentoo Wiki

HOWTO_Synchronize_PocketPC_and_Evolution


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Contents

Introduction

The aim of this HOWTO is to synchronize the adressbook, todos and calendar between a PocketPC and evolution. The connection to the PocketPC is made by SynCE and multisync. This is work in progress YMMV!

Installation

I assume you are using gnome and have a working evolution... Keep your USE flags in mind, you need 'evo' for evolution2 support in multisync.

SynCE and multisync

Verify the packages to be installed and their dependencies with

emerge --pretend multisync synce-multisync_plugin synce

and add any masked ebuilds with a

echo "<path-to/ebuild> <~arch>" >> /etc/portage/package.keywords

set use flag so that multisync works with evolution:

echo "app-pda/multisync evo" >> /etc/portage/package.use

replacing <path-to/ebuild> with a missing ebuild and <~arch> with your architecture (e.g. ~x86) until no more masked packages are left.

At the 26st of November 2006, with a 2006.0 Gentoo that would be

File: /etc/portage/package.keywords
app-pda/dynamite ~x86
app-pda/orange ~x86
app-pda/multisync ~x86
app-pda/synce ~x86
app-pda/synce-dccm ~x86
app-pda/synce-libsynce ~x86
app-pda/synce-librapi2 ~x86
app-pda/synce-multisync_plugin ~x86
app-pda/synce-rra ~x86
app-pda/synce-serial ~x86
dev-libs/libmimedir ~x86

# plus the following if you use the "gnome" USE flag
app-pda/synce-software-manager ~x86
app-pda/synce-trayicon ~x86
app-pda/synce-gnomevfs ~x86

# or this one for the "kde" USE flag
app-pda/synce-kde ~x86

Or, if you like to unmask exact package versions only, you can use the following entries in your package.keywords file (with gnome USE flag at 19th Jan 2007):

File: /etc/portage/package.keywords
=app-pda/synce-rra-0.8.9 ~x86
=app-pda/synce-multisync_plugin-0.8.9 ~x86
=app-pda/synce-0.9.1 ~x86
=app-pda/synce-software-manager-0.9.0 ~x86
=app-pda/synce-librapi2-0.9.1 ~x86
=app-pda/synce-libsynce-0.9.1 ~x86
=app-pda/synce-multisync_plugin-0.9.0 ~x86
=app-pda/synce-rra-0.9.1 ~x86
=dev-libs/libmimedir-0.4 ~x86
=app-pda/synce-dccm-0.9.1 ~x86
=app-pda/synce-trayicon-0.9.0 ~x86
=app-pda/orange-0.3 ~x86
=app-pda/dynamite-0.1 ~x86
=app-pda/synce-gnomevfs-0.9.0 ~x86
=app-pda/synce-serial-0.9.1 ~x86

Now emerge (install) them:

emerge multisync synce-multisync_plugin synce

Kernel modules

You will need the following kernel modules compiled in or loaded as a module:

Linux Kernel Configuration:
   Device Drivers ->
     Network device support ->
       [*] Network device support
       <*>   PPP (point-to-point protocol) support
       <*>     PPP support for async serial ports
     USB support ->
       <*> Support for Host-side USB
           USB Serial Converter support ->
             <*> USB Serial Converter support
             <*>   USB PocketPC PDA Driver


Connecting the PocketPC via USB should result in a log like

Code: log
Feb  5 18:34:37 [kernel] usb 2-2: new full speed USB device using uhci_hcd and a ddress 4
Feb  5 18:34:37 [kernel] ipaq 2-2:1.0: PocketPC PDA converter detected
Feb 5 18:34:37 [kernel] usb 2-2: PocketPC PDA converter now attached to ttyUSB0

If you don't see the above result, then maybe because your PocketPC is not supported naturally. Try to load the module ipaq like this

modprobe ipaq vendor=0x???? product=0x????

where you have to replace the ? by your vendor and product id. (You can find them out by using usbview.)

Configuring the connection

Configure SynCE with the given tty (ttyUSB0 was mapped to /dev/usb/tts/0 on my system or you may find it in /dev/tts/USB0).

synce-serial-config /dev/usb/tts/0  

NOTE: if you get these messages, even after you have emerged pppd:

Code:
ERROR:

synce-serial-config did not find the directory /etc/ppp/peers.
Have you really installed pppd?

Then just go ahead and mkdir /etc/ppp/peers, and then retry synce-serial-config.

With the mentioned kernel modules and the installed ebuilds no further configuration should be needed. If you have a local firewall take a look at [1] In case of any other problems follow [2]

In my case, since the pocket pc connection is done by interface "ppp0", I added a no-restrictions rule to my firewall for that interface:

iptables -A INPUT -i ppp0 -j ACCEPT

Connecting to the PocketPC

As the normal user

dccm

If you run as root (Allow dccm to run as root - USE AT YOUR OWN RISK!)

dccm -r 

or (in case your device is password-protected)

dccm -p 1234

replacing 1234 with your password.

As the root user (make sure the USB/serial cable is connected)

synce-serial-start

If needed initiate the connection on the PocketPC (normally the device will automatically connect).

Verify the Connection has been established by looking in your logfiles:

File:
Feb  5 18:40:45 [synce-serial-start] Executing '/usr/sbin/pppd call synce-device'
Feb  5 18:40:45 [pppd] pppd 2.4.2 started by root, uid 0
Feb  5 18:40:46 [pppd] Serial connection established.
Feb  5 18:40:46 [pppd] Using interface ppp0
Feb  5 18:40:46 [pppd] Connect: ppp0 <--> /dev/usb/tts/0
Feb  5 18:40:46 [pppd] local  IP address 192.168.131.102
Feb  5 18:40:46 [pppd] remote IP address 192.168.131.201
Feb  5 18:40:48 [dccm] Connection from 192.168.131.201 accepted
Feb  5 18:40:48 [dccm] Talking to 'Pocket_PC_1', a PocketPC device of type PH10A

The last line should tell you the type of your device (PH10A beeing a Himalaya/T-Mobile MDAII/O2 XDA2).

and start a serial connection for use with SynCE

If you want to automate the task of connection with USB "hotplug", see [3].

Note: The hotplug script doesn't work out of the box

Here's the edited script :

File: /etc/hotplug/usb/synce
#!/bin/bash

exec >>/var/log/synce
export time=`date +"%b %d %X"`

export uname=`uname -n`

echo "$time $uname $0 [$$]: iPAQ added"
synce-serial-abort > /dev/null
(
for x in `seq 1 20`; do
[ -c /dev/tts/USB0 ] && break
sleep 1
done
if ! [ -c /dev/tts/USB0 ]; then
echo "$time $uname $0 [$$]: device node
/dev/tts/USB0 not created!"
exit 1
fi
synce-serial-start
) &

cat > $REMOVER <<END
exec >>/var/log/synce
export time=`date +"%b %d %X"`
export uname=`uname -n`
echo "$time $uname $0 [$$]: iPAQ removed"
sleep 15
synce-serial-abort 2>&1
END
chmod +x $REMOVER

Also the the usermap file needs to go at /etc/hotplug/usb/synce.usermap not /etc/hotplug/synce.usermap

Take a look at this [4] site

Testing

pstatus (with the same user that launched dccm) should show something like

user@machine ~ # pstatus
 Version
 =======
 Version:    4.20.0 (Microsoft Windows Mobile 2003 for Pocket PC Phone Edition (?))
 Platform:   3 (Windows CE)
 Details:    ""
 
 System
 ======
 Processor architecture: 5 (ARM)
 Processor type:         2577 (StrongARM)
 Page size:              0x10000
 
 Power
 =====
 ACLineStatus: 01 (Online)
 
 Status for main battery
 =========================
 Flag:          8 (Charging)
 LifePercent:   98%
 LifeTime:      Unknown
 FullLifeTime:  Unknown
 
 Status for backup battery
 =========================
 Flag:          1 (High)
 LifePercent:   100%
 LifeTime:      Unknown
 FullLifeTime:  Unknown
 
 Store
 =====
 Store size: 65880064 bytes (62 megabytes)
 Free space: 52617964 bytes (50 megabytes)
 
 Memory for storage: 65986560 bytes (62 megabytes)
 Memory for RAM:     65990656 bytes (62 megabytes)

Create a partnership

In order for the PocketPC to "know" your Gentoo-box, you need to create a partnership. Issue the following command:

synce-matchmaker status

On the other hand the command to create partnership is

synce-matchmaker create

which gives you an overview of partnerships already known to your PocketPC; if necessary, you need to replace one using

synce-matchmaker replace n

where n is the index of the partnership you want to replace. (Be careful, with this, though - when you delete a partnership with a PC and re-connect your PocketPC to that PC later, you could end up creating another partnership, i. e. a new one, with that PC - resulting in all your data being doubled on both the PC and the PocketPC!)

Synchronization

  1. Add a new synchronization pair in multisync with SynCE on one end end Ximian Evolution 2 on the other.
  2. Press Sync
  3. Done ;-)

Disconnect

look at [5]


Automatic Connection

If everything works, and you're able to connect to your device, let's be lazy and let gentoo handle the connection (and disconnection).

Desktop method

There exists a KDE tool to automatize the dccm part and give you easy access to your PDA. It's called "raki" and you install it like this:

emerge -atv app-pda/synce-kde

afterwards, you have a new item "Raki" in your menu. Simply start it before running synce-serial-start (or leave it running all the time like in ActiveSync under windows), and you're done. Be aware, that the icon has different menus on the right and the left click.

Manual method

According to the post of Meaulnes in the Gentoo Forums, create an init-script an according configuration file for dccm:

File: /etc/conf.d/dccm
# DCCM config file 

# Run the dccm user as: 
DCCMUSER=your_username_here

# Extra options to run dccm with. 
#DCCMOPTS="-p <password>"
File: /etc/init.d/dccm
#!/sbin/runscript 

depend() { 
        need localmount 
} 

checkconfig() { 
        if [ -z "$DCCMUSER" ]; then 
                eerror "DCCMUSER not defined" 
                eerror "You should set DCCMUSER to the user who will be using the PocketPC in /etc/conf.d/dccm" 
                return 1 
        fi 
} 

start() { 
        checkconfig || return 1 

        ebegin "Starting dccm" 
        if [ ! -z $DCCMOPTS ]; then 
                su - $DCCMUSER -c "/usr/bin/dccm $DCCMOPTS" 
        else 
                su - $DCCMUSER -c "/usr/bin/dccm" 
        fi
        eend $? 
} 

stop() { 
        ebegin "Stopping dccm" 
        kill `ps waux | grep dccm | grep -v grep | awk '{ print $2 }'` 
        eend $? 
}


Now you're able to handle dccm with the rc-tools. But somebody has to initiate synce-serial-start. With gentoo as udev enabled System, you could try to do it with udev.

Following Yaron Tauskys post on the mailinglist, you create another two files. The rules for udev, and the script to be executed, when a device, using the ipaq module, is attached; you can name the first file anything you want, just make sure that its name is sorted below "50-udev.rules" - start the name with any number from 00 to 49; in the second case, the directory /etc/dev.d/ipaq needs to be created:

File: /etc/udev/rules.d/01-pda.rules
DRIVER="ipaq", NAME="ipaq", SYMLINK="tts/USB%n", GROUP="tty", MODE="0600"
File: /etc/dev.d/ipaq/synce.dev
#!/bin/sh

LOGFILE=/var/log/synce
export PATH="/sbin:/bin:/usr/bin:/usr/sbin"

if [ "$ACTION" = "add" ] ; then
        echo "`date +"%b %d %X"` `uname -n`: iPAQ plugged, starting connection..." >> $LOGFILE
        synce-serial-start >> $LOGFILE
elif [ "$ACTION" = "remove" ] ; then
        echo "`date +"%b %d %X"` `uname -n`: iPAQ removed" >> $LOGFILE
fi

Don't forget to make ipaq.dev executable (chmod 0755 /etc/dev.d/ipaq/synce.dev).

Timezone Problem

On some pda's/smartphones synce can't find a registry file stating the timezone and thus reverts to the timezone set in timezone.c (synce-rra). In my case this led to a 9 hour difference in appointments made on my phone and synced to evolution.

The program tries to get the time zone by reading a key in the registry of the Smartphone but apparently it can't access this key so it takes a default value of GMT-8.

The solution is to edit the source:

  1. emerge synce-rra
  2. when it says source unpacked press 'control+z'
  3. open (/var/tmp/portage/synce-rra-0.9.1/work/synce-rra-0.9.1/lib/timezone.c) and replace the default value of time zone by your time zone
  4. read on your smartphone the key HKEY_LOCAL_MACHINE\Time\TimeZoneInformation
  5. edit the file lib/timezone.c and replace static const uint8_t default_timezone[172]={...}; by your values (don't forget the 0x before hexadecimal values)
  6. Then enter 'fg' in the same console to continue the emerge. However this is not the gentoo way - you should use an portage overlay.
  7. If you dont already have a registry editor on your pda/phone download one here: http://www.phm.lu/Products/

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemain4/html/_wcepb_time_zone_registry_settings.asp

Thanks goes to Xouillet for the help.

Links


Todo

  • rewrite the disconnect
  • add bluetooth connection

Last modified: Sun, 12 Oct 2008 08:53:00 +0000 Hits: 39,508