Re: Byte swapping u16 data in HID report
flat view
From: Antonio Ospite <hidden>
Date: 2011-06-01 10:59:05
On Wed, 1 Jun 2011 01:32:15 -0400 simon@mungewell.org wrote:
Hi,
I'm looking into fixing the Sixaxis controller (hid-sony.c) so that the
accelerometers and gyro data are reported via a joystick axis.
I have patched the HID descriptor so that the values are seen, however
they are reported high byte first (0x2FF -> 0x02, 0xFF) which appears to
be contrary to the HID spec.
--
5.8 Format of Multibyte Numeric Values
Multibyte numeric values in reports are represented in little-endian
format, with the least significant byte at the lowest address.
--
I'm working on the assumption that the data can be 'fixed' before it is
parsed. Would intercepting 'hid_get_report()' be a good place and how can
I locate the actual data bytes to do a 'bswap16()'.
I'm thinking something like:
--
if (sc->quirks & SIXAXIS_CONTROLLER_USB) {
hdev->hid_get_report = sixaxis_hid_get_report;
}
--
Any suggestions/comments?
Simon.Marcin Tolysz (added to CC), worked on the sixaxis descriptor before, see http://permalink.gmane.org/gmane.linux.bluez.kernel/5184 Look in particular at the sony_raw_event() function. I also like his approach of overriding HID descriptors with the firmware framework in principle, even if its practical use still needs some evaluation. Regards, Antonio -- Antonio Ospite http://ao2.it PGP public key ID: 0x4553B001 A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing?
Attachments
- (unnamed) [application/pgp-signature] 198 bytes