From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: linux-input@vger.kernel.org,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Jiri Kosina <jkosina@suse.cz>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>,
Jonathan Corbet <corbet@lwn.net>,
Roderick Colenbrander <roderick.colenbrander@sony.com>,
Stuart Yoder <stuart.yoder@nxp.com>,
"David S. Miller" <davem@davemloft.net>,
Ingo Tuchscherer <ingo.tuchscherer@linux.vnet.ibm.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Ping Cheng <pinglinux@gmail.com>,
Hans Verkuil <hans.verkuil@cisco.com>,
Kamil Debski <kamil@wypas.org>,
Douglas Anderson <dianders@chromium.org>,
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 [thread overview]
Message-ID: <ac259b5cece918d6f01d45b55fb0135f64f9c6a1.1491917052.git.mchehab@s-opensource.com> (raw)
In-Reply-To: <5656f59d7fb0590dd139c5e6b597bd56e823bd94.1491917052.git.mchehab@s-opensource.com>
In-Reply-To: <cover.1491917052.git.mchehab@s-opensource.com>
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 <mchehab@s-opensource.com>
---
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)
/*
--
2.9.3
next prev parent reply other threads:[~2017-04-11 13:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-11 13:29 [PATCH v4 0/5] add support for high res wheel found on some Logitech devices Mauro Carvalho Chehab
2017-04-11 13:29 ` [PATCH v4 1/5] input: event-codes: reserve some space for REL_MISC events Mauro Carvalho Chehab
2017-04-11 13:29 ` [PATCH v4 2/5] input: add an EV_REL event for high-res vertical wheel Mauro Carvalho Chehab
2017-04-11 13:29 ` Mauro Carvalho Chehab [this message]
2017-04-11 13:29 ` [PATCH v4 4/5] hid-logitech-hidpp: add support for high res wheel Mauro Carvalho Chehab
2017-04-11 13:29 ` [PATCH v4 5/5] hid-logitech-hidpp: add support for ratchet switch Mauro Carvalho Chehab
2017-04-14 12:56 ` Benjamin Tissoires
2017-04-14 12:54 ` [PATCH v4 3/5] input: add a EV_SW event " Benjamin Tissoires
2017-04-15 18:04 ` Dmitry Torokhov
2017-04-15 22:50 ` Mauro Carvalho Chehab
2017-04-15 17:55 ` [PATCH v4 1/5] input: event-codes: reserve some space for REL_MISC events Dmitry Torokhov
2017-06-21 12:05 ` Benjamin Tissoires
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=ac259b5cece918d6f01d45b55fb0135f64f9c6a1.1491917052.git.mchehab@s-opensource.com \
--to=mchehab@s-opensource.com \
--cc=benjamin.tissoires@redhat.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=dianders@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=hans.verkuil@cisco.com \
--cc=ingo.tuchscherer@linux.vnet.ibm.com \
--cc=jkosina@suse.cz \
--cc=kamil@wypas.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=pinglinux@gmail.com \
--cc=roderick.colenbrander@sony.com \
--cc=stuart.yoder@nxp.com \
/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).