Re: [PATCH] Input: synaptics - reject out of range position values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 6, 2012 at 11:35 PM, Seth Forshee
<seth.forshee@xxxxxxxxxxxxx> wrote:
> Ping. Any problem with this patch?
>
> On Fri, May 18, 2012 at 10:00:24AM -0500, Seth Forshee wrote:
>> The synaptics touchpad on the Acer Aspire One D250 will report y
>> coordinate values in excess of 8000 near the bottom of the touchpad,
>> well outside of the range of values that the synaptics documentation
>> says should be reported.
>>
>> In addition, the y values abruptly change from very low values to these
>> very high values. After the calculation to invert the y coordinates,
>> userspace gets y coordinates that can jump suddenly between large
>> positive and moderately large negative values, causing sudden jumps in
>> the pointer position.
>>
>> To work around this odd behavior, reject any coordinates with values
>> outside of absolute limits specified by Synaptics, which is 6143 for
>> both axes.
>>
>> BugLink: http://bugs.launchpad.net/bugs/1001251
>> Cc: stable@xxxxxxxxxxxxxxx
>> Signed-off-by: Seth Forshee <seth.forshee@xxxxxxxxxxxxx>
>> ---
>> I'm not sure whether the limits here should be the hard-coded value or
>> the coordinates reported by the device when that's supported (i.e.
>> whether the coordinates reported by the device are always within the
>> range of 0 to 6143). If the latter is more appropriate I can modify the
>> patch to use the device-reported values and fall back to the hard-coded
>> values.

Hi Seth,

The patch seems to do what it says it is doing, but perhaps we can do
a little better?  The problem is, it would make fingers at the bottom
of the pad simply disappear, which may not be a great user experience,
either.

Do you have access to the hardware?
What is the y value reported at the top of the pad?
Also, what are the max & min values reported by your device when queried?
  Do they match the values that are actually reported?

Judging just from your comments, it sounds like the trackpad might be
wrapping around, and trying to report "negative" 13-bit numbers near
the bottom.

0x17FF = 6143
...
0x0000 = 0 = 0
0x1FFF = 8191 = -1
...
0x1F40 = 8000 = -192

Perhaps we can do this for your pad:
 y = (y + 0x0800) & 0x1FFF;

Which would make those negative values positive.

Or, alternatively, we could actually report negative values to
userspace in this case:

y = (y <= 6143) ? y : (y - 8192);

-Daniel

>>
>>  drivers/input/mouse/synaptics.c |    5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
>> index e07eb9b..f62299d 100644
>> --- a/drivers/input/mouse/synaptics.c
>> +++ b/drivers/input/mouse/synaptics.c
>> @@ -40,6 +40,8 @@
>>   * Note that newer firmware allows querying device for maximum useable
>>   * coordinates.
>>   */
>> +#define XMAX 6143
>> +#define YMAX 6143
>>  #define XMIN_NOMINAL 1472
>>  #define XMAX_NOMINAL 5472
>>  #define YMIN_NOMINAL 1408
>> @@ -555,6 +557,9 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
>>               hw->right = (buf[0] & 0x02) ? 1 : 0;
>>       }
>>
>> +     if (hw->x > XMAX || hw->y > YMAX)
>> +             return 1;
>> +
>>       return 0;
>>  }
>>
>> --
>> 1.7.9.5
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-input" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> 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@xxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux