wolfwings: (sleepy fox)
wolfwings ([personal profile] wolfwings) wrote2009-05-03 02:25 pm

Well... the HID protocol is actually kinda nice.

Was able to make a small modification to the existing Sony-Quirks HID driver for Linux to replace the stock HID Report Descriptor (basically, the device describing it's own protocol format) with one that works a lot better for actual use. All the buttons that can, only report as analog now, the 5 digital-only buttons report in correctly as digital-only buttons, AND the accelerometer data is available though I have to tweak the HID Report Descriptor a bit more to make it work best still.

Next, tweak the cross-pad to show up as a single pair of axes instead of four, so it's more usable as a left/right and up/down input. Then just need to add some tunables to switch some inputs back to pure-digital, and look into some code to process the accelerometer and MEMS gyroscope into simpler translation/rotation inputs in the actual input driver itself.

Last will be getting rumble and LED-control working, but I'm already looking at having to actually retrofit the kernel HID drivers to support out-right replacement of the HID Report Descriptor instead of simple in-place modification. I'm not sure if that invasive of a change will fly or not...

Oh, and a quick link for anyone else curious about the actual HID protocol: The USB Implementers Forum's HID Development Page has a link to their HID Descriptor Tool, and above that links to all the various HID documents. HID's very easy to tinker with, I'm finding out.

[identity profile] qdot.livejournal.com 2009-05-03 05:24 pm (UTC)(link)
Yup, HID is great when done right. However, it's also pretty badly abused due to the fact that the windows HID manager lets you retrieve raw reports (linux and os x do not). Many devices use that fact to build crazy protocols on top of HID that actually don't work with the HID manager, but just to subvert having to install drivers on windows. Even though you can access raw USB from user space in linux and OS X, if you have one of these devices, you have to blacklist it in the HID manager first. So far, I've had two biometrics products do this:

http://qdot.github.com/libomron/
http://qdot.livejournal.com/224537.html

But yeah, if used for what it was meant for, it's fuckin' great. :3