From patchwork Wed Feb 18 16:59:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Michal_Mal=C3=BD?= X-Patchwork-Id: 5845421 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2C3469F269 for ; Wed, 18 Feb 2015 17:01:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4E0FA20149 for ; Wed, 18 Feb 2015 17:01:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E53602012E for ; Wed, 18 Feb 2015 17:01:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752570AbbBRQ7k (ORCPT ); Wed, 18 Feb 2015 11:59:40 -0500 Received: from imap.devoid-pointer.net ([31.31.77.140]:40904 "EHLO smtp.devoid-pointer.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752510AbbBRQ7j (ORCPT ); Wed, 18 Feb 2015 11:59:39 -0500 Received: from Labrat.localdomain.localdomain (228.123.broadband5.iol.cz [88.100.123.228]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by smtp.devoid-pointer.net (Postfix) with ESMTPSA id D242E21990; Wed, 18 Feb 2015 17:59:28 +0100 (CET) From: =?UTF-8?q?Michal=20Mal=C3=BD?= To: jkosina@suse.cz Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, simon@mungewell.org, elias.vds@gmail.com, =?UTF-8?q?Michal=20Mal=C3=BD?= Subject: [PATCH v3 3/4] HID: hid-lg4ff: Introduce a module parameter to disable automatic switch of Logitech gaming wheels from compatibility to native mode. This only applies to multimode wheels. Date: Wed, 18 Feb 2015 17:59:22 +0100 Message-Id: <1424278763-29072-4-git-send-email-madcatxster@devoid-pointer.net> X-Mailer: git-send-email 2.3.0 In-Reply-To: <1424278763-29072-1-git-send-email-madcatxster@devoid-pointer.net> References: <1424278763-29072-1-git-send-email-madcatxster@devoid-pointer.net> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Introduce a module parameter to disable automatic switch of Logitech gaming wheels from compatibility to native mode. This only applies to multimode wheels. Signed-off-by: Michal MalĂ˝ --- v3: - Share the module parameter through header file. - Create a new "hid-lg4ff.h" header file containing stuff specific to hid-lg4ff submodule. drivers/hid/hid-lg.c | 7 +++++++ drivers/hid/hid-lg.h | 12 ------------ drivers/hid/hid-lg4ff.c | 4 +++- drivers/hid/hid-lg4ff.h | 18 ++++++++++++++++++ 4 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 drivers/hid/hid-lg4ff.h diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c index f91ff14..b86c18e 100644 --- a/drivers/hid/hid-lg.c +++ b/drivers/hid/hid-lg.c @@ -27,6 +27,7 @@ #include "usbhid/usbhid.h" #include "hid-ids.h" #include "hid-lg.h" +#include "hid-lg4ff.h" #define LG_RDESC 0x001 #define LG_BAD_RELATIVE_KEYS 0x002 @@ -818,4 +819,10 @@ static struct hid_driver lg_driver = { }; module_hid_driver(lg_driver); +#ifdef CONFIG_LOGIWHEELS_FF +int lg4ff_no_autoswitch = 0; +module_param_named(lg4ff_no_autoswitch, lg4ff_no_autoswitch, int, S_IRUGO); +MODULE_PARM_DESC(lg4ff_no_autoswitch, "Do not switch multimode wheels to their native mode automatically"); +#endif + MODULE_LICENSE("GPL"); diff --git a/drivers/hid/hid-lg.h b/drivers/hid/hid-lg.h index 142ce3f..10dd8f0 100644 --- a/drivers/hid/hid-lg.h +++ b/drivers/hid/hid-lg.h @@ -24,16 +24,4 @@ int lg3ff_init(struct hid_device *hdev); static inline int lg3ff_init(struct hid_device *hdev) { return -1; } #endif -#ifdef CONFIG_LOGIWHEELS_FF -int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field, - struct hid_usage *usage, __s32 value, struct lg_drv_data *drv_data); -int lg4ff_init(struct hid_device *hdev); -int lg4ff_deinit(struct hid_device *hdev); -#else -static inline int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field, - struct hid_usage *usage, __s32 value, struct lg_drv_data *drv_data) { return 0; } -static inline int lg4ff_init(struct hid_device *hdev) { return -1; } -static inline int lg4ff_deinit(struct hid_device *hdev) { return -1; } -#endif - #endif diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c index a64a35e..dd30772 100644 --- a/drivers/hid/hid-lg4ff.c +++ b/drivers/hid/hid-lg4ff.c @@ -30,6 +30,7 @@ #include "usbhid/usbhid.h" #include "hid-lg.h" +#include "hid-lg4ff.h" #include "hid-ids.h" #define to_hid_device(pdev) container_of(pdev, struct hid_device, dev) @@ -803,7 +804,8 @@ static int lg4ff_handle_multimode_wheel(struct hid_device *hid, u16 *real_produc /* Switch from "Driving Force" mode to native mode automatically. * Otherwise keep the wheel in its current mode */ if (reported_product_id == USB_DEVICE_ID_LOGITECH_WHEEL && - reported_product_id != *real_product_id) { + reported_product_id != *real_product_id && + !lg4ff_no_autoswitch) { const struct lg4ff_compat_mode_switch *s; switch (*real_product_id) { diff --git a/drivers/hid/hid-lg4ff.h b/drivers/hid/hid-lg4ff.h new file mode 100644 index 0000000..5b6a508 --- /dev/null +++ b/drivers/hid/hid-lg4ff.h @@ -0,0 +1,18 @@ +#ifndef __HID_LG4FF_H +#define __HID_LG4FF_H + +#ifdef CONFIG_LOGIWHEELS_FF +extern int lg4ff_no_autoswitch; /* From hid-lg.c */ + +int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field, + struct hid_usage *usage, __s32 value, struct lg_drv_data *drv_data); +int lg4ff_init(struct hid_device *hdev); +int lg4ff_deinit(struct hid_device *hdev); +#else +static inline int lg4ff_adjust_input_event(struct hid_device *hid, struct hid_field *field, + struct hid_usage *usage, __s32 value, struct lg_drv_data *drv_data) { return 0; } +static inline int lg4ff_init(struct hid_device *hdev) { return -1; } +static inline int lg4ff_deinit(struct hid_device *hdev) { return -1; } +#endif + +#endif