Re: [PATCH v4] Input: synaptics - use firmware data for Cr-48

From: Henrik Rydberg
Date: Wed Feb 20 2013 - 16:53:53 EST

Hi Chung-yih,

> The profile sensor clickpad in a Cr-48 Chromebook does a reasonable job of
> tracking individual fingers. This tracking isn't perfect, but, experiments
> show that it works better than just passing "semi-mt" data to userspace,
> and making userspace try to deduce where the fingers are given a bounding box.
> This patch tries to report two-finger positions directly from firmware's sgm
> and agm packets instead of the {(min_x, min_y), (max_x, max_y)} for profile
> sensor clickpads on Cr-48 chromebooks. Note that this device's firmware always
> reports the higher (smaller y) finger in the "sgm" packet, and the lower
> (larger y) finger in the "agm" packet for the state transition from one finger
> to two finger. Then the firmware keeps tracking of fingers with the same agm
> or sgm packets individually. Thus, when a new finger arrives on the pad, the
> kernel driver uses a simple Euclidean distance measure to deduce which of the
> two new fingers should keep the tracking ID of the previous single finger.
> Similarly, when one finger is removed, the same measure is used to determine
> which finger remained on the pad.
> Signed-off-by: Chung-yih Wang <cywang@xxxxxxxxxxxx>
> ---
> drivers/input/mouse/synaptics.c | 95 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 95 insertions(+)

I looks right per se, but the procedure is a bit more manual than it
needs to be. The input core can handle slot allocation these days, so
I wonder if the the two patches below work for you, as an