diff mbox series

[v2,12/12] Input: docs: add more details on the use of BTN_TOOL

Message ID 20220203143226.4023622-13-benjamin.tissoires@redhat.com
State Accepted
Commit 42764f97e6ebf1ff518c83e4a36395fddf7a6085
Headers show
Series HID: fix for generic input processing | expand

Commit Message

Benjamin Tissoires Feb. 3, 2022, 2:32 p.m. UTC
The HID core stack used to be very relaxed considering the BTN_TOOL_*
usage. With the recent commits, we should now enforce to have only one
tool at a time, meaning that we can now express that requirement in the
docs.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

---

changes in v2:
- changed to explain that switching tool in one EV_SYN report
  is not nice for userspace
---
 Documentation/input/event-codes.rst | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Peter Hutterer Feb. 16, 2022, 5:40 a.m. UTC | #1
On Thu, Feb 03, 2022 at 03:32:26PM +0100, Benjamin Tissoires wrote:
> The HID core stack used to be very relaxed considering the BTN_TOOL_*
> usage. With the recent commits, we should now enforce to have only one
> tool at a time, meaning that we can now express that requirement in the
> docs.
> 
> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> 
> ---
> 
> changes in v2:
> - changed to explain that switching tool in one EV_SYN report
>   is not nice for userspace
> ---
>  Documentation/input/event-codes.rst | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/input/event-codes.rst b/Documentation/input/event-codes.rst
> index b24ae7d292cc..8741d390b184 100644
> --- a/Documentation/input/event-codes.rst
> +++ b/Documentation/input/event-codes.rst
> @@ -137,7 +137,11 @@ A few EV_KEY codes have special meanings:
>      code should be set to a value of 1. When the tool is no longer interacting
>      with the input device, the BTN_TOOL_<name> code should be reset to 0. All
>      trackpads, tablets, and touchscreens should use at least one BTN_TOOL_<name>
> -    code when events are generated.
> +    code when events are generated. Likewise all trackpads, tablets, and
> +    touchscreens should export only one BTN_TOOL_<name> at a time. To not break

I still think s/export/set to nonzero/ to avoid any ambiguity with setting the
evbit on the device vs setting the value to nonzero here, but the remainder is
good, thanks :)

Acked-by: Peter Hutterer <peter.hutterer@who-t.net>

Cheers,
  Peter


> +    existing userspace, it is recommended to not switch tool in one EV_SYN frame
> +    but first emitting the old BTN_TOOL_<name> at 0, then emit one SYN_REPORT
> +    and then set the new BTN_TOOL_<name> at 1.
>  
>  * BTN_TOUCH:
>  
> -- 
> 2.33.1
>
diff mbox series

Patch

diff --git a/Documentation/input/event-codes.rst b/Documentation/input/event-codes.rst
index b24ae7d292cc..8741d390b184 100644
--- a/Documentation/input/event-codes.rst
+++ b/Documentation/input/event-codes.rst
@@ -137,7 +137,11 @@  A few EV_KEY codes have special meanings:
     code should be set to a value of 1. When the tool is no longer interacting
     with the input device, the BTN_TOOL_<name> code should be reset to 0. All
     trackpads, tablets, and touchscreens should use at least one BTN_TOOL_<name>
-    code when events are generated.
+    code when events are generated. Likewise all trackpads, tablets, and
+    touchscreens should export only one BTN_TOOL_<name> at a time. To not break
+    existing userspace, it is recommended to not switch tool in one EV_SYN frame
+    but first emitting the old BTN_TOOL_<name> at 0, then emit one SYN_REPORT
+    and then set the new BTN_TOOL_<name> at 1.
 
 * BTN_TOUCH: