Working with Pocket PC's using libsynCE Chris White This guide is meant to show how to work with a Pocket PC (in this case an HP IPAQ 1945) using libsynCE. 1.0 2004-12-25 Setting up your Pocket PC
Kernel Setup

The first thing we need to do is get the kernel to recognize our device. In this case, I have an HP IPAQ 1945. It is usb based and the module is ipaq. In the kernel under Device Drivers->USB support->USB Serial Converter support-> , we see the following (Note this is in kernel 2.6):

<*> USB Serial Converter support
[ ]   USB Serial Console device support (EXPERIMENTAL)
[ ]   USB Generic Serial Driver
< >   USB Belkin and Peracom Single Port Serial Driver
< >   USB ConnectTech WhiteHEAT Serial Driver
< >   USB Digi International AccelePort USB Serial Driver
< >   USB Cypress M8 USB Serial Driver
< >   USB Empeg empeg-car Mark I/II Driver
< >   USB FTDI Single Port Serial Driver (EXPERIMENTAL)
< >   USB Handspring Visor / Palm m50x / Sony Clie Driver
< >   USB PocketPC PDA Driver

So we go ahead and change that, and get something like this:

[ ]   USB Serial Console device support (EXPERIMENTAL)
[ ]   USB Generic Serial Driver
< >   USB Belkin and Peracom Single Port Serial Driver
< >   USB ConnectTech WhiteHEAT Serial Driver
< >   USB Digi International AccelePort USB Serial Driver
< >   USB Cypress M8 USB Serial Driver
< >   USB Empeg empeg-car Mark I/II Driver
< >   USB FTDI Single Port Serial Driver (EXPERIMENTAL)
< >   USB Handspring Visor / Palm m50x / Sony Clie Driver
<M>   USB PocketPC PDA Driver

Now we reboot.

Post-Kernel Setup

Ok, now that we have the kernel module setup, let's go ahead and get some information. Before we begin though, allow me to explain something. While it states USB Serial Converter, it's basically taking your PDA and communicating using serial over USB. That means this device is a USB based IPAQ. In fact, we even use ppp later on to create the connection. First though, let's plugin our device and take a look at our modules list (note this is a udev system):

# lsmod
Module                  Size  Used by
ipaq                   30736  0
nvidia               3914428  12
vmnet                  27428  2
vmmon                 167564  0

# dmesg | grep Pocket
drivers/usb/serial/usb-serial.c: USB Serial support registered for PocketPC PDA
drivers/usb/serial/ipaq.c: USB PocketPC PDA driver v0.5
ipaq 1-1.1:1.0: PocketPC PDA converter detected
usb 1-1.1: PocketPC PDA converter now attached to ttyUSB0

# ls -la /dev/tts/USB0
crw-------  1 root tty 188/ 0  6/  1 10:41 /dev/tts/USB0
secures chris #

In the first code segment, we see that as soon as the ipaq is plugged in, the ipaq module is loaded (this is with coldplug of course). Not only that, but a quick scan of dmesg shows that our setup works, and that the device is now located at /dev/tts/USB0. Remember this, as we'll need it for configuration later on. Now that we have our device setup, let's get ahold of some packages that will help us communicate with it.

Working with SynCE
Getting ahold of the tools

Alright, the first thing we need to do is get ahold of the tools that will allow us to communicate with the PocketPC. So, we'll need to get ahold of the following packages:

  • app-pda/synce - core for synce
  • app-pda/synce-dccm - manages connections for synce devices
  • app-pda/synce-librapi2 - rapi protocol communication
  • app-pda/synce-libsynce - core library
  • app-pda/synce-serial - needed to configure device
  • net-dialup/ppp - needed for point to point connection with the device

Once we these programs, we can begin the setup.

Setting up the IPAQ

Alright, remember that device node I told you we'd need. Here's where it comes into play. Now, as part of the synce-serial package, we have something called synce-serial-config. This is what we'll use to configure the device. To do so, simply give it the device node from earlier:

# synce-serial-config tts/USB0

You can now run synce-serial-start to start a serial connection.

Please note that when you feed synce-serial-config the device node, do it without the /dev. Now that we have it up and running, we can begin to use the device.

Using the IPAQ
Getting the IPAQ ready for connections

In order to use the IPAQ, we need to run a couple of commands. The first is dccm. This is our connection manager for the ipaq, and without it programs won't be able to connect. To use this run it AS THE USER WHO WILL ACCESS SYNCE APPS. So we do as so:

# exit
exit
$ dccm

Now one more quick bit of user switching again, and we will now initiate the connection with the device:

# synce-serial-start

synce-serial-start is now waiting for your device to connect

Your device should now respond to the connection. Mine does by displaying the sync icon and beeping to announce the connection. Now let's start by working with files.

Working with files

In my IPAQ, the following structure exists:

My Device
	- My Documents
	- Program Files
	- Storage Card
	- Temp
	- Windows

Now let's see how we can copy files over. To accomplish this, we use the tools that come with synce:

  • pcp - copy files
  • pls - list directory contents
  • pmkdir - make directory
  • pmv - move (rename) files
  • prm - remove file
  • prmdir - remove an empty directory
  • prun - run a program
  • pstatus - display status about remote device
  • synce-install-cab - install a .cab file

Let's try first by using pstatus to check how our IPAQ is doing:

$ pstatus
Version
=======
Version:    3.0.11171 (Merlin: Pocket PC 2002)
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:          1 (High)
LifePercent:   100%
LifeTime:      Unknown
FullLifeTime:  Unknown

Status for backup battery
=========================
Flag:          1 (High)
LifePercent:   100%
LifeTime:      Unknown
FullLifeTime:  Unknown

Store
=====
Store size: 24461312 bytes (23 megabytes)
Free space: 24105564 bytes (22 megabytes)

Memory for storage: 24530944 bytes (23 megabytes)
Memory for RAM:     24477696 bytes (23 megabytes)

There we go, we have all the information about the IPAQ, which means our connection was successful. Now let's try to copy some files over. We use the pcp program for this. First, we'll copy a file "test.txt" over to the IPAQ:

$ pcp test.txt :test.txt
File copy of 16 bytes took 0 minutes and 1 seconds, that's 16 bytes/s.

A small note, the ':' indicates the IPAQ is the destination. Also, the IPAQ defaults to My Documents when you open File Explorer. However, the file is copied to My Device instead. If you wanted to copy it to My Documents, you would do as such:

$ pcp test.txt :"My Documents/test.txt"
File copy of 16 bytes took 0 minutes and 3 seconds, that's 5 bytes/s.

The file will now showup in your My Documents folder. One interesting thing to note as well is the output of pls:

$ pls
Archive             16  2002/07/01 18:50:57  test.txt
Directory               2002/07/01 09:00:00  Business/
Directory               2002/07/01 09:00:00  Personal/
Directory               2002/07/01 09:00:00  Templates/

In this case, it accesses the My Documents folder, not My Device. Remember that when you copy over! As a final example, the IPAQ has the ability to play MP3's, but only with a storage card. Let's take a small folder full of mp3's and copy them over to the storage card (Remember, the storage card is displayed as Storage Card in the IPAQ):

$ for mp3s in *.mp3
> do
> pcp "${mp3s}" :"Storage Card/${mp3s}"
> done

And there you have it, it will queue and copy over all the mp3's in that directory.

Conclusion

I hope this tutorial works out for you ok. If you have any inquiries about this article, please email me at chriswhite@gentoo.org.