It has been a while since my last post about USB support for HelenOS. But we have made some progress that I am proud to announce.
First of all, we have functional OHCI driver. OHCI is a host controller supporting USB 1.1 and, unlike UHCI, is not a PC-platform only product (OHCI is used in Macs as well). However, we do our development on PC and we have not tried our driver on anything else. The driver is complete (except for support for isochronous transfers) and was tested on real hardware. It also work in VirtualBox and so now you are not limited to QEMU only for trying HelenOS with USB support.
Since the beginning, our flagship was the USB HID driver and a noticable progress was made there as well. First of all, the base skeleton is finished and I dare say that HelenOS can be fully controlled by USB keyboard without any limitations. Obviously, this does not include the kernel console but that is to be expected. Huge progress was done with the HID parser that is almost completed now.
The HID parser reminds me of regular expressions in Unix. There is a problem inside another one that is of the same size as the outer one. The concept and internals of the parser were already changed several times because the specification does not give enough practical (I really mean practical, not the kind reader will...) examples to create good design from it alone. More than once, we found a keyboard (or mouse) that used settings (i.e. the hardware configuration wired in the physical device) not described well by the specification that forced us to rethink the design. I am not well versed with the parser to elaborate more on its design but it seems to me that HID specification was done purely by hardware vendors whose main concern is to save a few bytes. The rest can be done in software by some poor devils ;-).
To demonstrate the capabilites of the HID driver we decided to add a sample support for multimedia keys. Probably, they will not do anything useful but print some message somewhere but that shall be sufficient as a proof of concept. The support for such special HID devices is created using something we call a subdriver. Such subdriver is a set of callback functions that are registered in the generic HID driver and are called upon data retrieval. Their thask is extract the special keys and control some specific DDF interface to provide these events to client applications. In the future, these so called subdrivers might become fully independent drivers spawned by the generic HID driver. Definitely, that would be task for someone else.
Next we created a simple stub for mass storage driver to test that bulk transfers work. Because HelenOS lacks support for SCSI devices, the stub merely tries to identify the device by sending INQUIRY command. For some devices it works, some stall the communication and some even do not attempt to answer. Probably there is some magic in the initial handshake. However, mass storage support is not our goal and we will probably leave the driver alone for now. Someone else may carry on...
Last thing worth reporting is that JV found some awful bug in QEMU that causes that transfers ending with error are never reported as completed by the simulated UHCI chip. Bad. Although patch was provided, no action was taken yet.
As our deadline is approaching, we need to focus on fixing bugs that we know about, and writing the documentation - both Doxygen one and developers' one. Documentation can be found on-line here. Also, we need to prepare some distribution CD that we can ship to the project committee. We also need to make a presentation and I hope that we would be able to put something together before the next HelenOS Saturday meeting to present our project there. And maybe some refactoring and code beautification would be needed as well.
And that is all. We are planning to end in June so we have less than month for finalization. May the force, debugger and standard compliant devices be with us ;-).