Archive for February 2009

Android Dev Phone, Ubuntu and VMWare Server

Compiling the source code for creating your own Android build is not supported within a Windows operating system (I don’t know if it is possible by the use of Cygwin). Because my notebook is running Windows XP, I use VMWare Server 2.0 which runs a Ubuntu 8.10 (Desktop) as virtual machine.

VMWare makes it possible to connect USB devices inside your virtual machine. Because I want to connect my Android Dev Phone to Ubuntu, I performed the following steps to make that possible.

VMWare hardware configuration

When creating a virtual machine (or before starting the virtual machine) make sure that the USB controller is added to the hardware list.

If this is not the fact. Add the USB Controller by choosing Add hardware and select the USB Controller from the Hardware type list.

Sharing the USB device

Connect your Android Dev Phone to your computer and start the Ubuntu Virtual Machine by pressing the Play button inside the VMWare Server web interface. When booting the Virtual Machine you will notice that a new icon (with an USB sign) is placed on the toolbar inside the VMWare Web Interface next to the Restart button. When you click on this icon a context menu will be shown with a list of devices that are plugged inside the host OS (in my case connected to Windows XP).

Mark the checkbox in front of the High Android Phone to make it available inside Ubuntu.

Udev configuration

You can perform a check, to see that the Android Dev Phone is shared with Ubuntu, by opening a Terminal (inside Ubuntu. Open a VMWare Remote Console to make use of the Ubuntu) and type the following command

lsusb

A list of USB devices will be shown. For example:

Bus 002 Device 001: ID ld6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 0bb4:0c02 High Tech Computer Corp.
Bus 001 Device 001: ID ld6b:0002 Linux Foundation 2.0 root hub

The Android Dev Phone is the device with the name High Tech Computer Corp (HTC). Make a note of the first part of the device ID (in this case 0bb4) because this is needed for the udev rule.

Create a new file (as root)

sudo gedit /etc/udev/rules.d/50-android.rules

with the following content

SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

Make sure that the text after {idVendor} is the same as the device id found when using the lsusb command. Save and exit the editor

To make execution of the rule possible, perform a chmod

sudo chmod a+rx /etc/udev/rules.d/50-android.rules

To make the rule active, restart udev

sudo /etc/init.d/udev restart

Final check

To check if the device is available use the adb tool (which is part of the Android SDK. Download and installation instructions at http://code.google.com/android)

adb devices

This will return a list of attached devices.

List of devices attached
HT845GZ51782 device

You should now be able to use the different tools of the Android SDK (and application deployment with the use of Eclipse) within Ubuntu running inside VMWare Server.

WBXML for .Net

Synchronisation of data between multiple devices is important to have information at every place at every time. For example, I want to have my work agenda items on my mobile phone so that I have a quick overview (and get a notification) when I have a meeting. 

There are different protocols for data synchronization. To synchronize my mobile agenda with work (which makes use of Oracle Collaboration Suite) I have to use SyncML. There are some commercial products available (I used the SyncML client of Synthesis AG on my Windows Mobile Device, which is very good) but I am a developer and I wanted to know how SyncML works. 

When reading the SyncML specification  I tried to initiate a fresh synchronisation (from the server to a mobile which has an empty agenda). Sending message to the Oracle server was working, but the response I got back was not correct (the SyncML messages where accepted but the agenda items where not send back). I wanted to compare those messages to the ones (commercial) SyncML applications where sending… but I found out that these where using WBXML.

What is WBXML?

WBXML stands for WAP Binary XML. It is used to send XML in a compact way to reduce bandwidth (which is limited for a mobile device when using GPRS). For example the content of the following XML (as defined in the WBXML specification as an example)

<br />
<XYZ><CARD><br />
     X &amp; Y<BR /><br />
     X=1<br />
</CARD></XYZ><br />

will be in WBXML (hex notation):

03 01 03 00 47 46 03 0D 0A 20 20 20 20 20 58 20 26 20 59 00 05 03 0D 0A 20 20 20 20 20 58 00 02 81 20 03 3D 00 02 81 20 03 31 20 0D 0A 20 20 00 01 01

Interested by the use of this encryption I started reading the WBXML specification. I searched on the Internet if there where any WBXML libraries for .Net but couldn’t find one. So i decided to write my own.

At CodeProject I found a blog written by Tamir Khason about a WBXML parser for C#. Comparing it to the WBXML specification (and also referencing to his own remarks on the blog) the parser is not following the specification. I liked the idea of extending the XMLDocument of .Net and used that as a base of the WBXMLDocument class.

The code of the WBXML .Net library can be found at http://www.codeplex.com/wbxml. I will finalize this library so that it can be used for WBXML message which are used for SyncML.