From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Chris Morgan <macroalpha82@gmail.com>
Cc: linux-input@vger.kernel.org, contact@artur-rojek.eu,
hdegoede@redhat.com, paul@crapouillou.net,
peter.hutterer@who-t.net, svv@google.com, biswarupp@google.com,
Chris Morgan <macromorgan@hotmail.com>
Subject: Re: [PATCH v3] Input: adc-joystick: Handle inverted axes
Date: Sat, 20 Jan 2024 01:10:18 -0800 [thread overview]
Message-ID: <ZauN-gBsIPO0AyGE@google.com> (raw)
In-Reply-To: <ZaozAsSblybdoeEK@google.com>
On Fri, Jan 19, 2024 at 12:29:54AM -0800, Dmitry Torokhov wrote:
> Hi Chris,
>
> On Mon, Jan 15, 2024 at 01:27:52PM -0600, Chris Morgan wrote:
> >
> > +static int adc_joystick_invert(struct input_dev *dev,
> > + unsigned int axis, int val)
> > +{
> > + int min = dev->absinfo[axis].minimum;
> > + int max = dev->absinfo[axis].maximum;
>
> I changed this to input_abs_get_[min|max](dev, axis) to avoid peeking
> into absinfo and applied.
Apparently min_array() and max_array() are a bit too new. Also I am not
sure if they are actually needed. Can we do it like this:
diff --git a/drivers/input/joystick/adc-joystick.c b/drivers/input/joystick/adc-joystick.c
index 10ee13465cfe..916e78e4dc9f 100644
--- a/drivers/input/joystick/adc-joystick.c
+++ b/drivers/input/joystick/adc-joystick.c
@@ -185,14 +185,14 @@ static int adc_joystick_set_axes(struct device *dev, struct adc_joystick *joy)
if (axes[i].range[0] > axes[i].range[1]) {
dev_dbg(dev, "abs-axis %d inverted\n", i);
axes[i].inverted = true;
+ swap(axes[i].range[0], axes[i].range[1]);
}
fwnode_property_read_u32(child, "abs-fuzz", &axes[i].fuzz);
fwnode_property_read_u32(child, "abs-flat", &axes[i].flat);
input_set_abs_params(joy->input, axes[i].code,
- min_array(axes[i].range, 2),
- max_array(axes[i].range, 2),
+ axes[i].range[0], axes[i].range[1],
axes[i].fuzz, axes[i].flat);
input_set_capability(joy->input, EV_ABS, axes[i].code);
}
Thanks.
--
Dmitry
next prev parent reply other threads:[~2024-01-20 9:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-15 19:27 [PATCH v3] Input: adc-joystick: Handle inverted axes Chris Morgan
2024-01-19 8:29 ` Dmitry Torokhov
2024-01-20 9:10 ` Dmitry Torokhov [this message]
2024-06-07 19:31 ` 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=ZauN-gBsIPO0AyGE@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=biswarupp@google.com \
--cc=contact@artur-rojek.eu \
--cc=hdegoede@redhat.com \
--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.