From: David Herrmann <dh.herrmann@gmail.com>
To: Peter Hutterer <peter.hutterer@who-t.net>
Cc: "open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Benjamin Tissoires <benjamin.tissoires@gmail.com>,
Lennart Poettering <lennart@poettering.net>
Subject: Re: [PATCH] Input: evdev - add event-mask API
Date: Tue, 22 Apr 2014 08:31:42 +0200 [thread overview]
Message-ID: <CANq1E4Q=HWPuwE4BAPnLY7Y3qrk4JDcTrMY333af_RR7FSLyPw@mail.gmail.com> (raw)
In-Reply-To: <20140422042947.GB10735@yabbi.redhat.com>
Hi
On Tue, Apr 22, 2014 at 6:29 AM, Peter Hutterer
<peter.hutterer@who-t.net> wrote:
>> +/* requires the buffer lock to be held */
>> +static bool __evdev_is_masked(struct evdev_client *client,
>> + unsigned int type,
>> + unsigned int code)
>> +{
>> + unsigned long *mask;
>> + size_t cnt;
>> +
>> + /* EV_SYN and unknown codes are never masked */
>> + if (!type || type >= EV_CNT)
>
> why not use type == EV_SYN?
You mean instead of "!type"? Yeah, probably easier to read.
>> + return false;
>> +
>> + /* first test whether the type is masked */
>> + mask = client->evmasks[0];
>
> if mask is NULL, you already know it's not mask, you can return early.
Nope. If evmasks[0] is NULL, then no type-mask has been set. That
doesn't mean the given code-mask is NULL.
For instance:
evmasks[0] == NULL
evmasks[EV_KEY][KEY_A] == 0
In that case, the user wants all events but KEY_A (even though
evmasks[0] is NULL).
>> #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
>> #define EVIOCREVOKE _IOW('E', 0x91, int) /* Revoke device access */
>> +#define EVIOCGMASK _IOR('E', 0x92, struct input_mask) /* Get event-masks */
>> +#define EVIOCSMASK _IOW('E', 0x93, struct input_mask) /* Set event-masks */
>
> This is missing from all other ioctls but while you're adding a new one
> anyway: please add documentation on what the ioctl does, the input and
> return value/output expected, side-effects etc. right now, understanding the
> evdev ioctls requires either reading the kernel code or existing user-space
> code, with the usual risk of getting it wrong.
Meh.. I thought no-one will notice.. Clearly, I was wrong. I will add
proper docs in v2.
Thanks a lot!
David
next prev parent reply other threads:[~2014-04-22 6:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-15 22:31 [PATCH] Input: evdev - add event-mask API David Herrmann
2014-04-19 21:16 ` Dmitry Torokhov
2014-04-22 6:25 ` David Herrmann
2014-04-22 4:29 ` Peter Hutterer
2014-04-22 6:31 ` David Herrmann [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-09-03 16:14 David Herrmann
2015-10-08 15:27 ` David Herrmann
2015-10-25 0:17 ` Dmitry Torokhov
2015-10-25 9:00 ` David Herrmann
2015-10-25 21:01 ` Dmitry Torokhov
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='CANq1E4Q=HWPuwE4BAPnLY7Y3qrk4JDcTrMY333af_RR7FSLyPw@mail.gmail.com' \
--to=dh.herrmann@gmail.com \
--cc=benjamin.tissoires@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=lennart@poettering.net \
--cc=linux-input@vger.kernel.org \
--cc=peter.hutterer@who-t.net \
/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).