diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-31 21:02:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-31 21:02:39 -0400 |
commit | 09d692e6ff50e455f936e7e114e11f6ec5e0ea33 (patch) | |
tree | f6693dac827dd2afced8285e59bce73d7e04c636 /drivers/input/touchscreen | |
parent | ce9d8d9f7214c7b74a5dd7be8221545269a31155 (diff) | |
parent | d745b5326dd1960bf1d9ce2cb8408561a81a7271 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: appletouch - remove extra KERN_DEBUG use from dprintk
Input: bu21013_ts - fix null dereference in error handling
Input: ad7879 - prevent invalid finger data reports
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r-- | drivers/input/touchscreen/ad7879.c | 32 | ||||
-rw-r--r-- | drivers/input/touchscreen/bu21013_ts.c | 2 |
2 files changed, 28 insertions, 6 deletions
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index ba6f0bd1e76..bc3b5187f3a 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c @@ -129,6 +129,9 @@ struct ad7879 { u16 cmd_crtl1; u16 cmd_crtl2; u16 cmd_crtl3; + int x; + int y; + int Rt; }; static int ad7879_read(struct ad7879 *ts, u8 reg) @@ -175,13 +178,32 @@ static int ad7879_report(struct ad7879 *ts) Rt /= z1; Rt = (Rt + 2047) >> 12; - if (!timer_pending(&ts->timer)) + /* + * Sample found inconsistent, pressure is beyond + * the maximum. Don't report it to user space. + */ + if (Rt > ts->pressure_max) + return -EINVAL; + + /* + * Note that we delay reporting events by one sample. + * This is done to avoid reporting last sample of the + * touch sequence, which may be incomplete if finger + * leaves the surface before last reading is taken. + */ + if (timer_pending(&ts->timer)) { + /* Touch continues */ input_report_key(input_dev, BTN_TOUCH, 1); + input_report_abs(input_dev, ABS_X, ts->x); + input_report_abs(input_dev, ABS_Y, ts->y); + input_report_abs(input_dev, ABS_PRESSURE, ts->Rt); + input_sync(input_dev); + } + + ts->x = x; + ts->y = y; + ts->Rt = Rt; - input_report_abs(input_dev, ABS_X, x); - input_report_abs(input_dev, ABS_Y, y); - input_report_abs(input_dev, ABS_PRESSURE, Rt); - input_sync(input_dev); return 0; } diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index ccde5860256..2ca9e5d6646 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c @@ -514,7 +514,7 @@ err_free_irq: err_cs_disable: pdata->cs_dis(pdata->cs_pin); err_free_mem: - input_free_device(bu21013_data->in_dev); + input_free_device(in_dev); kfree(bu21013_data); return error; |