All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gerecke <killertofu@gmail.com>
To: Ping Cheng <pinglinux@gmail.com>,
	benjamin.tissoires@gmail.com, jkosina@suse.cz
Cc: linux-input@vger.kernel.org, Ping Cheng <pingc@wacom.com>
Subject: Re: [PATCH 3/3] HID: wacom: set stylus_in_proximity before checking touch_down
Date: Wed, 01 Apr 2015 11:59:52 -0700	[thread overview]
Message-ID: <551C4028.5010605@gmail.com> (raw)
In-Reply-To: <1426888681-8755-1-git-send-email-pingc@wacom.com>

On 3/20/2015 2:58 PM, Ping Cheng wrote:
> In wacom_bpt_pen, we checked touch_down before assigning new
> stylus_in_proximity value. This would cause stylus_in_proximity
> not updated properly if touch is down before pen is in proximity.
>
> Signed-off-by: Ping Cheng <pingc@wacom.com>
> ---
>   drivers/hid/wacom_wac.c | 35 ++++++++++++++++-------------------
>   1 file changed, 16 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index 60d9ccb..63e767e 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c
> @@ -1752,9 +1752,6 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
>   		return 0;
>   	}
>
> -	if (wacom->shared->touch_down)
> -		return 0;
> -
>   	prox = (data[1] & 0x20) == 0x20;
>
>   	/*
> @@ -1767,17 +1764,21 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
>   	 *
>   	 * Hardware does report zero in most out-of-prox cases but not all.
>   	 */
> -	if (prox) {
> -		if (!wacom->shared->stylus_in_proximity) {
> -			if (data[1] & 0x08) {
> -				wacom->tool[0] = BTN_TOOL_RUBBER;
> -				wacom->id[0] = ERASER_DEVICE_ID;
> -			} else {
> -				wacom->tool[0] = BTN_TOOL_PEN;
> -				wacom->id[0] = STYLUS_DEVICE_ID;
> -			}
> -			wacom->shared->stylus_in_proximity = true;
> +	if (!wacom->shared->stylus_in_proximity) {
> +		if (data[1] & 0x08) {
> +			wacom->tool[0] = BTN_TOOL_RUBBER;
> +			wacom->id[0] = ERASER_DEVICE_ID;
> +		} else {
> +			wacom->tool[0] = BTN_TOOL_PEN;
> +			wacom->id[0] = STYLUS_DEVICE_ID;
>   		}
> +	}
> +
> +	wacom->shared->stylus_in_proximity = prox;
> +	if (wacom->shared->touch_down)
> +		return 0;
> +
> +	if (prox) {
>   		x = le16_to_cpup((__le16 *)&data[2]);
>   		y = le16_to_cpup((__le16 *)&data[4]);
>   		p = le16_to_cpup((__le16 *)&data[6]);
> @@ -1793,7 +1794,8 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
>   		pen = data[1] & 0x01;
>   		btn1 = data[1] & 0x02;
>   		btn2 = data[1] & 0x04;
> -	}
> +	} else
> +		wacom->id[0] = 0;

Nitpick: Add braces around this final block. Otherwise:

Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>

---
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....

>
>   	input_report_key(input, BTN_TOUCH, pen);
>   	input_report_key(input, BTN_STYLUS, btn1);
> @@ -1804,11 +1806,6 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
>   	input_report_abs(input, ABS_PRESSURE, p);
>   	input_report_abs(input, ABS_DISTANCE, d);
>
> -	if (!prox) {
> -		wacom->id[0] = 0;
> -		wacom->shared->stylus_in_proximity = false;
> -	}
> -
>   	input_report_key(input, wacom->tool[0], prox); /* PEN or RUBBER */
>   	input_report_abs(input, ABS_MISC, wacom->id[0]); /* TOOL ID */
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2015-04-01 18:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 21:58 [PATCH 3/3] HID: wacom: set stylus_in_proximity before checking touch_down Ping Cheng
2015-04-01 18:59 ` Jason Gerecke [this message]

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=551C4028.5010605@gmail.com \
    --to=killertofu@gmail.com \
    --cc=benjamin.tissoires@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=pingc@wacom.com \
    --cc=pinglinux@gmail.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.