Tuesday, December 21, 2010

Coordinating efforts towards free firmware implementations

Some months ago I have started to mantain a wikipage at LibrePlanet.org with a list of device drivers that require non-free firmware. For each device I created a wiki page to aggregate technical information about the device in order to make it easier for us to develop free firmware.

Then, during November I have travelled around Europe and have had the opportunity to hack on a laser projector in the Prague hackerspace. The special thing about it is that we developed free software for it but we still rely on the binary-only firmware to startup the device. And I was annoyed by that so I continued investigating and ended up discovering that the device has an EZUSB (which is a 8051 microcontroller with native hardware support for USB communication). Then I have found the datasheet for this microcontroller and started to study it. I even used a disassembler in order to inspect the firmware and things started making sense, but I got concerned about the legality of reusing code from this disassembly process.

At that point I figured out that I should check the wiki page again to see which other devices are using the same microcontroller because that was valuable knowledge that I had just acquired that could be used to free some firmware. So I searched for "ezusb" in the kernel source code and found 3 devices that also use it. One of these devices (DABUSB/TerraTec-DrBox1: a digital radio receiver) has its binary firmware distributed under copyright terms that allow free, derivative works:

* Copyright (C) 1999 BayCom GmbH
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that redistributions of source
* code retain the above copyright notice and this comment without
* modification.

So this means that by disassembling the firmware, the resulting source code is free. I've done it and now we just have to understand the code and give nice names to the variables and routines in order to have a free firmware for the device. I've been doing it yesterday and today but then I stopped for a while and started to question myself whether it is actually useful work. I am concerned that this is a device released 11 years ago and I don't know anybody who uses it nowadays. So I don't know what is the real demand of support for this specific device.

What I mean is that we need better understanding of the meaning of the LinuxLibre blacklist of devices. We need to figure out a way to sort these devices in a relevance order so that we can focus our reverse engineering efforts on the most critical ones. I suggest that we start a working group to define the criteria for sorting that list and continue this work with some better strategies. One of the possible ways to sort these devices by relevance would be to build statistics based on collecting hardware information of libre-distro users.

I hope someday we'll be providing fixes to the issues raised by the LinuxLibre project instead of simply removing functionality. I think that this perception that lots of people have of LinuxLibre as a less functional, technically inferior alternative to Linux is a real danger. I know that we should not judge software only by its technical aspects. Nevertheless, this is still no good advertising for LinuxLibre.

I'd like to hear your opinions about these questions.

Happy Hacking,
Felipe Sanches

Tuesday, December 14, 2010

Brmlab & Lasers!

I just got back to my home in Brazil yesterday. Travelling in Europe was great and I'd like to share here the details of some cool things I've done in my last week there.

My last stop in Europe was Prague and there was a special reason for that. Three months ago I received an email from Cestmir Houska, one of the members of Brmlab - the Prague hackerspace. Cestmir was contacting me because he got inspired by my photos and blogposts about the Party Land Remake project. He told me that building a pinball machine was one of his dreams from childhood (which happens to be my case also) and that he wanted to keep in contact so that we can help each other in making it become a reality.

Since we are both members of recently inaugurated hackerspaces we figured out that our pinball projects could be understood as a healthy collaboration between them, mutually. So we are planning to design, document and simultaneously build two pinball machines: one in Garoa Hacker Clube, in São Paulo, Brazil; and the other one in Brmlab, in Prague, Czech Republic.

So, since I had the opportunity to visit Europe again due to the Mozilla Drumbeat Festival in Barcelona, I decided to schedule a visit to Prague (which resulted in my visit to Metalab in Vienna also).

In one of the days that I was there at Brmlab, one guy showed me his personal project: a homebrew laser projector. It is composed of 3 lasers (Red, Green and Blue) and a pair of mirrors that are rotated by motors so that the laser beam aims at the wall in different possible angles. By properly controlling those lasers and mirrors, one can draw colorful shapes on the wall. The effect is even more interesting if you add some fog to the room :-)

So I promptly asked him what software he was using to run the laser projector and the answer was: iShow, a proprietary software. I still inquired about free software implementations of drivers or controlling software but he was not aware of any existent efforts. So we decided to start doing that right away. We installed an USB sniffer on his Windows machine and started reverse engineering the protocol used by the device. In half an hour we had our first line drawn by sending URBs through a python script running on my GNU/Linux. Then we spent more 3 or 4 days improving the python module (all source code is in my personal svn repository at Google Code) and implementing some demos:


We wanted to display the Brmlab logo, so I decided to do that by implementing a simple SVG loader. It parses the SVG file and reads the d attribute of all tags. Then each path command from the SVG path description results in the respective drawing routines for our laser device.

The result can be seen in this photo:

Then I remembered GML! Grafitti Markup Language is an XML specification for storing grafitti data. That basically means x,y,z and time coordinates. I have used a python module called PyGML to render some GML files with our laser.

Another relevant data format is called ILDA. It is a file format for storing laser-show animations. It was developed by the International Laser Display Association (which explains the acronym ILDA). Using this python module we got some ILDA animations running on our projector :-)

A clock!

This is a simple analog clock displaying the current local time.

A pong game

Cestmir has implemented a pong game using the pygame library and rendering on the laser display.

When we decided to display scores in the game, we faced the challenge of creating a font for our laser display and font rendering routines. The first 3 charachteres (0, 1 and 2) were designed by imagining the shapes and manually inputing the values of the coordinates of the bezier control points for the glyphs. At that point we decided we should implement a tool... (more on that topic in a future blogpost)

A server for sharing the display

While we were working on this project it became clear that the laser was a scarce resource. We had 4 people hacking on it and it was starting to become common to hear the sentence "Can I use the laser now?" (same sentence I've heard a lot in Vienna a week earlier, but refering to a significantly different machine...).

It reminded me of stories about the early days in computing when people disputed CPU time in universities and research institutes computers. And then multi-user time-sharing systems were developed. So I decided to develop something analogous for our laser display: a server that collects rendering requests from clients and manages to merge them on the real device.

The server receives commands through telnet and manages individual double buffering for each connected user. When a user disconnects, only his/her portion of the drawing disappears from the screen. I also adapted our python module so that it would delegate rendering to a remote server when you pass an IP address to its contructor; otherwise it would render in a local device connected to the USB bus.

That way we could have several users rendering content to the display simultaneously. One possible use of that would be running a script that draws a clock all the time on a corner of the display screen. Here is an example of that (the clock script and another scipt drawing some bezier curves been run remotely by two different users simultaneously):


Several people from the Brmlab hackerspace will attend the 27th Chaos Communication Congress (27C3) and they are planning to present the laser projector there!

Friday, December 03, 2010

Pinball Hacking in Vienna

I am currently in Vienna, Austria, visiting the Metalab Hackerspace. They have a very nice EPILOG 36EXT laser cutter there and I couldn't avoid using it to cut more parts for my pinball project! So I focused on the upper playfield (ramps, loops, P-U-K-E platform...).

This is what those parts are supposed to look like in the end:

And you can see how they look like now in these photos:

I still need to apply artwork to these acrylic parts. The stickers that I'll use in the project are these:

I also presented a speech about the project trying to get more people interested in hacking on pinball machines DIY manufacturing fun.

Then I also got the opportunity to help on the Roböxotica festival by laser-cutting the wood trophies for the cocktail robots contest!