aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Salisbury <joseph.salisbury@canonical.com>2013-10-16 12:19:40 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-04 13:57:18 -0500
commit5b1c45c29961824f123ae8ed1020db2bd8d072ba (patch)
treeea8d4aac3207009889d3d2dbb2ab73c771d4a40b
parentcb8e5e98aeae9e0d845576f6f59227c9ad8f76ff (diff)
Input: cypress_ps2 - do not consider data bad if palm is detected
commit 5df682b297f6b23ec35615ed7bb50cbb25d25869 upstream. If hardware (or firmware) detects palm on the surface of the device it does not mean that the data packet is bad from the protocol standpoint. Instead of reporting PSMOUSE_BAD_DATA in this case simply threat it as if nothing touches the surface. BugLink: http://bugs.launchpad.net/bugs/1229361 Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com> Tested-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/input/mouse/cypress_ps2.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index f51765fff054..888a81a7ea3d 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -439,7 +439,7 @@ static int cypress_get_finger_count(unsigned char header_byte)
439 case 2: return 5; 439 case 2: return 5;
440 default: 440 default:
441 /* Invalid contact (e.g. palm). Ignore it. */ 441 /* Invalid contact (e.g. palm). Ignore it. */
442 return -1; 442 return 0;
443 } 443 }
444 } 444 }
445 445
@@ -452,17 +452,10 @@ static int cypress_parse_packet(struct psmouse *psmouse,
452{ 452{
453 unsigned char *packet = psmouse->packet; 453 unsigned char *packet = psmouse->packet;
454 unsigned char header_byte = packet[0]; 454 unsigned char header_byte = packet[0];
455 int contact_cnt;
456 455
457 memset(report_data, 0, sizeof(struct cytp_report_data)); 456 memset(report_data, 0, sizeof(struct cytp_report_data));
458 457
459 contact_cnt = cypress_get_finger_count(header_byte); 458 report_data->contact_cnt = cypress_get_finger_count(header_byte);
460
461 if (contact_cnt < 0) /* e.g. palm detect */
462 return -EINVAL;
463
464 report_data->contact_cnt = contact_cnt;
465
466 report_data->tap = (header_byte & ABS_MULTIFINGER_TAP) ? 1 : 0; 459 report_data->tap = (header_byte & ABS_MULTIFINGER_TAP) ? 1 : 0;
467 460
468 if (report_data->contact_cnt == 1) { 461 if (report_data->contact_cnt == 1) {
@@ -535,11 +528,9 @@ static void cypress_process_packet(struct psmouse *psmouse, bool zero_pkt)
535 int slots[CYTP_MAX_MT_SLOTS]; 528 int slots[CYTP_MAX_MT_SLOTS];
536 int n; 529 int n;
537 530
538 if (cypress_parse_packet(psmouse, cytp, &report_data)) 531 cypress_parse_packet(psmouse, cytp, &report_data);
539 return;
540 532
541 n = report_data.contact_cnt; 533 n = report_data.contact_cnt;
542
543 if (n > CYTP_MAX_MT_SLOTS) 534 if (n > CYTP_MAX_MT_SLOTS)
544 n = CYTP_MAX_MT_SLOTS; 535 n = CYTP_MAX_MT_SLOTS;
545 536
@@ -605,10 +596,6 @@ static psmouse_ret_t cypress_validate_byte(struct psmouse *psmouse)
605 return PSMOUSE_BAD_DATA; 596 return PSMOUSE_BAD_DATA;
606 597
607 contact_cnt = cypress_get_finger_count(packet[0]); 598 contact_cnt = cypress_get_finger_count(packet[0]);
608
609 if (contact_cnt < 0)
610 return PSMOUSE_BAD_DATA;
611
612 if (cytp->mode & CYTP_BIT_ABS_NO_PRESSURE) 599 if (cytp->mode & CYTP_BIT_ABS_NO_PRESSURE)
613 cypress_set_packet_size(psmouse, contact_cnt == 2 ? 7 : 4); 600 cypress_set_packet_size(psmouse, contact_cnt == 2 ? 7 : 4);
614 else 601 else