Re: Byte swapping u16 data in HID report

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 1 Jun 2011 01:32:15 -0400
simon@xxxxxxxxxxxxx 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?

Attachment: pgpN5lRFDV9N7.pgp
Description: PGP signature


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux