dvdhrm/xf86-input-xwiimote — pull request #15 by dnschneid (2014-06-12 09:31:13+00:00)
Title: IR improvements

It's not the prettiest code, but I figure I'd alert you to the IR-related improvements I've been making, in case you'd like to incorporate them (probably with parameterization and cleanups):

1. Ignore (0, 0) points. I don't know why (nor if this is normal), but my RVL-CNT-01-TR always has one.
2. Average the two lightbar points. At the extrema, extrapolate the second point based on previous knowledge. This fixes the edge behavior which the old heuristic was pretty abysmal at.
3. Perform some averaging of the resulting location when it seems like the wiimote is being held steady. I've tried to balance jerkiness and accuracy, but the values really should be parameterized since people's hand steadiness/display size will vary.
4. Use two separate keymaps, one for when the wiimote is pointed at the display, and one for when it has lost sight of the IR bar for at least a second. This is handy for mouse control vs. gamepad usage.

I do plan to implement proper tilt compensation (probably something like rotate the points around the center so that the lightbar is level, then disambiguate 180 degrees via the accelerometer), but since this is such an improvement over the current behavior I figure I'd volunteer what I have already.