From patchwork Fri Nov 1 20:16:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 3127641 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6C25C9F3C4 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 83FBA204D8 for ; Fri, 1 Nov 2013 20:16:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A16D8204AE for ; Fri, 1 Nov 2013 20:16:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752553Ab3KAUQw (ORCPT ); Fri, 1 Nov 2013 16:16:52 -0400 Received: from mail-ee0-f51.google.com ([74.125.83.51]:40686 "EHLO mail-ee0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753223Ab3KAUQv (ORCPT ); Fri, 1 Nov 2013 16:16:51 -0400 Received: by mail-ee0-f51.google.com with SMTP id d41so4942eek.10 for ; Fri, 01 Nov 2013 13:16:50 -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=JJTwX4mJemw4aR9FDwMh3Sb4Jf6D679m2Zrwh1Nqzjk=; b=UXrgKBUMLZJhj2WvfqJevSqJ8PwlZg/prBV09/a7jsrtluau/coYg33N5Nq1a7HpBS B6729I3lw73WXllw3u8Fm8Er9rmxNaFWwTfvW+3qGmkBynm9QAHWMc3rZP4/sBoHfIOP FHHg79v80nfcbSuLWYa0SJfIHWmZO8iFwjcPjOqNyv+pBQmXEL90DQsO3oJX2/vvuO9Q Hm7jeU6esY5wPs+axhGsBt6fkqz3KxStind9IPsW+N59eHs7LKZ/t3mUkDtHDPfJdAvF /NrJ+pUG5Aj3XyNMtv3FltQCSUpZIaFsCN3ctxHXsHp1qHRidPAY5hyjrF3rCMOj6Noj nNVQ== X-Received: by 10.14.216.68 with SMTP id f44mr4772623eep.6.1383337010794; Fri, 01 Nov 2013 13:16:50 -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.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Nov 2013 13:16:50 -0700 (PDT) From: David Herrmann To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Jiri Kosina , Peter Hutterer , Benjamin Tissoires , David Herrmann Subject: [PATCH 05/13] HID: wiimote: add hid_wiimote.legacy parameter Date: Fri, 1 Nov 2013 21:16:16 +0100 Message-Id: <1383336984-26601-6-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 The first hid-wiimote driver had horrible default mappings which we have to support now for compatibility reasons. This was no big problem as the wiimote needs special user-space drivers to really make sense, anyway. However, there are several wiimote extensions which can be used on their own (especially the gamepads). To allow new mappings which comply to the common gamepad rules, we introduce the hid_wiimote.legacy parameter so users can get the old behavior back, if they need it. This patch only introduces the module parameter, the following patches will change the mappings. Signed-off-by: David Herrmann --- drivers/hid/hid-wiimote-core.c | 9 +++++++++ drivers/hid/hid-wiimote.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c index 1446f52..89ca031 100644 --- a/drivers/hid/hid-wiimote-core.c +++ b/drivers/hid/hid-wiimote-core.c @@ -20,6 +20,9 @@ #include "hid-ids.h" #include "hid-wiimote.h" +/* set to 1 to enable legacy-mode and old reports */ +static unsigned int wiimote_legacy = 0; + /* output queue handling */ static int wiimote_hid_send(struct hid_device *hdev, __u8 *buffer, @@ -1731,6 +1734,9 @@ static struct wiimote_data *wiimote_create(struct hid_device *hdev) wdata->hdev = hdev; hid_set_drvdata(hdev, wdata); + if (wiimote_legacy) + wdata->state.flags |= WIIPROTO_FLAG_LEGACY; + spin_lock_init(&wdata->queue.lock); INIT_WORK(&wdata->queue.worker, wiimote_queue_worker); @@ -1873,6 +1879,9 @@ static struct hid_driver wiimote_hid_driver = { }; module_hid_driver(wiimote_hid_driver); +MODULE_PARM_DESC(legacy, "Enable legacy mode and reports"); +module_param_named(legacy, wiimote_legacy, int, 0600); + MODULE_LICENSE("GPL"); MODULE_AUTHOR("David Herrmann "); MODULE_DESCRIPTION("Driver for Nintendo Wii / Wii U peripherals"); diff --git a/drivers/hid/hid-wiimote.h b/drivers/hid/hid-wiimote.h index 03065f1..6f70823 100644 --- a/drivers/hid/hid-wiimote.h +++ b/drivers/hid/hid-wiimote.h @@ -47,6 +47,7 @@ #define WIIPROTO_FLAG_BUILTIN_MP 0x010000 #define WIIPROTO_FLAG_NO_MP 0x020000 #define WIIPROTO_FLAG_PRO_CALIB_DONE 0x040000 +#define WIIPROTO_FLAG_LEGACY 0x080000 #define WIIPROTO_FLAGS_LEDS (WIIPROTO_FLAG_LED1 | WIIPROTO_FLAG_LED2 | \ WIIPROTO_FLAG_LED3 | WIIPROTO_FLAG_LED4)