WDTV Tools

May 30, 2009

First Version of event-osd Released

Filed under: event-osd, osd — Tags: , , , — Elmar Weber @ 23:28

The first public release of event-osd, a notification system for the WDTV’s GUI, is out. It enables third party scripts to modify the GUI on the fly based on the current directory.

This release is designed for the WDTV firmware in the version 1.02.07 it probably only works with this exact version or other firmwares like ext3-boot or WDLXTV that are based on the 1.02.07 too.

You can download it from http://sourceforge.net/project/downloading.php?group_id=261153&filename=event-osd-r100-wdtv.zip.

A, very short, documentation for developers is available at the Wiki at http://sourceforge.net/apps/trac/wdtvtools/wiki/event-osd.

A video showing event-osd in action with appletrailerfs:

And a screenshot:


May 19, 2009

Use More Than 6 Applications

Filed under: applications — Tags: , , — Elmar Weber @ 22:46

The current firmwares only come with a few loop devices, so if you want to use more than 6 applications you need more. disco, author of the webserver app, supplies a how to and fix in his blog at http://discowd.wordpress.com/2009/05/14/extra-loop-devices/trackback/.

The application binary does not work, to use it you must persist the content of the app.bin somewhere in your root filesystem.

May 14, 2009

Preview Release Shoutcast / Internet Radio Application

Filed under: shoutcast — Tags: , , — Elmar Weber @ 21:51

As kind of a byproduct I have been working on while getting the WDTV Tools project started is a proof-of-concept implementation of a Shoutcast / Internet Radio application that delivers you the Shoutcast Radio Stations to the WDTV.

This is a preview release for a shoutcast filesystem for the WDTV. It just contains an unsorted, unchecked, un-everything browse by genre function that for the most part works.

This release is targeted at people who know know their WDTV box and Linux because there is a rather high probability that it will not work directly on your box, so you have to mount it from the command line to find the error.

Tested with ext-boot-0.9.2.

You can get the image at http://sourceforge.net/project/showfiles.php?group_id=261153&package_id=322629&release_id=682670.

Known issues:

  • sometimes the downloaded list of stations / genres has an error (you’ll see an empty folder), in this case just use another genre. If this happens at the “Browse by Genre” directory you have to reboot your device (or remount the application) and try again.
  • if you see everything but no stations plays try installing streamripper in optware, I’m not sure I have included all dependencies
  • there will sometimes be left over stream caches at your boot usb stick
  • will not work if /boot is not your USB stick, this is no problem on ext3-boot, but I don’t know about WDLXTV
  • if you play a low bandwidth stream (e.g. 64k) the first few seconds will have breaks in them because the WDTV can’t handle a half full cache, I did not observe this problem with 128k and larger streams
Screenshot of browsing a genre.

Screenshot of browsing a genre.

May 13, 2009

Finding The Path – Or Finding Out Where The Heck You Are

Filed under: osd — Tags: , , , , — Elmar Weber @ 03:18

One of the most interesting and most discussed features for the WDTV HD are GUI / OSD modifications. There are already a lot of modifications out there, several icon sets (WDTVForum Thread) and some themes (e.g. from reaverxai or here ) which give the WDTV GUI a complete new feeling. But current available mods only focus on static content, e.g. do not display context sensitive information for the current Folder / Movie.

In order to produce great GUI features like the ones from MovieJukebox we need an event mechanism that allows you to generate the GUI description (XML + images) on the fly for the current directory.

As it turns out its not that easy. Our first idea was to modify the OSD XML files the moment the dmaosd process (GUI program for the WDTV) access the directory. With a custom filesystem where you control everything this is no problem as you get notified when someone accesses your directory. Unluckily the dmaosd process first reads the OSD XML files and after that access the directory. So you always end up one directory short when you want to modify the files on the fly.

The next tries were all going in the direction to monitor what the dmaosd process does. There are several access points for this: The dmaosd process outputs lots of information to the console, including sometimes the access directory. But this output comes too late, i.e. also after the XML files are loaded. So no luck there.

AirSeb over at the WDTV Forum tried the same things and also hacked a clever solution that works and uses several elements. He monitors the dmaosd output to get the current directory, then, to get the selected directory, he monitors the infrared commands. So basically he counts the ups and downs and page up / downs and then calculates the next directory when the user hits “Enter” on the remote. He also has this working to create a cool GUI, see the first post in the thread.

However, the IR hack IMHO poses some problems when deployed to a wider user base:

  • when the theme changes the number of displayed items may change, so page up/down can be interpreted wrongly
  • the OSD skips when you hold the up/down key pressed some pages, i.e. scrolls faster, maybe hard to track this
  • when the directory content changes during the navigations, the results may be inaccurate (e.g. in a torrent incoming folder)

So, I got hacking on a solution and what follows are the adventures through the depths of the dmaosd process’ memory. The first part was to access the memory at the correct point in time, so just before the dmaosd process loads the XML files. To get this information I wrote a simple FUSE overlay based on fusexmp that intercepts all file system level calls to the /osd directory. So on the file open call for the basic_browse.xml I performend an analysis on the dmaosd process’ heap and stack memory. There were several occurrences of the current directory in the heap without any pattern or information if they were still used or just freed memory. So, I added the stack memory to the analysis and did a reverse lookup for all addresses of all strings I found in the memory, tracking back and searching for pointers to the strings. After an analysis of different memory images for different folders I found the common base address that was always the same. With this information it was easy to write a program that accesses the specific memory address and follows the pointer to the directory string.
The analysis itself is not very fast and takes several seconds (because the memory is searched dozens of times to find all pointer references), but since the pointer location in the stack memory is fixed the pure lookup is not noticeable.

Anyone who wants to take a closer look at the memory analysis tools because he wants to see if there is other information in the memory that may be useful can find the source code in the Subversion.

The next step is to combine the tool that performs the lookup (get_path.c) with an OSD overlay that executes a script every time a directory is reloaded. This way its easy for other’s to use this mechanism to produce context / directory sensitive GUI. Stay tuned.

May 10, 2009

Welcome to the WDTV Tools Blog

Filed under: wdtv — Tags: , , — Elmar Weber @ 01:42

The WDTV Tools project aims to be the central place for development for every kind of tool and application for the Western Digital TV HD. This will mainly include common utilities where other can build upon, e.g. IR modifications, OSD extensions and other stuff. Development information and tutorials will also be a part of this, these information will be in the Trac. General information regarding WDTV development will be posted here too.

Powered by WordPress