input: add a EV_SW event for ratchet switch
PATCH v4 3/5 input: add a EV_SW event for ratchet switch
Hi Dmitry,
Ping.
How do you want to proceed with that?
Regards,
Mauro
Forwarded message:
Date: Sat, 15 Apr 2017 19:50:45 -0300
From: Mauro Carvalho Chehab <[email protected]>
To: Dmitry Torokhov <[email protected]>
Cc: [email protected], Benjamin Tissoires <[email protected]>, Jiri Kosina <[email protected]>, Jonathan Corbet <[email protected]>, Roderick Colenbrander <[email protected]>, Stuart Yoder <[email protected]>, "David S. Miller" <[email protected]>, Ingo Tuchscherer <[email protected]>, Florian Fainelli <[email protected]>, Ping Cheng <[email protected]>, Hans Verkuil <[email protected]>, Kamil Debski <[email protected]>, Douglas Anderson <[email protected]>, [email protected]
Subject: Re: [PATCH v4 3/5] input: add a EV_SW event for ratchet switch
Em Sat, 15 Apr 2017 11:04:36 -0700
Dmitry Torokhov <[email protected]> escreveu:
Quoted 21 lines
Hi Mauro,
Quoted 18 lines · Mauro Carvalho Chehab
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 <[email protected]>--- 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(-)Documentation/input/event-codes.txt +0
-0@@ -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.
Quoted 15 lines
Documentation/input/event-codes.txt Upon resume, if the switch state is the same as before suspend, then the input · line 219
Quoted 11 lines
Documentation/input/event-codes.txt +11
-0+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.So it is still not clear to me why we need the 2 discrete events. Either we key off the behavior off the new REL event, or from switch, but not both.
The two events are independent. Clicking at the Wheel button just sets it to free wheel or back to ratchet mode. It doesn't switch the resolution.
The high resolution events are sent only when userspace sets the mouse to high resolution mode.
I wrote patch series for Solaar with allows switching between low resolution and high resolution modes and controls if the wheel movement is normal or inverted:
https://github.com/pwr/Solaar/pull/351
It uses the hidraw interface to switch between the two modes.
Quoted 5 lines
Also, it is unclear to me if allocating a new event for "hires" wheel is optimal. This still does not solve the question about resolution (how high is "hires" and what to do if Logitech will come out with ultra-high-resolution wheel next year, or if we need to express resolution for other relative events).
How "high" is the resolution can be queried on those devices. Not sure how to report it to userspace, though. Ok, one application could query it via hidraw interface (my Solaar patches do that when solaar is called with the "show" parameter).
Perhaps an ioctl? Or do you have a better idea?
Quoted 34 lines
Thanks.
Quoted 31 lines
Documentation/input/event-codes.txt +1
-0+ EV_MSC: ---------- EV_MSC events are used for input and output events that do not fall under otherinclude/linux/mod_devicetable.h +1
-1@@ -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 2include/uapi/linux/input-event-codes.h +3
-1@@ -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)
Quoted 5 lines
Quoted 4 lines
include/uapi/linux/input-event-codes.h +0
-0/* Signature · 1 line
2.9.3
Thanks,
Mauro
Thanks,
Mauro