Thread (14 messages) 14 messages, 3 authors, 2011-06-07

Byte swapping u16 data in HID report

flat view

From: <hidden>
Date: 2011-06-01 05:32:16

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.


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help