Coding Ducks

Wednesday, November 09, 2005

Xanga and RSS Feed w/ google reader.

Xanga is a famous blog (*diary*) community amongs youngster.
Many of you may want to use rss feed reader to keep track your friends' daily life.

Recently, xanga finally tidy up its rss xml and rss feeder will feel happy with it.
The URL of the rss feed is
The rss xml is intended to encode in utf-8, so your feeder may not display the entries other than utf-8. For example, we write chinese entries with big5 encoding in xanga, the google reader can feed the entries but cannot display the chinese correctly.

Thus, we decided to make a wrapper for the google reader to feed the big5 entries.
We choose to use PHP to implement the wrapper. It can simply does a big5-to-utf8 transformation in the xml.

One funny thing is that we discovered that google reader like to recognize the feed url file name. For instance, if you feed a rss1.xml, it is wrong. If you feed it a rss.xml, you can display it! so *rss.* is the keyword for google reader.

The php script work-flow:
1. fetch rss feed from xanga site
2. parse the xml into struct and find out the tag data
3. transform data from big5 to utf8
4. pack the data back to xml and return to browser

The result is cool, the google reader can display the chinese correctly!
The speed of this php script is rather slow because the transformation take
unreasonable long time. If you are using PHP5, use iconv may be a better choice.
Tell us if you tried.

1) Php script :

2) Chinese class:
(this library is downloaded from the internet!)

Useful links:
1) Feed Validator:
2) PHP reference site:
3) Google Reader:

Saturday, October 08, 2005


We can display pictures thru MANGA, but we still want some animations!! So what come to our mind is, let's turn MANGA to a game console, We did a search and finally found a highly portable nintendo emulator open source project : InfoNES, it has been ported to Linux using GTK/QT. We ported InfoNES to use framebuffer device and also our usb2vga raw device. You can also listen the game music and sound effect by inserting the usb2audio to MANGA too. For improvement, we still have no joystick support, we can only play the game in serial console using keyboard now:)

Click on the image below, you can see the MANGA NES in action!

Friday, October 07, 2005

MANGA Picture

After back porting of the usb2vga driver, we only got a simple square drawing demo on screen, it is not eye catching enough :)

So Here we have MANGA Picture, display your favourite photos through MANGA.

MANGA Picture Demo Video (click on the image to play)

In this demo, you can see some details of usb2vga on MANGA, and the function of MANGA Picture:)

Get video out

We hope these photos can explain whats happening on our little MANGA box. At beginning of this year, we found an interesting device on the martket (again, in a computer store next to our office). This device is called "USB 2.0 SVGA adapter" from MCT. The immediate thinking is what can we get if we plug this in our MANGA.

OK, it is a long development story and we want to show some output first. Thanks to the Linux SIS video hacker Dr. Thomas Winischhofer, finally he submitted the Linux driver for this device. This driver should has been committed in the kernel 2.6.13 main tree. It is designed for 2.6 series kernel and therefore we modified it for back porting to our 2.4.24 kernel.

Right now we only support 640x480x16bits display but of course the hardware can support higher quality. It is fun to watch slideshows on our little boy, but what can we do more on this? Anyone see this may give us suggestions. :-)

Sunday, September 18, 2005

MANGA Tunes Demo Video.

(click on the image to play)

In this demo video, you can see our web pages
(mp3 player) on MANGA, and also listen
to the audio quality :)

Friday, September 16, 2005

Enjoy the music with your router

Some months ago we found an USB-audio adaptor in a computer shop. This adaptor is very inexpensive, just costs us about US$10 in Hong Kong. Plug this in our PC (running Fedora core 3), we can see the infomation about this gadget:

T: Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0d8c ProdID=000c Rev= 1.00
S: Product=C-Media USB Headphone Set
C:* #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
I: If#= 1 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
I: If#= 1 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
E: Ad=01(O) Atr=09(Isoc) MxPS= 200 Ivl=1ms
I: If#= 2 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
I: If#= 2 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
E: Ad=82(I) Atr=05(Isoc) MxPS= 100 Ivl=1ms
I: If#= 3 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=hid
E: Ad=83(I) Atr=03(Int.) MxPS= 4 Ivl=32ms
We have USB 2.0 host in some models of the MANGA series, like MANGA Plus. So what we want to do is making a MP3 jukebox, with a MANGA and a USB-audio adaptor. This jukebox will able to play the MP3 music automatically when you plug in a USB storage device (USB key, USB harddisk, or even a ipod shuffle) with MP3 files to it. It will search all the MP3 files in the USB storage and generate a playlist, we also want to have a very simple web UI to access this playlist via the network. Finally we call this little jukebox "MANGA tunes".

Actually we found this is not a pretty hard job to make the router sing! The USB audio adaptor is compatible with the USB audio class, and the kernel 2.4.24 running in the MANGA has USB audio class support. So we go to enable the USB audio class support option, and the related sound options, then recompile the kernel. After loaded the new kernel on the board, the USB audio adaptor can be recognized.

With the help of the Linux hotplug scripts, we can recognize and mount the USB storage as soon as we plug it in. We do some survery for our MP3 player. The Madplay in MAD project is our choice as its small size and pure integer computation. The later one is important since we do not need to use the floating point emulation for our ARM9 CPU.

The web UI is written in a very simple bash script CGI. We can start, stop, or select which song we want to play. The CGI is slow and not very responsive, but I think it is ok for us. :-P

So this takes us about one day to put them all together, and we can have some background music in our working space. It is also fun to get the others' USB keys, plug in the MANGA tunes, to share the music we like. Right now, the Cantonese-pop and J-pop are our engineers' favorites.

Some photosnaps of MANGA tunes are in the last post :

Monday, September 05, 2005


MANGA Tunes - Use MANGA to play MP3 music

1. Get an USB2AUIDO device - Add audio output in MANGA

2. Plug it to the MANGA.

3. Plug your favourite MP3 player to MANGA (using USB Mass storage)

4. Plug a nice speaker to audio out.

Friday, August 26, 2005

Starting with MANGA

MANGA is a series of the network products of PePLink. I am now working as an software engineer in this company.

Someday I realized that I have a lot of spared MANGAs under my table. Some of they are manufacturing phototypes, engineering samples or units with outlook defects. Therefore, I desired to get some (as much as) funs from our MANGAs. MANGA system is originally designed for networking, but we think it can be more. Lets record our ideas of "how to abuse your own products". =)