aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/sur40.c
diff options
context:
space:
mode:
authorFlorian Echtler <floe@butterbrot.org>2017-07-10 13:40:28 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-07-12 17:20:28 -0400
commit4323418d62fefe48ee5019f2c744c918be06ec69 (patch)
tree6b8b227ef35d8db1ad61e54ca3ee67b054f520aa /drivers/input/touchscreen/sur40.c
parent335abaea7a27b8a2dfb1ae4573f25019b5d6f68e (diff)
Input: sur40 - skip all blobs that are not touches
The SUR40 labels all reported blobs as touch, token, or generic blob. Previously, all blobs were reported as touch regardless of type, causing lots of false positives. Present patch fixes this. Signed-off-by: Martin Kaltenbrunner <modin@yuri.at> Signed-off-by: Florian Echtler <floe@butterbrot.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen/sur40.c')
-rw-r--r--drivers/input/touchscreen/sur40.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
index f04adeaa45b3..f16f8358c70a 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -296,20 +296,24 @@ static void sur40_close(struct input_polled_dev *polldev)
296static void sur40_report_blob(struct sur40_blob *blob, struct input_dev *input) 296static void sur40_report_blob(struct sur40_blob *blob, struct input_dev *input)
297{ 297{
298 int wide, major, minor; 298 int wide, major, minor;
299 int bb_size_x, bb_size_y, pos_x, pos_y, ctr_x, ctr_y, slotnum;
299 300
300 int bb_size_x = le16_to_cpu(blob->bb_size_x); 301 if (blob->type != SUR40_TOUCH)
301 int bb_size_y = le16_to_cpu(blob->bb_size_y); 302 return;
302
303 int pos_x = le16_to_cpu(blob->pos_x);
304 int pos_y = le16_to_cpu(blob->pos_y);
305
306 int ctr_x = le16_to_cpu(blob->ctr_x);
307 int ctr_y = le16_to_cpu(blob->ctr_y);
308 303
309 int slotnum = input_mt_get_slot_by_key(input, blob->blob_id); 304 slotnum = input_mt_get_slot_by_key(input, blob->blob_id);
310 if (slotnum < 0 || slotnum >= MAX_CONTACTS) 305 if (slotnum < 0 || slotnum >= MAX_CONTACTS)
311 return; 306 return;
312 307
308 bb_size_x = le16_to_cpu(blob->bb_size_x);
309 bb_size_y = le16_to_cpu(blob->bb_size_y);
310
311 pos_x = le16_to_cpu(blob->pos_x);
312 pos_y = le16_to_cpu(blob->pos_y);
313
314 ctr_x = le16_to_cpu(blob->ctr_x);
315 ctr_y = le16_to_cpu(blob->ctr_y);
316
313 input_mt_slot(input, slotnum); 317 input_mt_slot(input, slotnum);
314 input_mt_report_slot_state(input, MT_TOOL_FINGER, 1); 318 input_mt_report_slot_state(input, MT_TOOL_FINGER, 1);
315 wide = (bb_size_x > bb_size_y); 319 wide = (bb_size_x > bb_size_y);