Blog | About

USB for HelenOS

29 Nov 2010

Tags: HelenOS and USB

Because I am also member of the team that wants to add support for USB to HelenOS and I have enough of programming, I decided to write few paragraphs about HelenOS/USB project...

Disclaimer: text below is not an opinion of the whole team and shall not be taken literally. I am trying to make this post at least a bit fun to read ;-).

We are adding support for USB devices to HelenOS as a part of Software project subject and we officially started this month.

Because we just started, there is not much progress to report. Actually, we had first meeting several months ago, but it takes some time from first thoughts to written specification approved by the Software project committee.

However, we weren't refining the specification all the time. We were studying ahead the USB specifications to which our "product" must comply. Have you ever seen a USB specification? If no, then believe me that you have missed nothing. USB specifications consists of thousands of pages written in technical English by someone (actually, these specifications are always work of a group because solitary person would go crazy from writing it) with apparently no sense of humor. Not talking about different formatting conventions used in individual specifications.

Because of the huge scope of USB, our project goal is limited to USB 1.1 only and we are supposed to create a functional driver for USB keyboard (the official specification talks about HID keyboard but we all hope that it does not mean that we need to implement the whole HID specification which is very long and includes support for such items as gloves for virtual reality software). Also, priority is a static configuration (i.e. no hot unplug).

So, to sum it up, at the end we want to present HelenOS as an OS that is usable with keyboard attached by USB wire. This sounds that it is not much but because HelenOS has no support for USB at all, we are actually starting at zero and want to end with something that both developer and ordinary user can appreciate (well, for HelenOS, these are identical but that is not the point).

But back to our progress I promised to inform you about. In three words, "we are fighting". With what? Luckily, so far, not among ourselves. But there are couple of things we need to get familiar with.

First, we are fighting with Bazaar: it is something different that Git or Mercurial and the worst thing is different terminology and different command naming.

Next, we are fighting with HelenOS itself. It is simply different system than Unix or Windows and getting used to it needs some time. The difference includes the microkernel design in general, asynchronous IPC or fibrils. Plus limited functionality of libraries.

And, of course, we need to unify our coding styles and start writing according to the conventions used in HelenOS. Currently, we are in the phase so common among programming enthusiasts (after all, why we have HelenOS ;-)?): "I do not want to read this (ugly) code, I can do it better by myself" and "my coding style supersedes everything written so far in this file". In this, I am the "enforcer" because I am already past that phase. I had to fight with that months ago when I started working on NUMA ;-).

We decided to use the device driver framework and currently we are fighting with it as well. I believe that using the DDF is a good step in general although right now we are a bit confused. I guess we all expected that it would do more (and that we would not need to touch it at all). We already encountered some problems that might be bugs in DDF. Or maybe we only botched-up something on our side. As soon as we find out where the problem actually is and if it is really in DDF, we will report to the mailing list.

Okay, I hear you ;-). You want to know whether we actually wrote some code or we are only grunting and swearing. So here is our "coding" progress.

We have a very simple mini-framework for creating virtual USB devices to allow testing USB drivers. Currently, it pretends work of host controller with single hub and plugged-in keyboard.

We are now working on generic framework (built above DDF) for creating host controller and hub drivers that will first operate above the virtual host controller. Other efforts, running in parallel, are implementation of UHCI driver and keyboard driver with fixed (i.e. built into the source code, not read dynamically) descriptors. If you have no idea what descriptors I mean, lucky you. Descriptors are way how USB device for human input informs the host about the items it reports (e.g. whether it reports pressed keys or joystick button status or finger bend) and are very generic and the specification is simply awful (I guess it is in English by used prepositions but I am not 100% sure).

And last success is that we are getting used to having "programming sessions" each week where we meet and code together (and we are even having fun there).

And that's all. I hope I haven't omitted something and haven't insulted anyone. I will try to inform about our progress regularly. If this source is not enough (or you simply don't like my style of writing or whatever), you can follow our activities at our Trac...


Watch comments through RSS

Add a comment

The e-mail will be used to get a Gravatar picture and will not be directly displayed.

Please, show me you are not a robot.

You can use basic HTML formatting (following tags are allowed: A, CODE, PRE, B, I, STRONG, P and BLOCKQUOTE). For replies, I recommend using the Quote button next to a post.