From: David Herrmann <dh.herrmann@gmail.com>
To: linux-input@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Jiri Kosina <jkosina@suse.cz>,
Peter Hutterer <peter.hutterer@who-t.net>,
Benjamin Tissoires <benjamin.tissoires@gmail.com>,
David Herrmann <dh.herrmann@gmail.com>
Subject: [PATCH 10/13] HID: wiimote: use ABS_GYRO_* bits for MP
Date: Fri, 1 Nov 2013 21:16:21 +0100 [thread overview]
Message-ID: <1383336984-26601-11-git-send-email-dh.herrmann@gmail.com> (raw)
In-Reply-To: <1383336984-26601-1-git-send-email-dh.herrmann@gmail.com>
Use the new gyroscope bits for motion-plus. The used ABS_R? bits are
ambiguous and should be replaced by proper bits to not confuse generic
user-space.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
drivers/hid/hid-wiimote-modules.c | 44 ++++++++++++++++++++++++++++-----------
1 file changed, 32 insertions(+), 12 deletions(-)
diff --git a/drivers/hid/hid-wiimote-modules.c b/drivers/hid/hid-wiimote-modules.c
index 777f932..e51e82b 100644
--- a/drivers/hid/hid-wiimote-modules.c
+++ b/drivers/hid/hid-wiimote-modules.c
@@ -2222,9 +2222,16 @@ static void wiimod_mp_in_mp(struct wiimote_data *wdata, const __u8 *ext)
else
z *= 9;
- input_report_abs(wdata->mp, ABS_RX, x);
- input_report_abs(wdata->mp, ABS_RY, y);
- input_report_abs(wdata->mp, ABS_RZ, z);
+ if (wdata->state.flags & WIIPROTO_FLAG_LEGACY) {
+ input_report_abs(wdata->mp, ABS_RX, x);
+ input_report_abs(wdata->mp, ABS_RY, y);
+ input_report_abs(wdata->mp, ABS_RZ, z);
+ } else {
+ input_report_abs(wdata->mp, ABS_GYRO_X, x);
+ input_report_abs(wdata->mp, ABS_GYRO_Y, y);
+ input_report_abs(wdata->mp, ABS_GYRO_Z, z);
+ }
+
input_sync(wdata->mp);
}
@@ -2274,15 +2281,28 @@ static int wiimod_mp_probe(const struct wiimod_ops *ops,
wdata->mp->name = WIIMOTE_NAME " Motion Plus";
set_bit(EV_ABS, wdata->mp->evbit);
- set_bit(ABS_RX, wdata->mp->absbit);
- set_bit(ABS_RY, wdata->mp->absbit);
- set_bit(ABS_RZ, wdata->mp->absbit);
- input_set_abs_params(wdata->mp,
- ABS_RX, -16000, 16000, 4, 8);
- input_set_abs_params(wdata->mp,
- ABS_RY, -16000, 16000, 4, 8);
- input_set_abs_params(wdata->mp,
- ABS_RZ, -16000, 16000, 4, 8);
+
+ if (wdata->state.flags & WIIPROTO_FLAG_LEGACY) {
+ set_bit(ABS_RX, wdata->mp->absbit);
+ set_bit(ABS_RY, wdata->mp->absbit);
+ set_bit(ABS_RZ, wdata->mp->absbit);
+ input_set_abs_params(wdata->mp,
+ ABS_RX, -16000, 16000, 4, 8);
+ input_set_abs_params(wdata->mp,
+ ABS_RY, -16000, 16000, 4, 8);
+ input_set_abs_params(wdata->mp,
+ ABS_RZ, -16000, 16000, 4, 8);
+ } else {
+ set_bit(ABS_GYRO_X, wdata->mp->absbit);
+ set_bit(ABS_GYRO_Y, wdata->mp->absbit);
+ set_bit(ABS_GYRO_Z, wdata->mp->absbit);
+ input_set_abs_params(wdata->mp,
+ ABS_GYRO_X, -16000, 16000, 4, 8);
+ input_set_abs_params(wdata->mp,
+ ABS_GYRO_Y, -16000, 16000, 4, 8);
+ input_set_abs_params(wdata->mp,
+ ABS_GYRO_Z, -16000, 16000, 4, 8);
+ }
ret = input_register_device(wdata->mp);
if (ret)
--
1.8.4.1
next prev parent reply other threads:[~2013-11-01 20:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-01 20:16 [PATCH 00/13] Input/HID: Bits and Pieces David Herrmann
2013-11-01 20:16 ` [PATCH 01/13] Input: uinput: add full absinfo support David Herrmann
2013-11-01 20:16 ` [PATCH 02/13] Input: introduce ABS_MAX2/CNT2 and friends David Herrmann
2013-11-05 22:29 ` David Herrmann
2013-11-01 20:16 ` [PATCH 03/13] Input: remove ambigious gamepad comment David Herrmann
2013-11-01 20:16 ` [PATCH 04/13] Input: add motion-tracking ABS_* bits and docs David Herrmann
2013-11-15 10:11 ` Antonio Ospite
2013-11-15 10:17 ` David Herrmann
2013-11-16 17:53 ` Antonio Ospite
2013-11-16 18:07 ` David Herrmann
2013-11-01 20:16 ` [PATCH 05/13] HID: wiimote: add hid_wiimote.legacy parameter David Herrmann
2013-11-01 20:16 ` [PATCH 06/13] HID: wiimote: adjust button-mapping to gamepad rules David Herrmann
2013-11-01 20:16 ` [PATCH 07/13] HID: wiimote: map nunchuk as real gamepad David Herrmann
2013-11-01 20:16 ` [PATCH 08/13] HID: wiimote: map classic controller as gamepad David Herrmann
2013-11-01 20:16 ` [PATCH 09/13] HID: wiimote: use ABS_ACCEL_* for accelerometer David Herrmann
2013-11-01 20:16 ` David Herrmann [this message]
2013-11-01 20:16 ` [PATCH 11/13] Input: introduce BTN/ABS bits for drums and guitars David Herrmann
2013-11-01 20:16 ` [PATCH 12/13] HID: wiimote: add support for Guitar-Hero drums David Herrmann
2013-11-01 20:16 ` [PATCH 13/13] HID: wiimote: add support for Guitar-Hero guitars David Herrmann
2013-11-04 13:04 ` [PATCH 00/13] Input/HID: Bits and Pieces Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1383336984-26601-11-git-send-email-dh.herrmann@gmail.com \
--to=dh.herrmann@gmail.com \
--cc=benjamin.tissoires@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=peter.hutterer@who-t.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).