From patchwork Fri Nov 1 20:16:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 3127651 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BF6C4BEEB2 for ; Fri, 1 Nov 2013 20:17:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DAA19204AE for ; Fri, 1 Nov 2013 20:17:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 15542204D9 for ; Fri, 1 Nov 2013 20:17:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753306Ab3KAURA (ORCPT ); Fri, 1 Nov 2013 16:17:00 -0400 Received: from mail-ea0-f176.google.com ([209.85.215.176]:62992 "EHLO mail-ea0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753223Ab3KAURA (ORCPT ); Fri, 1 Nov 2013 16:17:00 -0400 Received: by mail-ea0-f176.google.com with SMTP id q16so2226701ead.7 for ; Fri, 01 Nov 2013 13:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=39TIstX5gNUWnrhiA3zXJijPE5Oyf2DKrNmibcrBlIs=; b=ZKvExrYMUJ5JKs2tNpiH4xE+KBaIFQYqZ+ZFuMF6LiDYrNK2TvS8EgUT8KNB+3ZJeP c+KNZRafMd0wU+00idHL4gNg7Pfe9ebPZjajpjJDOC3xtr0ipwUacuff/uXBRxFIRQH6 70YHPVNktsBmt2JXAdJzAK7A4Mlgi4Tzge/+cjeKWVmGyC61hB+BqgsWYWsAGga/q/ZF dJdp/1SJLCNk/uJRmtv5mk5F4pFZzlE/KookdR5fxNfQ0/Zum3f7zuzVSiEBKdtKV2HW zvDNyY6gCrnZlGxOsVUa95tAR0pbcCTELsOaMEawRJkxKZkPPkrz3J30GJjYq8spYL0d O8Ng== X-Received: by 10.15.54.199 with SMTP id t47mr4836627eew.46.1383337019091; Fri, 01 Nov 2013 13:16:59 -0700 (PDT) Received: from localhost.localdomain (stgt-5f719f65.pool.mediaWays.net. [95.113.159.101]) by mx.google.com with ESMTPSA id i1sm11797335eeg.0.2013.11.01.13.16.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Nov 2013 13:16:58 -0700 (PDT) From: David Herrmann To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Jiri Kosina , Peter Hutterer , Benjamin Tissoires , David Herrmann Subject: [PATCH 10/13] HID: wiimote: use ABS_GYRO_* bits for MP Date: Fri, 1 Nov 2013 21:16:21 +0100 Message-Id: <1383336984-26601-11-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.4.1 In-Reply-To: <1383336984-26601-1-git-send-email-dh.herrmann@gmail.com> References: <1383336984-26601-1-git-send-email-dh.herrmann@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)