02:38 am - Friggin' Sony... okay, screw trying to play nice. *CHAINSAW*
I've officially had it with how wonky the SixAxis is. It's returning multi-byte values in big-endian format it looks like, no wonder they didn't reveal the accelerometer data over the USB interface... they can't, since USB specifies little-endian data order. (Basically, all numbers are byte-swapped. 1 becomes 256, 256 becomes 1, 257 stays the same, etc.)
Previously, I was trying to 'play nice' and just modify Sony's HID Report Descriptor and continue using the existing parsing infrastructure in the HID stack, as all the other devices in the kernel currently do. At this point, screw that, I'm re-writing the HID Report Descriptor to something ultra compact and very sane to read instead of the 148-byte monolith of standards-breakage it is now, and just use the HID Report pre-filter hook to re-write the raw bytestream.
Now... to decide on an axis-ordering... comments, anyone? I'm trying to decide if I should just shove things in like this or not since from what I've seen the R3 stick is the least-used outside of L3+R3 specific games, so this layout would make it easiest to use the PS3 controller as a 'generic gamepad' in most games:
+ pad becomes X/Y
L3 stick becomes Rx/Ry
R3 stick becomes Z/Rz
In effect I'm trying to match up the results to the stereotypical Gravis USB Gamepad layout as far as possible.
And oddly, while the Linux Input stack supports buttons that return analog values ...well, many games don't like those because they're highly unexpected. =^.^=
Makes for 'sticky button' symptoms, as many games just check 'are you 0?' for is a button pressed or not, and a button can 'last report' a 1 or 2 instead of a 0. I'll crowbar the values to 0 when the 'button' sensor says 0, as it's a proper way to reveal the functionality and
will work for all instances as far as I can tell.
And I have to say, all this HID-hacking really gives me a lot more respect for the robust control-binding interface the MAME developers built. I used to wonder why they supported such complexity, now I'm realizing it's actually very capable, since it can support far more advanced control interfaces easilly than the typical '16 switch' gamepads most of us grew up with.2 comments