From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Paul Cercueil <paul@crapouillou.net>
Cc: Peter Hutterer <peter.hutterer@who-t.net>,
Chris Morgan <macroalpha82@gmail.com>,
linux-input@vger.kernel.org, svv@google.com,
biswarupp@google.com, contact@artur-rojek.eu,
Chris Morgan <macromorgan@hotmail.com>
Subject: Re: [PATCH] input: uinput: Drop checks for abs_min > abs_max
Date: Tue, 19 Dec 2023 17:53:15 -0800 [thread overview]
Message-ID: <ZYJJC-ID4SyHhuuA@google.com> (raw)
In-Reply-To: <f77b98bf015bf3f8716422ac70c4fd6051e66376.camel@crapouillou.net>
Hi Paul,
On Wed, Dec 20, 2023 at 01:38:39AM +0100, Paul Cercueil wrote:
> Hi Peter,
>
> Le mercredi 20 décembre 2023 à 09:51 +1000, Peter Hutterer a écrit :
> > On Mon, Dec 18, 2023 at 11:16:53AM -0600, Chris Morgan wrote:
> > > From: Chris Morgan <macromorgan@hotmail.com>
> > >
> > > Stop checking if the minimum abs value is greater than the maximum
> > > abs
> > > value. When the axis is inverted this condition is allowed. Without
> > > relaxing this check, it is not possible to use uinput on devices in
> > > userspace with an inverted axis, such as the adc-joystick found on
> > > many handheld gaming devices.
> >
> > As mentioned in the other thread [1] a fair bit of userspace relies
> > on
> > that general assumption so removing it will likely cause all sorts of
> > issues.
>
> There is some userspace that works with it though, so why restrict it
> artificially?
>
> The fact that some other userspace code wouldn't work with it sounds a
> bit irrelevant. They just never encountered that min>max usage before.
>
> And removing this check won't cause all sort of issues, why would it?
> It's not like the current software actively probes min>max and crash
> badly if it doesn't return -EINVAL...
It will cause weird movements because calculations expect min be the
minimum, and max the maximum, and not encode left/right or up/down.
Putting this into adc joystick binding was a mistake.
This is the definition of absinfo:
/**
* struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls
* @value: latest reported value for the axis.
* @minimum: specifies minimum value for the axis.
* @maximum: specifies maximum value for the axis.
* @fuzz: specifies fuzz value that is used to filter noise from
* the event stream.
* @flat: values that are within this value will be discarded by
* joydev interface and reported as 0 instead.
* @resolution: specifies resolution for the values reported for
* the axis.
*
* Note that input core does not clamp reported values to the
* [minimum, maximum] limits, such task is left to userspace.
...
*/
(We should change wording of the last sentence to "... does not always
clamp ..." since when we do inversion/swap we do clamp values.)
And note that the userspace that can handle swapped min and max will
work fine if the kernel provides normalized data, but other software
will/may not work.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2023-12-20 1:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-18 17:16 [PATCH] input: uinput: Drop checks for abs_min > abs_max Chris Morgan
2023-12-19 23:51 ` Peter Hutterer
2023-12-20 0:38 ` Paul Cercueil
2023-12-20 1:53 ` Dmitry Torokhov [this message]
2023-12-20 13:39 ` Paul Cercueil
2023-12-22 17:09 ` Chris Morgan
2024-01-03 23:22 ` Peter Hutterer
2023-12-23 14:29 ` Hans de Goede
2023-12-23 15:01 ` Paul Cercueil
2023-12-23 15:16 ` Hans de Goede
2023-12-24 8:03 ` Dmitry Torokhov
2023-12-30 5:32 ` Chris Morgan
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=ZYJJC-ID4SyHhuuA@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=biswarupp@google.com \
--cc=contact@artur-rojek.eu \
--cc=linux-input@vger.kernel.org \
--cc=macroalpha82@gmail.com \
--cc=macromorgan@hotmail.com \
--cc=paul@crapouillou.net \
--cc=peter.hutterer@who-t.net \
--cc=svv@google.com \
/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 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.