From patchwork Tue Apr 11 13:29:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 9675299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BC04A600CB for ; Tue, 11 Apr 2017 13:30:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF3242787C for ; Tue, 11 Apr 2017 13:30:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A410528550; Tue, 11 Apr 2017 13:30:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 492B32787C for ; Tue, 11 Apr 2017 13:30:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752791AbdDKNaN (ORCPT ); Tue, 11 Apr 2017 09:30:13 -0400 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:59451 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751966AbdDKNaM (ORCPT ); Tue, 11 Apr 2017 09:30:12 -0400 Received: from localhost (localhost [127.0.0.1]) by osg.samsung.com (Postfix) with ESMTP id 8D958A05ED; Tue, 11 Apr 2017 13:30:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osg.samsung.com X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from osg.samsung.com ([127.0.0.1]) by localhost (s-opensource.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vf-5eMwYVt2T; Tue, 11 Apr 2017 13:30:36 +0000 (UTC) Received: from smtp.s-opensource.com (201.47.150.171.dynamic.adsl.gvt.net.br [201.47.150.171]) by osg.samsung.com (Postfix) with ESMTPSA id CAE2DA05F5; Tue, 11 Apr 2017 13:30:33 +0000 (UTC) Received: from mchehab by smtp.s-opensource.com with local (Exim 4.87) (envelope-from ) id 1cxvrb-00025f-Nt; Tue, 11 Apr 2017 10:29:43 -0300 From: Mauro Carvalho Chehab To: linux-input@vger.kernel.org, Dmitry Torokhov , Benjamin Tissoires , Jiri Kosina Cc: Mauro Carvalho Chehab , Jonathan Corbet , Roderick Colenbrander , Stuart Yoder , "David S. Miller" , Ingo Tuchscherer , Florian Fainelli , Ping Cheng , Hans Verkuil , Kamil Debski , Douglas Anderson , linux-doc@vger.kernel.org Subject: [PATCH v4 3/5] input: add a EV_SW event for ratchet switch Date: Tue, 11 Apr 2017 10:29:40 -0300 Message-Id: X-Mailer: git-send-email 2.9.3 In-Reply-To: <5656f59d7fb0590dd139c5e6b597bd56e823bd94.1491917052.git.mchehab@s-opensource.com> References: <34b4f3e6baedde818516ceb1d009f6568b953345.1491917052.git.mchehab@s-opensource.com> <5656f59d7fb0590dd139c5e6b597bd56e823bd94.1491917052.git.mchehab@s-opensource.com> In-Reply-To: References: Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some mice have a switch on their wheel, allowing to switch between ratchet and free wheel mode. Add support for it. Signed-off-by: Mauro Carvalho Chehab Acked-by: Benjamin Tissoires --- Documentation/input/event-codes.txt | 12 ++++++++++++ include/linux/mod_devicetable.h | 2 +- include/uapi/linux/input-event-codes.h | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Documentation/input/event-codes.txt b/Documentation/input/event-codes.txt index 50352ab5f6d4..5dbd45db9bf6 100644 --- a/Documentation/input/event-codes.txt +++ b/Documentation/input/event-codes.txt @@ -206,6 +206,18 @@ Upon resume, if the switch state is the same as before suspend, then the input subsystem will filter out the duplicate switch state reports. The driver does not need to keep the state of the switch at any time. +A few EV_SW codes have special meanings: + +* SW_RATCHET: + + - Some mice have a special switch for their wheel that allows to change + between free wheel mode and ratchet mode. When the switch is ratchet + mode (ON state), the wheel will offer some resistance for movements. It + may also provide a tactile feedback when scrolled. + + Note that some mice have a ratchet switch that does not generate a + software event. + EV_MSC: ---------- EV_MSC events are used for input and output events that do not fall under other diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index a3e8c572a046..79dd7dbf5442 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -292,7 +292,7 @@ struct pcmcia_device_id { #define INPUT_DEVICE_ID_LED_MAX 0x0f #define INPUT_DEVICE_ID_SND_MAX 0x07 #define INPUT_DEVICE_ID_FF_MAX 0x7f -#define INPUT_DEVICE_ID_SW_MAX 0x0f +#define INPUT_DEVICE_ID_SW_MAX 0x1f #define INPUT_DEVICE_ID_MATCH_BUS 1 #define INPUT_DEVICE_ID_MATCH_VENDOR 2 diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index da48d4079511..da83e231e93d 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -789,7 +789,9 @@ #define SW_LINEIN_INSERT 0x0d /* set = inserted */ #define SW_MUTE_DEVICE 0x0e /* set = device disabled */ #define SW_PEN_INSERTED 0x0f /* set = pen inserted */ -#define SW_MAX 0x0f +#define SW_RATCHET 0x10 /* set = ratchet mode, + unset: free wheel */ +#define SW_MAX 0x1f #define SW_CNT (SW_MAX+1) /*