From: "Denilson Figueiredo de Sá" <denilsonsa@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Jiri Kosina <jkosina@suse.cz>
Cc: Christoph Fritz <chf.fritz@googlemail.com>,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
linux-usb@vger.kernel.org
Subject: Re: Linux USB HID should ignore values outside Logical Minimum/Maximum range
Date: Fri, 28 Oct 2011 18:40:20 -0200 [thread overview]
Message-ID: <op.v32w1irmdsdv5o@localhost> (raw)
In-Reply-To: <alpine.LNX.2.00.1110281817380.3541@pobox.suse.cz>
On Fri, 28 Oct 2011 14:23:17 -0200, Jiri Kosina <jkosina@suse.cz> wrote:
> On the other hand I feel like just dropping the report on the floor
> should be the proper thing to do.
I'd say not the entire report, but just the invalid fields.
The HID specification (HID1_11.pdf) talks about "Null Values" at the
section 5.10 (page 20).
[quote]
HID class devices support the ability to ignore selected fields in a
report at run-
time. This is accomplished by declaring bit field in a report that is
capable of
containing a range of values larger than those actually generated by the
control. If
the host or the device receives an out-of-range value then the current
value for the
respective control will not be modified.
[/quote]
(sidenote: Why didn't I mention this spec earlier? Because I knew I have
read that information somewhere, but didn't find it again until today.)
> Christoph, how about the (untested at my side yet) patch below? It'd be
> nice if you could test with the device you are seeing the problem with
> and let me know.
I can't test it *right now*, but I can probably test it in a week or two.
> + /* Ignore absolute values that are out of bounds */
> + if ((usage->type == EV_ABS && (value < field->logical_minimum ||
> + value > field->logical_maximum))) {
Given what the HID spec says (as I quoted above), I'd change this
condition to just:
> + if (value < field->logical_minimum ||
> + value > field->logical_maximum) {
On the other hand, HID spec also defines the "Null" bit of Input fields at
page 31. This Null bit seems redundant for me, as (in my understanding)
any value outside the range is automatically a null value. We wouldn't
need a Null bit for that.
Anyway, another solution is to change that condition to something like
this:
> + if ( THIS_INPUT_FIELD_HAS_NULL_BIT_SET &&
> + (value < field->logical_minimum ||
> + value > field->logical_maximum)) {
What do you think?
--
Denilson Figueiredo de Sá
Rio de Janeiro - Brasil
next prev parent reply other threads:[~2011-10-28 20:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-22 11:42 Linux USB HID should ignore values outside Logical Minimum/Maximum range Denilson Figueiredo de Sá
2011-10-24 16:24 ` Chris Friesen
2011-10-24 16:39 ` Denilson Figueiredo de Sá
2011-10-24 20:35 ` Dmitry Torokhov
2011-10-25 4:03 ` Denilson Figueiredo de Sá
2011-10-24 17:09 ` Christoph Fritz
2011-10-24 17:04 ` Denilson Figueiredo de Sá
2011-10-24 20:32 ` Dmitry Torokhov
2011-10-28 16:23 ` Jiri Kosina
2011-10-28 19:27 ` Christoph Fritz
2011-10-28 20:40 ` Denilson Figueiredo de Sá [this message]
2011-10-31 15:24 ` Jiri Kosina
2011-11-02 23:39 ` Denilson Figueiredo de Sá
2011-11-16 14:01 ` Jiri Kosina
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=op.v32w1irmdsdv5o@localhost \
--to=denilsonsa@gmail.com \
--cc=chf.fritz@googlemail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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).