diff mbox

[03/12] Input: synaptics - fix minimum reported ABS_TOOL_WIDTH

Message ID 1309324042-22943-4-git-send-email-djkurtz@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Kurtz June 29, 2011, 5:07 a.m. UTC
From: Daniel Kurtz <djkurtz@chromium.org>

Synaptics touchpads report a 'w' value in each data report.
For touchpads that support palm detection, when there is a single finger
on the pad, the 'w' value reports its width in the range 4 to 15.
Thus, the minimum valid width is 4.

Note: Other values of 'w' are used to report special conditions:
 w=0: 2 fingers are on the pad
 w=1: 3 or more fingers are on the pad
 w=2: the packet contains "Advanced Gesture Mode" data.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
---
 drivers/input/mouse/synaptics.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

chris@cnpbagwell.com June 29, 2011, 1:28 p.m. UTC | #1
On Wed, Jun 29, 2011 at 12:07 AM,  <djkurtz@chromium.org> wrote:
> From: Daniel Kurtz <djkurtz@chromium.org>
>
> Synaptics touchpads report a 'w' value in each data report.
> For touchpads that support palm detection, when there is a single finger
> on the pad, the 'w' value reports its width in the range 4 to 15.
> Thus, the minimum valid width is 4.

FYI: I had debated on this as well.  When driver was first modified to
report min/max width, the min width of zero was chosen because when
not touching the pad a value of zero is forced by driver to user.  So
the range is 0, 4-15.

>
> Note: Other values of 'w' are used to report special conditions:
>  w=0: 2 fingers are on the pad
>  w=1: 3 or more fingers are on the pad
>  w=2: the packet contains "Advanced Gesture Mode" data.
>
> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
> ---
>  drivers/input/mouse/synaptics.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index f6d0c04..a4b7801 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -706,7 +706,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
>        }
>
>        if (SYN_CAP_PALMDETECT(priv->capabilities))
> -               input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0);
> +               input_set_abs_params(dev, ABS_TOOL_WIDTH, 4, 15, 0, 0);
>
>        __set_bit(EV_KEY, dev->evbit);
>        __set_bit(BTN_TOUCH, dev->keybit);
> --
> 1.7.3.1
>
> --
> 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
>
--
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
Daniel Kurtz June 29, 2011, 4:48 p.m. UTC | #2
Hi Chris,

Thanks for taking a look!

On Wed, Jun 29, 2011 at 9:28 PM, Chris Bagwell <chris@cnpbagwell.com> wrote:
> On Wed, Jun 29, 2011 at 12:07 AM,  <djkurtz@chromium.org> wrote:
>> From: Daniel Kurtz <djkurtz@chromium.org>
>>
>> Synaptics touchpads report a 'w' value in each data report.
>> For touchpads that support palm detection, when there is a single finger
>> on the pad, the 'w' value reports its width in the range 4 to 15.
>> Thus, the minimum valid width is 4.
>
> FYI: I had debated on this as well.  When driver was first modified to
> report min/max width, the min width of zero was chosen because when
> not touching the pad a value of zero is forced by driver to user.  So
> the range is 0, 4-15.

Yup, good catch.  I now see that this is true for the legacy single-touch case.
For consistency with the existing implementation, I'm ok to drop this patch.

I think we can still keep the range 4-15 for the ABS_MT_TOUCH_MAJOR
axis, though, right?
A pure-mt userspace app can get the correct width range, and deduce 0
fingers from the fact that all MT-B slots have tracking_id == -1.

-Dan

>>
>> Note: Other values of 'w' are used to report special conditions:
>>  w=0: 2 fingers are on the pad
>>  w=1: 3 or more fingers are on the pad
>>  w=2: the packet contains "Advanced Gesture Mode" data.
>>
>> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
>> ---
>>  drivers/input/mouse/synaptics.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
>> index f6d0c04..a4b7801 100644
>> --- a/drivers/input/mouse/synaptics.c
>> +++ b/drivers/input/mouse/synaptics.c
>> @@ -706,7 +706,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
>>        }
>>
>>        if (SYN_CAP_PALMDETECT(priv->capabilities))
>> -               input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0);
>> +               input_set_abs_params(dev, ABS_TOOL_WIDTH, 4, 15, 0, 0);
>>
>>        __set_bit(EV_KEY, dev->evbit);
>>        __set_bit(BTN_TOUCH, dev->keybit);
>> --
>> 1.7.3.1
>>
>> --
>> 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
>>
> --
> 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
>
--
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
chris@cnpbagwell.com June 29, 2011, 7:46 p.m. UTC | #3
On Wed, Jun 29, 2011 at 11:48 AM, Daniel Kurtz <djkurtz@chromium.org> wrote:
> Hi Chris,
>
> Thanks for taking a look!
>
> On Wed, Jun 29, 2011 at 9:28 PM, Chris Bagwell <chris@cnpbagwell.com> wrote:
>> On Wed, Jun 29, 2011 at 12:07 AM,  <djkurtz@chromium.org> wrote:
>>> From: Daniel Kurtz <djkurtz@chromium.org>
>>>
>>> Synaptics touchpads report a 'w' value in each data report.
>>> For touchpads that support palm detection, when there is a single finger
>>> on the pad, the 'w' value reports its width in the range 4 to 15.
>>> Thus, the minimum valid width is 4.
>>
>> FYI: I had debated on this as well.  When driver was first modified to
>> report min/max width, the min width of zero was chosen because when
>> not touching the pad a value of zero is forced by driver to user.  So
>> the range is 0, 4-15.
>
> Yup, good catch.  I now see that this is true for the legacy single-touch case.
> For consistency with the existing implementation, I'm ok to drop this patch.
>
> I think we can still keep the range 4-15 for the ABS_MT_TOUCH_MAJOR
> axis, though, right?
> A pure-mt userspace app can get the correct width range, and deduce 0
> fingers from the fact that all MT-B slots have tracking_id == -1.

Yeah, at least I'd consider it an app bug.

For that matter, it should be true of ABS_TOOL_WIDTH as well (we could
change to always send minimum 4 as apart of this patch).

Since we are on it, maybe a year ago I tested a version of this patch
and notice xf86-input-synaptics defaulted to non-useful value for
EmulateTwoFingerMinW because of the scale change.  The
xf86-input-synaptics logic in question has since be modified/reverted
so I think thats not an issue anymore.

I found no issues with apps see'ing ABS_TOOL_WIDTH >= 4 always.

Chris
>
> -Dan
>
>>>
>>> Note: Other values of 'w' are used to report special conditions:
>>>  w=0: 2 fingers are on the pad
>>>  w=1: 3 or more fingers are on the pad
>>>  w=2: the packet contains "Advanced Gesture Mode" data.
>>>
>>> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
>>> ---
>>>  drivers/input/mouse/synaptics.c |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
>>> index f6d0c04..a4b7801 100644
>>> --- a/drivers/input/mouse/synaptics.c
>>> +++ b/drivers/input/mouse/synaptics.c
>>> @@ -706,7 +706,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
>>>        }
>>>
>>>        if (SYN_CAP_PALMDETECT(priv->capabilities))
>>> -               input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0);
>>> +               input_set_abs_params(dev, ABS_TOOL_WIDTH, 4, 15, 0, 0);
>>>
>>>        __set_bit(EV_KEY, dev->evbit);
>>>        __set_bit(BTN_TOUCH, dev->keybit);
>>> --
>>> 1.7.3.1
>>>
>>> --
>>> 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
>>>
>> --
>> 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
>>
>
--
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
Henrik Rydberg July 4, 2011, 9:14 p.m. UTC | #4
> > Yup, good catch.  I now see that this is true for the legacy single-touch case.
> > For consistency with the existing implementation, I'm ok to drop this patch.

Thank you.

Henrik
--
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
Jeff Brown July 9, 2011, 6:24 a.m. UTC | #5
On Tue, Jun 28, 2011 at 10:07 PM,  <djkurtz@chromium.org> wrote:
> From: Daniel Kurtz <djkurtz@chromium.org>
>
> Synaptics touchpads report a 'w' value in each data report.
> For touchpads that support palm detection, when there is a single finger
> on the pad, the 'w' value reports its width in the range 4 to 15.
> Thus, the minimum valid width is 4.
>
> Note: Other values of 'w' are used to report special conditions:
>  w=0: 2 fingers are on the pad
>  w=1: 3 or more fingers are on the pad
>  w=2: the packet contains "Advanced Gesture Mode" data.

Ideally we should scale this to a physically meaningful quantity
instead, such as surface units.  That would require knowing the
distance between each capacitive touch channel and then scaling W - 4
by that amount before reporting it.

These values are all kind of mysterious to user-space anyways unless
the physical nature of the device is known by other means (such as
configuration files).

Jeff.
--
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
diff mbox

Patch

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index f6d0c04..a4b7801 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -706,7 +706,7 @@  static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
 	}
 
 	if (SYN_CAP_PALMDETECT(priv->capabilities))
-		input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0);
+		input_set_abs_params(dev, ABS_TOOL_WIDTH, 4, 15, 0, 0);
 
 	__set_bit(EV_KEY, dev->evbit);
 	__set_bit(BTN_TOUCH, dev->keybit);