From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Hans de Goede <hdegoede@redhat.com>,
Lyude Paul <lyude@redhat.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/7] Input: psmouse - clean up code
Date: Mon, 25 Jun 2018 11:52:09 -0700 [thread overview]
Message-ID: <20180625185209.GA136115@dtor-ws> (raw)
In-Reply-To: <e8ad7e61-342a-8d53-7de1-f30a58c91975@suse.cz>
On Mon, Jun 25, 2018 at 08:35:14PM +0200, Jiri Slaby wrote:
> On 01/20/2018, 12:06 AM, Dmitry Torokhov wrote:
> > - switch to using BIT() macros
> > - use u8 instead of unsigned char for byte data
> > - use input_set_capability() instead of manipulating capabilities bits
> > directly
> > - use sign_extend32() when extracting wheel data.
> > - do not abuse -1 as error code, propagate errors from various calls.
> …
> > --- a/drivers/input/mouse/psmouse-base.c
> > +++ b/drivers/input/mouse/psmouse-base.c
> …
> > @@ -157,39 +159,42 @@ psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse)
> …
> > case 0x00:
> > case 0xC0:
> > - input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 8) - (int) (packet[3] & 7));
> > - input_report_key(dev, BTN_SIDE, (packet[3] >> 4) & 1);
> > - input_report_key(dev, BTN_EXTRA, (packet[3] >> 5) & 1);
> > + input_report_rel(dev, REL_WHEEL,
> > + -sign_extend32(packet[3], 3));
> > + input_report_key(dev, BTN_SIDE, BIT(4));
> > + input_report_key(dev, BTN_EXTRA, BIT(5));
> > break;
> > }
> > break;
> >
> > case PSMOUSE_GENPS:
> > /* Report scroll buttons on NetMice */
> > - input_report_rel(dev, REL_WHEEL, -(signed char) packet[3]);
> > + input_report_rel(dev, REL_WHEEL, -(s8) packet[3]);
> >
> > /* Extra buttons on Genius NewNet 3D */
> > - input_report_key(dev, BTN_SIDE, (packet[0] >> 6) & 1);
> > - input_report_key(dev, BTN_EXTRA, (packet[0] >> 7) & 1);
> > + input_report_key(dev, BTN_SIDE, BIT(6));
> > + input_report_key(dev, BTN_EXTRA, BIT(7));
> > break;
> >
> > case PSMOUSE_THINKPS:
> > /* Extra button on ThinkingMouse */
> > - input_report_key(dev, BTN_EXTRA, (packet[0] >> 3) & 1);
> > + input_report_key(dev, BTN_EXTRA, BIT(3));
>
> While hunting a 4.17 bug where some openSUSE users lost their ability to
> mouse-click, I came across this commit. Putting aside it's a total mess
> of multiple changes, were these changes above intentional at all? I mean
> changing
> (packet[0] >> 3) & 1
> to hardwired
> BIT(3)
> does not look quite right. And if it is for some to me unknown reason,
> it should have been properly documented in the commit log. I believe
> your intent was:
> packet[0] & BIT(3)
> ?
Yes, that was, I am not sure what I was thinking; I'll fix that up.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2018-06-25 18:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-19 23:06 [PATCH 0/7] psmouse assorted cleanups Dmitry Torokhov
2018-01-19 23:06 ` [PATCH 1/7] Input: psmouse - create helper for reporting standard buttons/motion Dmitry Torokhov
2018-01-19 23:06 ` [PATCH 2/7] Input: psmouse - clean up code Dmitry Torokhov
2018-06-25 18:35 ` Jiri Slaby
2018-06-25 18:52 ` Dmitry Torokhov [this message]
2018-01-19 23:06 ` [PATCH 3/7] Input: logips2pp " Dmitry Torokhov
2018-01-19 23:06 ` [PATCH 4/7] Input: lifebook " Dmitry Torokhov
2018-01-19 23:06 ` [PATCH 5/7] Input: psmouse - add support for 2nd wheel on A4Tech Dual-Scroll wheel mice Dmitry Torokhov
[not found] ` <CAAZ5spDzNfrosHfCYFtPcQ2bZiE5iSn8Ac40yNNHR-mdjzt83w@mail.gmail.com>
2018-01-22 18:39 ` Dmitry Torokhov
2018-01-19 23:06 ` [PATCH 6/7] Input: synaptics - switch to using input_set_capability Dmitry Torokhov
2018-01-19 23:06 ` [PATCH 7/7] Input: synaptics - handle errors from input_mt_init_slots() 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=20180625185209.GA136115@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=hdegoede@redhat.com \
--cc=jslaby@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.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 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).