diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-10-28 12:49:20 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-10-30 09:13:29 -0400 |
commit | 08072dde333c2f09114a01b0bd32be52ecce195b (patch) | |
tree | 9f6841827abd53f5445052951ff2b1a64a925bb8 /drivers/hid/hid-wiimote.h | |
parent | 0abda6fa81dced031e3df31ac29bfb253549c2d1 (diff) |
HID: wiimote: add pro-controller analog stick calibration
The analog sticks of the pro-controller might report slightly off values.
To guarantee a uniform setup, we now calibrate analog-stick values during
pro-controller setup.
Unfortunately, the pro-controller fails during normal EEPROM reads and I
couldn't figure out whether there are any calibration values stored on the
device. Therefore, we now use the first values reported by the device (iff
they are not _way_ off, which would indicate movement) to initialize the
calibration values. To allow users to change this calibration data, we
provide a pro_calib sysfs attribute.
We also change the "flat" values so user-space correctly smoothes our
data. It makes slightly off zero-positions less visible while still
guaranteeing highly precise movement reports. Note that the pro controller
reports zero-positions in a quite huge range (at least: -100 to +100).
Reported-by: Rafael Brune <mail@rbrune.de>
Tested-by: Rafael Brune <mail@rbrune.de>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-wiimote.h')
-rw-r--r-- | drivers/hid/hid-wiimote.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hid/hid-wiimote.h b/drivers/hid/hid-wiimote.h index 75db0c400037..03065f1917fc 100644 --- a/drivers/hid/hid-wiimote.h +++ b/drivers/hid/hid-wiimote.h | |||
@@ -46,6 +46,7 @@ | |||
46 | #define WIIPROTO_FLAG_DRM_LOCKED 0x8000 | 46 | #define WIIPROTO_FLAG_DRM_LOCKED 0x8000 |
47 | #define WIIPROTO_FLAG_BUILTIN_MP 0x010000 | 47 | #define WIIPROTO_FLAG_BUILTIN_MP 0x010000 |
48 | #define WIIPROTO_FLAG_NO_MP 0x020000 | 48 | #define WIIPROTO_FLAG_NO_MP 0x020000 |
49 | #define WIIPROTO_FLAG_PRO_CALIB_DONE 0x040000 | ||
49 | 50 | ||
50 | #define WIIPROTO_FLAGS_LEDS (WIIPROTO_FLAG_LED1 | WIIPROTO_FLAG_LED2 | \ | 51 | #define WIIPROTO_FLAGS_LEDS (WIIPROTO_FLAG_LED1 | WIIPROTO_FLAG_LED2 | \ |
51 | WIIPROTO_FLAG_LED3 | WIIPROTO_FLAG_LED4) | 52 | WIIPROTO_FLAG_LED3 | WIIPROTO_FLAG_LED4) |
@@ -135,6 +136,7 @@ struct wiimote_state { | |||
135 | 136 | ||
136 | /* calibration/cache data */ | 137 | /* calibration/cache data */ |
137 | __u16 calib_bboard[4][3]; | 138 | __u16 calib_bboard[4][3]; |
139 | __s16 calib_pro_sticks[4]; | ||
138 | __u8 cache_rumble; | 140 | __u8 cache_rumble; |
139 | }; | 141 | }; |
140 | 142 | ||