For the impatient, I’ve released an Objective-C wrapper around IOHIDLib, DDHidLib version 1.0 on my Google Code project. For more information, continue reading.

I’ve been working on USB joystick support for MAME OS X in the background for a few months now. The API for accessing joysticks and gamepads on OS X is called IOHIDLib. HID stands for Human Interface Device and IOHIDLib is an I/O Kit API to these devices. While IOHIDLib is the only way to access joysticks, it can also be used to access mice and keyboards at a low level. For example, if there are multiple mice or keyboards, you can access them independently. This is great for games like MAME OS X, since each mouse can control a different player.

For PSIG 101 in early February, I gave a presentation about using IOHIDLib. I showed that using IOHIDLib can be quite a bit of code for simple tasks, like getting asynchronous notification of mouse events. In order to simplify this for MAME OS X, I wrote Objective-C wrapper classes. Victoria Wang wrote up a nice summary of the presentation, and mentioned DDHidLib, my Objective-C wrapper around IOHIDLib. DDHidLib, while written for MAME OS X, is useful on its own, so I’ll pulled it out into its own project.

I’ve been pretty mum about DDHidLib since PSIG, mainly because it was fairly incomplete at the time of the presentation. But I also didn’t have a good place to host it. With both of these issues resolved, I’m announcing DDHidLib version 1.0. It’s hosted on my shiny new Google Code project.

Included is DDHidDevice, a class for generic HID devices, as well as four subclasses for common device types: joysticks (and gamepads), mice, keyboards, and the Apple IR remote. DDHidDevice provides easy access to HID elements and queues. The subclasses provide easier access to device specific elements (i.e. you don’t have to dig through recursive dictionaries to find the mouse buttons), and provide delegates for asynchronous notifications of these elements. The Apple IR remote class is essentially a duplication of Martin Kahr’s wrapper class.

Also included are two apps, HID Browser and HID Device Test. HID Browser is a nice debugging tool to view all HID devices and see how the cookies map to the physical device. HID Device Test is mainly a test app for the subclasses, but it also serves as sample code on how to use them. The IR tab replicates Martin’s cool app, and even uses some of his code (thanks Martin!). Anyhow, I hope this is useful, and yes, it does mean joystick and mouse support is coming soon for MAME OS X.