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.

Re: Actually...

[identity profile] wolfwings.livejournal.com 2009-05-04 05:24 am (UTC)(link)
Feel free to snargle the code I linked above, it's a decent attempt (I think) at making an async 'just go over here and process the data into something sane' middle-ware layer for dealing with raw HID reports at whatever rate the object returns them, seperate from the software that actually needs to use them. It was an excuse to learn PThreads, but after playing with the HID protocol it's actually rather close in idea, just without the report-descriptor stuff so it's device-specific.

I don't yet know the way to associate a HIDRAW with a USB device entry, mostly due to lack of research or any way to test it since I only have one device that will show up that way (my PS3 SixAxis/DS3) but that's a relatively minor limitation by comparison.

Also, most distro's don't pair up the HIDRAW's to have the same rights as the other Input devices, they stay in /dev/hidraw*, and are root:root by default still.