All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: update documentation for EVIOCGMASK/EVIOCSMASK
@ 2016-04-21  3:18 Peter Hutterer
  2016-04-21  8:09 ` David Herrmann
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Hutterer @ 2016-04-21  3:18 UTC (permalink / raw)
  To: linux-input; +Cc: Dmitry Torokhov, David Herrmann, Benjamin Tissoires

The current implementation does not match the most intuitive reading of the
documentation. The documentation suggests that anything after FOO_CNT would
be reset to zeroes. The implementation however works on long boundaries
instead.

For example, a client requesting the EV_REL mask will see the first 64 bits
set to one in the default mask, everything else is zero. Setting a mask will
apply the mask for the first 64 bits, the others are cleared.

There are few use-cases where this actually matters to a client - if a
device doesn't have the event code anyway the mask doesn't matter. So change
two absolute statements to a "may" to indicate that bits may or may not be
set.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 include/uapi/linux/input.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index 0111384..6069524 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -181,7 +181,7 @@ struct input_mask {
  * The default event mask for a client has all bits set, i.e. all events
  * are forwarded to the client. If the kernel is queried for an unknown
  * event type or if the receive buffer is larger than the number of
- * event codes known to the kernel, the kernel returns all zeroes for those
+ * event codes known to the kernel, the kernel may return zeroes for those
  * codes.
  *
  * At maximum, codes_size bytes are copied.
@@ -204,7 +204,7 @@ struct input_mask {
  * is unknown to the kernel, or if the number of event codes specified in
  * the mask is bigger than what is known to the kernel, the ioctl is still
  * accepted and applied. However, any unknown codes are left untouched and
- * stay cleared. That means, the kernel always filters unknown codes
+ * may be cleared. That means, the kernel always filters unknown codes
  * regardless of what the client requests.  If the new mask doesn't cover
  * all known event-codes, all remaining codes are automatically cleared and
  * thus filtered.
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: update documentation for EVIOCGMASK/EVIOCSMASK
  2016-04-21  3:18 [PATCH] Input: update documentation for EVIOCGMASK/EVIOCSMASK Peter Hutterer
@ 2016-04-21  8:09 ` David Herrmann
  2016-09-05 22:14   ` Peter Hutterer
  0 siblings, 1 reply; 3+ messages in thread
From: David Herrmann @ 2016-04-21  8:09 UTC (permalink / raw)
  To: Peter Hutterer
  Cc: open list:HID CORE LAYER, Dmitry Torokhov, Benjamin Tissoires

Hi

On Thu, Apr 21, 2016 at 5:18 AM, Peter Hutterer
<peter.hutterer@who-t.net> wrote:
> The current implementation does not match the most intuitive reading of the
> documentation. The documentation suggests that anything after FOO_CNT would
> be reset to zeroes. The implementation however works on long boundaries
> instead.
>
> For example, a client requesting the EV_REL mask will see the first 64 bits
> set to one in the default mask, everything else is zero. Setting a mask will
> apply the mask for the first 64 bits, the others are cleared.
>
> There are few use-cases where this actually matters to a client - if a
> device doesn't have the event code anyway the mask doesn't matter. So change
> two absolute statements to a "may" to indicate that bits may or may not be
> set.
>
> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
> ---
>  include/uapi/linux/input.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>

Thanks!
David

> diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
> index 0111384..6069524 100644
> --- a/include/uapi/linux/input.h
> +++ b/include/uapi/linux/input.h
> @@ -181,7 +181,7 @@ struct input_mask {
>   * The default event mask for a client has all bits set, i.e. all events
>   * are forwarded to the client. If the kernel is queried for an unknown
>   * event type or if the receive buffer is larger than the number of
> - * event codes known to the kernel, the kernel returns all zeroes for those
> + * event codes known to the kernel, the kernel may return zeroes for those
>   * codes.
>   *
>   * At maximum, codes_size bytes are copied.
> @@ -204,7 +204,7 @@ struct input_mask {
>   * is unknown to the kernel, or if the number of event codes specified in
>   * the mask is bigger than what is known to the kernel, the ioctl is still
>   * accepted and applied. However, any unknown codes are left untouched and
> - * stay cleared. That means, the kernel always filters unknown codes
> + * may be cleared. That means, the kernel always filters unknown codes
>   * regardless of what the client requests.  If the new mask doesn't cover
>   * all known event-codes, all remaining codes are automatically cleared and
>   * thus filtered.
> --
> 2.7.3
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: update documentation for EVIOCGMASK/EVIOCSMASK
  2016-04-21  8:09 ` David Herrmann
@ 2016-09-05 22:14   ` Peter Hutterer
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Hutterer @ 2016-09-05 22:14 UTC (permalink / raw)
  To: David Herrmann; +Cc: linux-input, Dmitry Torokhov, Benjamin Tissoires

On Thu, Apr 21, 2016 at 10:09:11AM +0200, David Herrmann wrote:
> Hi
> 
> On Thu, Apr 21, 2016 at 5:18 AM, Peter Hutterer
> <peter.hutterer@who-t.net> wrote:
> > The current implementation does not match the most intuitive reading of the
> > documentation. The documentation suggests that anything after FOO_CNT would
> > be reset to zeroes. The implementation however works on long boundaries
> > instead.
> >
> > For example, a client requesting the EV_REL mask will see the first 64 bits
> > set to one in the default mask, everything else is zero. Setting a mask will
> > apply the mask for the first 64 bits, the others are cleared.
> >
> > There are few use-cases where this actually matters to a client - if a
> > device doesn't have the event code anyway the mask doesn't matter. So change
> > two absolute statements to a "may" to indicate that bits may or may not be
> > set.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
> > ---
> >  include/uapi/linux/input.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>

I just found this one on one of my branches. Dmitry, want to merge this one?

Cheers,
   Peter

> 
> Thanks!
> David
> 
> > diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
> > index 0111384..6069524 100644
> > --- a/include/uapi/linux/input.h
> > +++ b/include/uapi/linux/input.h
> > @@ -181,7 +181,7 @@ struct input_mask {
> >   * The default event mask for a client has all bits set, i.e. all events
> >   * are forwarded to the client. If the kernel is queried for an unknown
> >   * event type or if the receive buffer is larger than the number of
> > - * event codes known to the kernel, the kernel returns all zeroes for those
> > + * event codes known to the kernel, the kernel may return zeroes for those
> >   * codes.
> >   *
> >   * At maximum, codes_size bytes are copied.
> > @@ -204,7 +204,7 @@ struct input_mask {
> >   * is unknown to the kernel, or if the number of event codes specified in
> >   * the mask is bigger than what is known to the kernel, the ioctl is still
> >   * accepted and applied. However, any unknown codes are left untouched and
> > - * stay cleared. That means, the kernel always filters unknown codes
> > + * may be cleared. That means, the kernel always filters unknown codes
> >   * regardless of what the client requests.  If the new mask doesn't cover
> >   * all known event-codes, all remaining codes are automatically cleared and
> >   * thus filtered.
> > --
> > 2.7.3
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-05 22:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-21  3:18 [PATCH] Input: update documentation for EVIOCGMASK/EVIOCSMASK Peter Hutterer
2016-04-21  8:09 ` David Herrmann
2016-09-05 22:14   ` Peter Hutterer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.