[PATCH 12/12] Input: synaptics - process finger (<=5) transitions

djkurtz
2011-06-29T05:09:24Z

From: Daniel Kurtz <djkurtz@chromium.org>

T5R2 touchpads track up to 5 fingers, but only report 2.
They introduce a special "TYPE=2" (AGM-CONTACT) packet type that reports
the number of tracked fingers and which finger is reported in the SGM
and AGM packets.

With this new packet type, it is possible to send up to 5 MTB slots to
userspace.

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

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 8b38e08..5f227be 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -647,11 +647,16 @@ static void synaptics_process_hw_state(struct synaptics_data *priv,
new_num_fingers = 1;
else if (sgm->w == 0)
new_num_fingers = 2;
- else if (sgm->w == 1)
- new_num_fingers = 3;
+ else if (sgm->w == 1) {
+ if (agm->finger_count > 3)
+ new_num_fingers = agm->finger_count;
+ else
+ new_num_fingers = 3;
+ }

if (new_num_fingers == 0) {
synaptics_update_slots(priv, 0, 0, 0);
+ synaptics_agm_finger_update(priv, 0, 0, 0);
goto process_mt_data_done;
}

@@ -661,6 +666,7 @@ static void synaptics_process_hw_state(struct synaptics_data *priv,
*/
if (priv->agm_pending && agm->z == 0) {
synaptics_update_slots(priv, 1, 0, 0);
+ synaptics_agm_finger_update(priv, 0, 0, 0);
goto process_mt_data_done;
}

@@ -720,6 +726,11 @@ static void synaptics_process_hw_state(struct synaptics_data *priv,
*/
synaptics_update_slots(priv, 0, 0, 0);
break;
+
+ case 4:
+ case 5:
+ synaptics_update_slots(priv, 1, agm->finger_sgm, 0);
+ break;
}
break;

@@ -761,6 +772,12 @@ static void synaptics_process_hw_state(struct synaptics_data *priv,
*/
synaptics_update_slots(priv, 0, 0, 0);
break;
+
+ case 4:
+ case 5:
+ synaptics_update_slots(priv, 2, agm->finger_sgm,
+ agm->finger_agm);
+ break;
}
break;

@@ -800,8 +817,20 @@ static void synaptics_process_hw_state(struct synaptics_data *priv,
slot_agm = slot_sgm + 2;
synaptics_update_slots(priv, 3, slot_sgm, slot_agm);
break;
+
+ case 4:
+ case 5:
+ synaptics_update_slots(priv, 3, agm->finger_sgm,
+ agm->finger_agm);
+ break;
}
break;
+
+ case 4:
+ case 5:
+ synaptics_update_slots(priv, agm->finger_count, agm->finger_sgm,
+ agm->finger_agm);
+ break;
}

process_mt_data_done:
--
1.7.3.1