Diagnosis of KPilot/Palm’s messy text

Desktop, Gentoo November 29th, 2006

It is a pain of ass that Palm does not support Unicode, definitely a big design flaw. It is also a pity that CJKOS would not support the Unicode either, we lost the last chance to patch the system by third party hack. I have to use the GBK encoding in Palm before the legendary PalmOS Garnet or Access Linux Platform available. Unfortunately, the KPilot fails to synchronize the name of the contacts from the KAddressbook, for example, 钟章环 becomes 章&, ^. It is quite curious that part of the string is encoded correctly. Later, I dig into the code, and found this code snippet:

if (!text.isEmpty())
        {
                fAddressInfo.entry[field] = (char *) malloc(text.length() + 1);
                strlcpy(fAddressInfo.entry[field], codec()->fromUnicode(text), text.length() + 1);
        }

The bug results in that the length of the UTF8 encoded string is not the same as the GBK encoded string. A workaround is like this:

if (!text.isEmpty())
        {
                QCString locale = codec()->fromUnicode(text);
                fAddressInfo.entry[field] = (char *) malloc(locale.length() + 1);
                strlcpy(fAddressInfo.entry[field], locale, locale.length() + 1);
        }

It has been submitted to the KDE Bugzilla, Bug 138108.

When Palm meets Linux

Desktop, Gentoo, Palm October 15th, 2006

Palm is an open platform for handheld computing, especailly PIM. However, the Palm Inc. / Access do not provide any official support for Linux. Thanks to the open source community to bridge the gap between Linux desktop and Palm handheld.

When Palm meets Linux
Dell Inspiron 700m, Palm Tungsten T, Syba USB Bluetooth Adapter, and Palm Sync cable(not shown in the picture).


Synchronization

Palm supports various synchronization accesses, serial, USB, IrDA, Bluetooth, Modem, Lan, Wireless. We would address three most commonly used ways.

USB Synchronization
This is the most common and reliable way to synchronize the device with the desktop.
1. Besides the standard USB support, build USB Serial(usbserial) and USB Handspring driver(visor) drivers into modules.

<M> USB Serial Converter support
<M>   USB Handspring Visor / Palm m50x / Sony Clie Driver

2. Update the udev rule in /etc/udev/rules.d/10-palm.rules:

# Palm Tungsten T
BUS=="usb",SYSFS{product}=="Palm Handheld",NAME="pilot"

If you use Sony’s CLIE or Handspring’s Visor, you may take a look at cat /proc/bus/usb/devices to figure out how to identify the device. After you push the button of HotSync cradle, or click the BIG button in HotSync application, the device appears as /dev/pilot in Linux desktop.

IrDA Synchronization
Here is a detailed HOWTO about IrDA Synchronization.

Bluetooth Synchronization
Check this HOWTO.

Integration with KDE

TBD

Developement

TBD

Existed problems

  • KPilot does not convert the string from UTF-8 to zh_CN.gbk back and forth in synchronization (FIXED)
  • Mail plugin works only for legacy Palm mail

RSS feeds on th go

Desktop, Gentoo, Palm August 7th, 2006

I spend 3 – 5 hours for transportation weekly, and spend at least 40 minutes to browse/read the subscripted RSS feeds daily. What if I could utilize the trivial time in the metro to read something I am really interested in?

Here is one “just works” solution. Install Sunrise in the computer, and Plucker in the Palm. Export my favorite feeds from the RSS reader in OPML format, and import it to Sunrise which would synchronize the feeds and convert them to Plucker format later.

Import OPML

Download PDB files via kpilot to my Palm via IrDA. It works, but it involves in TOO MUCH interactivities with the users, you wanna catch the bus or not?

What I need is a cron job running in the background, check, convert and save. Whenever I do a HotSync, the files are updated; or just simply beam them to my Palm. Here is my proposal to work it around:

  • Develop a RSS fetcher/parser using RSS for Python to fetch the contents.
  • Develop a wrapper to invoke official Plucker Desktop to convert them to Plucker PDB
  • Develop a file synchronization plugin for KPilot
  • Customize a script to beam the files
  • Develop a init script to glue them together

Any suggestions?

Sync Palm via IrDA

Desktop, Gentoo, Palm August 3rd, 2006

I have complained the lame Palm Sync socket for quite a long time, eventually, I decide to try HotSync my Palm via IrDA on my Dell Latitude D600, which is equipped with SMSC IrDA Controller.

Prepare Hardware

The very first thing is to enable IrDA in the BIOS setting, since D600 has a COM1 serial port, IrDA is then assigned to COM2, aka /dev/ttyS1 in Linux.

BIOS setting



Boot to the overweighted Windows XP, and check the IRQ/DMA/SIR/FIR in Device Manager.

Device Manager


The findchip in irda-utils package is supposed to probe the system, unfortunately, it does not work in D600.

Build the Kernel

Just follow this HOWTO to build IrDA modules.

IrDA (infrared) subsystem support
  IrDA protocol
<M>  IrLAN protocol
<M>  IrNET protocol
<M>  IrCOMM protocol
[*]   Ultra (connectionless) protocol
  IrDA options
[*]   Cache last LSAP
[*]   Fast RRs (low latency)

SIR device drivers                  
<M> IrTTY (uses Linux serial driver)
<M> IrPORT (IrDA serial driver)      
FIR device drivers                  
<M> SMSC IrCC (EXPERIMENTAL)

SIR stands for Standard IR, which uses generic serial protocol to talk with IrDA; FIR needs specific driver to achieve Fast IR. Although IrLAN and IrNET are rarely used, it does not hurt to build them as modules.

Test drive

Since /dev/ttyS1 is also driven by serial, we need explicitly to tell the kernel this device is controlled by irda:

sudo setserial /dev/ttyS1 uart none

Then configure the module options in a Gentoo way, put the information collected from Windows into /etc/modules.d/irda:

options smsc-ircc2 ircc_irq=3 ircc_dma=3 ircc_sir=0x2f8 ircc_fir=0×280
alias irda0 smsc-ircc2

run modules-update to refresh the environment.

Insert the necessary modules and bind the device and port together:

sudo modprobe smsc-ircc2
sudo modprobe irda
sudo modprobe rcomm
sudo modprobe ircomm_tty
sudo /usr/sbin/irattach irda0 -s

Open another console and run

sudo irdadump

If everything is OK, some packets are dumped when the Palm is close to the laptop’s IR port.

Sync the Palm

I am using korganizer/kontact/kpilot suite. Configure the Pilot device as /dev/ircomm0[1]; Uncheck Do not sync when screensaver is active, this is essential for the lightweight WM(e.g FVWM, Fluxbox) users. Bingo !

Glue the pieces together

Inspired by Gentoo official irda init script and this. I develops the /etc/init.d/irda-fir, and /etc/conf.d/irda-fir. Add irda-fir to default runlevel if Palm is a part of your life.

Further work

[1] Are we still using the high-speed FIR if the kopete is configured to access /dev/ircomm0? Since FIR maps IR port to the network interface, irda0, I have tried to configure the Pilot devcie to net:irda0 or net:any according to this undocumented hack, but it does not work and kpilot hangs sometimes.

I still prefer the USB sync when downloading huge files for the sake of speed. Any idea to make dbus/ivman to link /dev/pilot to /dev/ircomm0 or /dev/ttyUSB0 automatically?

Gelman on Sf.net — Rejected

Desktop, Development, Python April 11th, 2006

Eventually, I could not tolerate myself to postpone the development of gelman, a eBook management system any longer, so I registered a new project in Sf.net: gelman

Gelman is named after the Gelman library in GWU. Both of them are lightweight.

  • All immutable meta data is stored online, aka Amazon Web Service (AWS)
  • User preference is stored in sqlite in-process database
  • Implemented by PyKDE
  • Tag support
  • Script and plug-in support

Here is the proposal to sf.net:

Yet another personal media management system. What makes the gelman distinguishing?

1. plug-in. The user may override the default behavior
2. lightweight.
3. Tag support Organize the media in del.icio.us way
4. scriptable

UPDATE: This project is rejected by sf.net due to the vague description. Since I do not have an developement environment for PyKDE right now, I would revise the proposal and re-submit it later.