Friday, February 22, 2008

OLPC: Adding a little border around SuperTux

Still haven't looked deeper into the issue of how to change the resolution on the OLPC, however I did a little experiment with simply adding a border around the screen, the result is this:
Looks for most part quite nice (just a placeholder of course) and raised the idea to have SuperTux run at different screensizes, have worldmap, menu and such run at fullscreen, while running the game with a smaller window size. Whatever will be implemented in the end, SuperTux already is quite playable as it is. This patch also makes SuperTux run in a window instead of fullscreen, so all the brightness controls and such work as normal on the OLPC.

Patch to get the above result is available on request, likely I'll open a new branch in SuperTux SVN in the next days.

Some other issues the game currently has:
  • tearing is currently rather obvious and annoying
  • the game doesn't have fixed size steps, so if the computer gets busy with other stuff it makes large jumps, often deadly for Tux
  • calling the sugar frame and similar adjustments sometimes doesn't work properly
  • alpha-blending, it is likely worth it to get rid of any of that to get faster fps

Thursday, February 21, 2008

SuperTux 0.1.x OLPC Patch

This little patch:
fixes a few issues with the gamepad controls and allows you to now use them also in the menu and on the worldmap, it goes against the supertux/0_1_x branch. You still have to remap the gamepad keys manually for use in the actual game.

Sunday, February 17, 2008

OLPC: Making fuse work

Since the OLPC is rather limited in terms of memory having a networked filesystem available is rather important. While NFS works, it isn't ideal, since it is not very flexible. Luckily there is an alternative: Fuse, which is a user space filesystem layer that has modules for all shorts of filesystems, such as sshfs or smb. Installing it however doesn't work out of the box, since you need an extra kernel module, so here a little docu on how to install it in a rather fast and painless fashion:

First step is to obtain git (maybe something like git-base would be enough, git is a rather large download):
  • yum -y install git
Then get yourself a copy of the olpc kernel tree:
  • git clone git://dev.laptop.org/olpc-2.6
Next we switch the checkout to the exact version on your machine, for that we look at the output of 'uname -a':

$ uname -a
Linux xo-05-29-94.localdomain 2.6.22-20080131.2.olpc.f150813900a7eec #1 PREEMPT Thu Jan 31 17:07:39 EST 2008 i586 i586 i386 GNU/Linux

At the end of the version number there is a hex code, this is what we use to checkout/reset our kernel tree:
  • git reset f150813900a7eec
Then we copy over the config that was used:
  • cp /boot/config-2.6.22-20080131.2.olpc.f150813900a7eec .config
And run:
  • make oldconfig
  • make xconfig
Via the search function search for 'fuse' and enable the module, once done, save the new config and:
  • make fs/fuse/fuse.ko
This little command ensures that you only compile the module, not the complete kernel. Once done you can run:
  • insmod fs/fuse/fuse.ko
To insert the module. The last step is to install the userspace fuse tools:
  • yum -y install fuse fuse-devel fuse-libs fuse-smb fuse-sshfs
If everything worked as expected you should now be able to use fuse and mount for example a different host via sshfs:
  • sshfs yourname@yourhost:/somedirectory /mnt
PS: You can run the whole git checkout and kernel compile on another host, it doesn't have to be the OLPC XO-1, it worked for me on Ubuntu 7.10. The 'git checkout' and 'git reset' can take a while, kernel module compile itself is very quick. You have to be root most some of this. A 'insmod' will only last till the next reboot, you have it to repeat after it or modify some files under /etc/. You have to be in the group fuse to use fuse as user, so edit /etc/groups.

Friday, February 15, 2008

Adding a TOC to HTML pages

And another little script for eBook reading on the OLPC: create-toc.rb

This one takes a list of XHTML files, creates a TOC page from the files and inserts next, prev and up links into the files. When you rebind your buttons in Opera for navigating next, prev and up links you can swap forward and backward through a book with a single button press, thus chapter changes become much easier and you no longer need the touchpad for navigation.

OLPC: fixing sticky gamepad buttons

One of my B4 XO-1 suffered from sticky gamepad buttons that wouldn't come fully back up once pressed down, fixing them however was rather easy. Just follow the OLPC disassembly guide and remove the front cover, once done just take a bit of sandpaper and enlarge the button holes in it a tiny litte bit. The buttons now won't stick the edge of the hole any more. Problem solved.

Thursday, February 14, 2008

Compiling Pingus and SuperTux on OLPC

Both Pingus and SuperTux compile mostly out of the box on OLPC, but tracking down the dependencies can be annoying. First you need to install some extra packages via the Terminal Activity, this handly command will do that:

yum -y install \
cmake \
subversion \
glibc-devel \
imake gcc \
gcc-c++ \
scons \
make \
boost \
boost-devel \
libpng-devel \
openal-devel \
physfs-devel \
libogg-devel \
libvorbis-devel \
SDL_image-devel \
SDL_sound-devel \
SDL_net-devel \
SDL_mixer-devel \
SDL dosbox \
xorg-x11-proto-devel \
libXi \
glibc-headers

Once done you have to download the actual source, for SVN that would be:
  • svn checkout http://supertux.lethargik.org/svn/supertux/trunk/supertux
  • svn co svn://svn.berlios.de/pingus/trunk/pingus/
Stable releases would be:
The SuperTux 0.1.3 release works very well, while the SuperTux SVN version is horrible slow when it comes to alpha-blended rectangle or fade-in/outs. With Pingus both work more or less the same.

With SuperTux you have to change ~/.supertux2/config to use "sdl" instead of "opengl" as video target or it will fail to start.

Some more notes:
  • start pingus with "./pingus -g 1200x900 -f" to get the full thing, it will however be slow, so you might want to lower the window size to something like 1024x768
  • music eats a lot of CPU so you want to disable it, for Pingus that can be done with "./pingus -m" for SuperTux you can do it via the menu
  • launching the games in window mode causes them to be positioned at the top/left, launching them in fullscreen causes them to be centered, but in fullscreen you will lose the ability to switch applications, since the game grabs all keyboard input, on the plus side this allows you to use the F1-F12 keys, which otherwise are handled by Sugar
  • you can change the screen size of SuperTux SVN in ~/.supertux2/config, it will however slow the game down a lot, you still get 20fps, but it will play very slow
  • SuperTux 0.1.3 will give you a very tiny window, NintendoDS size, but it will run very playable at 40-50fps, on the worldmap and in the menu you however can't use the gamepad keys, the configuration only affects the actually in-level gameplay, you have to configure your keys yourself in the menu
  • I haven't found a way to change the resolution/video-mode, so you can't have fullscreen and good FPS for now, XVideo extension might be a workaround, but I haven't looked into it
General note about OLPC performance: Watching video via Mplayer and XVideo works very well, but the machine doesn't have enough power to fill the screen without XVideo, so fast fullscreen is likely not going to happen, unless there is a way to change the video resolution or harness XVideo for non-video content.

Wednesday, February 13, 2008

More OLPC eBook

First, a new imgview is available at:
It includes a experimental pie-menu for use in eBook mode, allows to adjust backlight brightness and toggle black&white mode, all other menu entries don't do anything and are currently just placeholders.

As imgview is only good for scanned pages and other image based books, here now some tips for non-image texts, i.e. plain txt files.

Opera for the XO contains a lot more features then the currently build in Browse activity and is thus much more comfortable to use, to installing it is recomment. I couldn't make the Opera Activity work, but running it from Command Line worked fine.

While plain txt files are readable in Opera or Browse, anything larger then 20kb becomes quickly uncomfortable due to lack of proper in-page bookmarks and slow scrolling in ebook-mode, to fix this I wrote a simple script, split-txt.rb. All it does it take a filename and a regex and then split the file whenever that regex occurs. This allows to split files into nice chunks.

To fix the formating of plain txt files there is a nice little tool called txt2html. With it one can turn a txt into a html. This allows the easy use of a variable width font and proper text flow. And with Opera one can even add a custom style sheet to customize the output even more. txt2html doesn't always work perfectly, but a few regex onto the source material often fix that.

With split-txt.rb and txt2html in combination one can easily turn a long text into a some nice junks of .html that are easy to read and handle on the XO. One still has to turn into laptop mode to switch chapters, but other then that it works relatively well.

Sunday, February 10, 2008

Turning the OLPC into a book reader

As mentioned before, the available software for the OLPC is still rather unfinished and unpolished, so time to start some hacking. What missing the most currently is a simple image viewer. The joy of a image viewer is that you can basically convert everything you have to a image and view it with it (PDFs, Webpages, etc.). The Image viewer is available at:
and currently started via the Terminal, supply it with a list of images you want to view and it will show them. When you have PDFs that consist of scanned images you can use "pdfimages -j" to convert them to JPEGs. If images don't have the right size you can use Imagemagick to convert them:
  • convert -quality 80% -scale 1200x -sharpen 1x1.2 " INFILE OUTFILE
Usage of the image viewer is simple, dpad scrolls, [] goes page forward, V goes page backward, X goes into black&white, O hides the interface (refering to the gamepad buttons here, not keyboard keys) .

Thursday, February 07, 2008

Two weeks with the OLPC XO-1

I was able to obtain two OLPC XO-1 via the Developers Program and now had around two weeks to play with them. So where do we start? The look of the machine is somewhere between Fisher Price and the early iBooks, it is not bad at all, but likely won't be the fashion item of the month either. I think it gets the job of looking like a laptop for children done quite nicely and has a quite robust feel to it.

Next thing that one will notice is the weight, while it is at 1.5kg rather light for a laptop, it feels rather heavy for a small laptop. Not so much a problem when it stands on the table or you want to just carry it around, but in eBook/tabet-mode it gets hard to hold the thing for an extended period of time without resting it somewhere.

The keyboard of the machine gets its job done, but it doesn't feel all that great, the rubber keys can require quite a bit of force when you want to make sure that a key got really hit, otherwise you might end up with a missing letter now and then. Its not bad compared to what some PDAs have, but doesn't really come close to a real PC or laptop keyboard. Its size is of course a problem, since you can't fit your fingers on the homerow, but then it wasn't designed for adults, so that doesn't come as a suprise.

The gamepad keys suffer a similar size problem, when you thought the Gamecube dpad was small, think again, this one is even smaller, its really tiny actually. Which comes kind of as a suprise, since Gameboy and such don't really have a much different target audience then the OLPC, yet are far larger. The precision of the dpad is also not exactly great, some directions always end up getting a diagonal into it even when you try to make straight move. That said, I could play through all of SuperTux without any problems, so it gets the job done, at least for that game. And lets not forget that there really isn't another laptop on the market that has a gamepad in the first place.

The webcam gives a surprisingly good picture, even without much light the results are still ok.

The stylus area is currently not supported by any software, but it does report some events via /dev/input/event5, so its actually working.

The touchpad works like most other touchpads, not as good as a mouse or trackball, but gets the job done.

The screens diagonal striping can annoy a little bit in the beginning, but you get used to it. In terms of color it not all that great and its rather view depended. But its resolution is huge, so huge in fact that you can't really run normal applications on the machine without enlarging the font by factor 2 first. And in terms of sunlight readability it likely kicks most other laptops ass. The only downside of the sunlight-readable screen is that it really needs sunlight, in-door its not all that usable and you will likely use the backlight.

The biggest problem right now with the machine is its software, which really doesn't feel like a 1.0, but more like a 0.3 or so. There are a lot of feature and applications that aren't implemented or incomplete right now. The stylus area doesn't even have a demo app, there isn't a usable eBook reader aside from the webbrowser and a Evince port and lots of stuff feels rather slow due to the lack of optimizations, especially application startup, even so the machine itself is quite fast. The Journal, which replaces a classical filesystem for most part, also lacks more then a few features to be usable. Aside from the pure feature side the power consumption is likely the area where you notice the incompleteness of the software first, currently it runs for around 3 hours, far from the once advertised 20 hours. However, there is still lots of room for optimizations and some power saving features aren't even activated yet.

The incompleteness aside, Sugar does work great. Having all apps starting in full screen and having all Window management problems solved that way really gives a very smooth experience, since things will just work and you don't have to waste your time with shifting Windows around.

Don't get me wrong. While the machine does have some small problems, none of them is really a show-stopper and most will likely be fixed in the coming month in software. As an eBook reader the machine is, aside from the lack of proper software, near perfect. You simply don't get another device in this size and price range that has a rotatable sunlight readable screen along with solid gamepad buttons. And while the screen might not be ePaper like in readablity, it gets pretty damn close with its 200dpi, so close in fact that I have some serious doubt if ePaper will ever have widespread success. Unlike ePaper this screen doesn't have a problem giving you quick refresh rates. So while ePaper will have large trouble displaying some webpages this screen doesn't and its also cheaper.

The biggest downside of the OLPC currently is simply that you can't buy it. G1G1 isn't available in Europe and no longer available via G1G1 in the USA. And as great as the machine is, $400 is quite pricey, so I really hope that the machine will see a regular release. At $200 it kind of really becomes a must-by if you ever wanted an eBook reader, especially one that is completly open, not DRM looked and can browse webpages and play games too.

A month with the Wii

Time for a short summary of my experiences with the Wii and to get this blog jump-started again. I had a Wii know for a little over a month together with Wii Sports, Mario Galaxy and Metroid Prime 3. Short summary: all of those games are fun, but neither good enough do justify the purchase and neither good enough to justify the Wii itself.

Mario Galaxy doesn't make much use of the Wiimote to begin with, so it could have been done on the Gamecube with almost no changes. Graphically it looks better then Sunshine, but not so much that you would really care. On the downside its a lot more linear then any 3D Mario before, so its more like the 2D ones then the 3D ones. So you don't have much fun exploring.

Wii Sports is kind of the showcase title for the Wiimote, since its one of the few games that actually uses it, but as a game its far to simple to entertain for long and even as tech-demo it can't impress all that much. Most Wii Sport games boild down to timing, in Baseball it doesn't matter much how you swing, but that you swing at the right time, speed might better too a bit, but its not really all that important. Same with Tennis, forehand and backhand are recognized, but thats mostly it, its pretty much impossible to control where the ball should fly, instead you simply swing the 'mote every now and then and the game plays mostly by itself. Golf is worse, since you don't even have to care about timing, all you do is swing the 'mote at a certain speed and you are done, you can play the game for most part completly blind. Bowling is probably the most interesting title, but even that is far from perfect, you can control speed and spin, but direction, position and such are all controlled with the dpad, not with your swing. In all the games you can more or less cheat, i.e. perform a waggling motion that has little to do with the real thing and still succeed at the game.

Metroid Prime 3 is supposed to be a showcase title for new FPS controls, but again, can't really impress. One nice aspect is that your aim is very fluid, unlike like dual-analog where you are always rather static with your view. On the downside it gets hard to keep your view centered in dialog and other non-gameplay situations, so that you end up spinning around when the dialog is over, little thing, but it annoys. In terms of precision the Wiimote might win again dual analog, but not really by much. Since you have to control view and aim with the same cursor, your view will always drift a little bit when you shift your aim, so getting a precise aiming on an enemy is nearly impossible unless you use the lock-on, which really is kind of a cheat. What however is most underwhelming in Prime3 are the mini-games, while they show that the developers actually cared to make something with the Wiimote, they just all to clearly show that the Wiimote isn't up to snuff. It simply doesn't work. You have to press a leaver, you move your Wiimote and nothing happens or something that you didn't intended. The games are all designed that things will snap into place automatically if you just waggle around a bit, so its not a big problem, but it makes it clear that the Wiimotes motion-detection just isn't usable for anything that requires precision. Also easily seen with the grapple beam, which doesn't work freely, but only if you look-on the grapple target before, so you are basically down to replacing a button with waggle.

All in all I can't say that I was impressed, even simple things like controlling the cursor in the menu don't work perfectly, from time to time the cursor will jump around for no obvious reason. Also the field-of-view is far to small. On a PC with unofficial drivers you have quite a bit more room to control the cursor and its much easier to find the cursor on the screen, while with the Wii its far to easy to aim outside the screen. The motion sensing itself is as expected not really usable either. I haven't seen a single game where it actually adds substance.

For the last two weeks the Wii has already started to collect dust and beside SmashBros and EndlessOcean I don't see any games on that machine that interest me.