diff mbox series

[2/2] HID: wacom: Don't report anything prior to the tool entering range

Message ID 20190426163531.9782-1-jason.gerecke@wacom.com (mailing list archive)
State Mainlined
Delegated to: Jiri Kosina
Headers show
Series [1/2] HID: wacom: Don't set tool type until we're in range | expand

Commit Message

Gerecke, Jason April 26, 2019, 4:35 p.m. UTC
From: Jason Gerecke <jason.gerecke@wacom.com>

If the tool spends some time in prox before entering range, a series of
events (e.g. ABS_DISTANCE, MSC_SERIAL) can be sent before we or userspace
have any clue about the pen whose data is being reported. We need to hold
off on reporting anything until the pen has entered range. Since we still
want to report events that occur "in prox" after the pen has *left* range
we use 'wacom-tool[0]' as the indicator that the pen did at one point
enter range and provide us/userspace with tool type and serial number
information.

Fixes: a48324de6d ("HID: wacom: Bluetooth IRQ for Intuos Pro should handle prox/range")
Cc: <stable@vger.kernel.org> # 4.11+
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Aaron Armstrong Skomra <aaron.skomra@wacom.com>
---
Version of patch specifically targeted to stable v4.14.113

 drivers/hid/wacom_wac.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

Comments

Gerecke, Jason June 11, 2019, 7:02 p.m. UTC | #1
I haven't been keeping a close eye on this and just noticed that this
patch set doesn't seem to have been merged into stable. There's also a
second patch series (beginning with "[PATCH 1/3] HID: wacom: Send
BTN_TOUCH in response to INTUOSP2_BT eraser contact") that hasn't seen
any stable activity either.

Any idea what's up?

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one  /
(That is to say, eight) to the two,     /
But you can’t take seven from three,    /
So you look at the sixty-fours....
On Fri, Apr 26, 2019 at 9:35 AM Gerecke, Jason <killertofu@gmail.com> wrote:
>
> From: Jason Gerecke <jason.gerecke@wacom.com>
>
> If the tool spends some time in prox before entering range, a series of
> events (e.g. ABS_DISTANCE, MSC_SERIAL) can be sent before we or userspace
> have any clue about the pen whose data is being reported. We need to hold
> off on reporting anything until the pen has entered range. Since we still
> want to report events that occur "in prox" after the pen has *left* range
> we use 'wacom-tool[0]' as the indicator that the pen did at one point
> enter range and provide us/userspace with tool type and serial number
> information.
>
> Fixes: a48324de6d ("HID: wacom: Bluetooth IRQ for Intuos Pro should handle prox/range")
> Cc: <stable@vger.kernel.org> # 4.11+
> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
> Reviewed-by: Aaron Armstrong Skomra <aaron.skomra@wacom.com>
> ---
> Version of patch specifically targeted to stable v4.14.113
>
>  drivers/hid/wacom_wac.c | 21 ++++++++++++---------
>  1 file changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index 03b04bc742dd..e4aeffa56018 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -1271,17 +1271,20 @@ static void wacom_intuos_pro2_bt_pen(struct wacom_wac *wacom)
>                         input_report_abs(pen_input, ABS_Z, rotation);
>                         input_report_abs(pen_input, ABS_WHEEL, get_unaligned_le16(&frame[11]));
>                 }
> -               input_report_abs(pen_input, ABS_PRESSURE, get_unaligned_le16(&frame[5]));
> -               input_report_abs(pen_input, ABS_DISTANCE, range ? frame[13] : wacom->features.distance_max);
>
> -               input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x01);
> -               input_report_key(pen_input, BTN_STYLUS, frame[0] & 0x02);
> -               input_report_key(pen_input, BTN_STYLUS2, frame[0] & 0x04);
> +               if (wacom->tool[0]) {
> +                       input_report_abs(pen_input, ABS_PRESSURE, get_unaligned_le16(&frame[5]));
> +                       input_report_abs(pen_input, ABS_DISTANCE, range ? frame[13] : wacom->features.distance_max);
>
> -               input_report_key(pen_input, wacom->tool[0], prox);
> -               input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]);
> -               input_report_abs(pen_input, ABS_MISC,
> -                                wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */
> +                       input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x01);
> +                       input_report_key(pen_input, BTN_STYLUS, frame[0] & 0x02);
> +                       input_report_key(pen_input, BTN_STYLUS2, frame[0] & 0x04);
> +
> +                       input_report_key(pen_input, wacom->tool[0], prox);
> +                       input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]);
> +                       input_report_abs(pen_input, ABS_MISC,
> +                                        wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */
> +               }
>
>                 wacom->shared->stylus_in_proximity = prox;
>
> --
> 2.21.0
>
Greg KH June 11, 2019, 7:22 p.m. UTC | #2
On Tue, Jun 11, 2019 at 12:02:47PM -0700, Jason Gerecke wrote:
> I haven't been keeping a close eye on this and just noticed that this
> patch set doesn't seem to have been merged into stable. There's also a
> second patch series (beginning with "[PATCH 1/3] HID: wacom: Send
> BTN_TOUCH in response to INTUOSP2_BT eraser contact") that hasn't seen
> any stable activity either.
> 
> Any idea what's up?

I don't see these in my queue at all.

What is the git commit id of these patches in Linus's tree?

thanks,

greg k-h
Gerecke, Jason June 11, 2019, 8:45 p.m. UTC | #3
On Tue, Jun 11, 2019 at 12:22 PM Greg KH <greg@kroah.com> wrote:
>
> On Tue, Jun 11, 2019 at 12:02:47PM -0700, Jason Gerecke wrote:
> > I haven't been keeping a close eye on this and just noticed that this
> > patch set doesn't seem to have been merged into stable. There's also a
> > second patch series (beginning with "[PATCH 1/3] HID: wacom: Send
> > BTN_TOUCH in response to INTUOSP2_BT eraser contact") that hasn't seen
> > any stable activity either.
> >
> > Any idea what's up?
>
> I don't see these in my queue at all.
>
> What is the git commit id of these patches in Linus's tree?
>
> thanks,
>
> greg k-h

Ah, looks like the HID tree's "for-5.2/fixes" branch hasn't been
pulled yet. That could explain things.

69dbdfffef20c715df9f381b2cee4e9e0a4efd93 HID: wacom: Sync INTUOSP2_BT
touch state after each frame if necessary
6441fc781c344df61402be1fde582c4491fa35fa HID: wacom: Correct button
numbering 2nd-gen Intuos Pro over Bluetooth
fe7f8d73d1af19b678171170e4e5384deb57833d HID: wacom: Send BTN_TOUCH in
response to INTUOSP2_BT eraser contact
e92a7be7fe5b2510fa60965eaf25f9e3dc08b8cc HID: wacom: Don't report
anything prior to the tool entering range
2cc08800a6b9fcda7c7afbcf2da1a6e8808da725 HID: wacom: Don't set tool
type until we're in range

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one  /
(That is to say, eight) to the two,     /
But you can’t take seven from three,    /
So you look at the sixty-fours....
Greg KH June 12, 2019, 7:10 a.m. UTC | #4
On Tue, Jun 11, 2019 at 01:45:36PM -0700, Jason Gerecke wrote:
> On Tue, Jun 11, 2019 at 12:22 PM Greg KH <greg@kroah.com> wrote:
> >
> > On Tue, Jun 11, 2019 at 12:02:47PM -0700, Jason Gerecke wrote:
> > > I haven't been keeping a close eye on this and just noticed that this
> > > patch set doesn't seem to have been merged into stable. There's also a
> > > second patch series (beginning with "[PATCH 1/3] HID: wacom: Send
> > > BTN_TOUCH in response to INTUOSP2_BT eraser contact") that hasn't seen
> > > any stable activity either.
> > >
> > > Any idea what's up?
> >
> > I don't see these in my queue at all.
> >
> > What is the git commit id of these patches in Linus's tree?
> >
> > thanks,
> >
> > greg k-h
> 
> Ah, looks like the HID tree's "for-5.2/fixes" branch hasn't been
> pulled yet. That could explain things.
> 
> 69dbdfffef20c715df9f381b2cee4e9e0a4efd93 HID: wacom: Sync INTUOSP2_BT
> touch state after each frame if necessary
> 6441fc781c344df61402be1fde582c4491fa35fa HID: wacom: Correct button
> numbering 2nd-gen Intuos Pro over Bluetooth
> fe7f8d73d1af19b678171170e4e5384deb57833d HID: wacom: Send BTN_TOUCH in
> response to INTUOSP2_BT eraser contact
> e92a7be7fe5b2510fa60965eaf25f9e3dc08b8cc HID: wacom: Don't report
> anything prior to the tool entering range
> 2cc08800a6b9fcda7c7afbcf2da1a6e8808da725 HID: wacom: Don't set tool
> type until we're in range

There is nothing I can do until the patches are in Linus's tree, sorry.

greg k-h
Greg KH June 15, 2019, 3:32 p.m. UTC | #5
On Wed, Jun 12, 2019 at 09:10:42AM +0200, Greg KH wrote:
> On Tue, Jun 11, 2019 at 01:45:36PM -0700, Jason Gerecke wrote:
> > On Tue, Jun 11, 2019 at 12:22 PM Greg KH <greg@kroah.com> wrote:
> > >
> > > On Tue, Jun 11, 2019 at 12:02:47PM -0700, Jason Gerecke wrote:
> > > > I haven't been keeping a close eye on this and just noticed that this
> > > > patch set doesn't seem to have been merged into stable. There's also a
> > > > second patch series (beginning with "[PATCH 1/3] HID: wacom: Send
> > > > BTN_TOUCH in response to INTUOSP2_BT eraser contact") that hasn't seen
> > > > any stable activity either.
> > > >
> > > > Any idea what's up?
> > >
> > > I don't see these in my queue at all.
> > >
> > > What is the git commit id of these patches in Linus's tree?
> > >
> > > thanks,
> > >
> > > greg k-h
> > 
> > Ah, looks like the HID tree's "for-5.2/fixes" branch hasn't been
> > pulled yet. That could explain things.
> > 
> > 69dbdfffef20c715df9f381b2cee4e9e0a4efd93 HID: wacom: Sync INTUOSP2_BT
> > touch state after each frame if necessary
> > 6441fc781c344df61402be1fde582c4491fa35fa HID: wacom: Correct button
> > numbering 2nd-gen Intuos Pro over Bluetooth
> > fe7f8d73d1af19b678171170e4e5384deb57833d HID: wacom: Send BTN_TOUCH in
> > response to INTUOSP2_BT eraser contact
> > e92a7be7fe5b2510fa60965eaf25f9e3dc08b8cc HID: wacom: Don't report
> > anything prior to the tool entering range
> > 2cc08800a6b9fcda7c7afbcf2da1a6e8808da725 HID: wacom: Don't set tool
> > type until we're in range
> 
> There is nothing I can do until the patches are in Linus's tree, sorry.

Now applied for the ones that I could, you should have some "FAILED"
emails for the rejects that did not apply to 4.14.y

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 03b04bc742dd..e4aeffa56018 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1271,17 +1271,20 @@  static void wacom_intuos_pro2_bt_pen(struct wacom_wac *wacom)
 			input_report_abs(pen_input, ABS_Z, rotation);
 			input_report_abs(pen_input, ABS_WHEEL, get_unaligned_le16(&frame[11]));
 		}
-		input_report_abs(pen_input, ABS_PRESSURE, get_unaligned_le16(&frame[5]));
-		input_report_abs(pen_input, ABS_DISTANCE, range ? frame[13] : wacom->features.distance_max);
 
-		input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x01);
-		input_report_key(pen_input, BTN_STYLUS, frame[0] & 0x02);
-		input_report_key(pen_input, BTN_STYLUS2, frame[0] & 0x04);
+		if (wacom->tool[0]) {
+			input_report_abs(pen_input, ABS_PRESSURE, get_unaligned_le16(&frame[5]));
+			input_report_abs(pen_input, ABS_DISTANCE, range ? frame[13] : wacom->features.distance_max);
 
-		input_report_key(pen_input, wacom->tool[0], prox);
-		input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]);
-		input_report_abs(pen_input, ABS_MISC,
-				 wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */
+			input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x01);
+			input_report_key(pen_input, BTN_STYLUS, frame[0] & 0x02);
+			input_report_key(pen_input, BTN_STYLUS2, frame[0] & 0x04);
+
+			input_report_key(pen_input, wacom->tool[0], prox);
+			input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]);
+			input_report_abs(pen_input, ABS_MISC,
+					 wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */
+		}
 
 		wacom->shared->stylus_in_proximity = prox;