From: Chase Douglas <chase.douglas@canonical.com>
To: djkurtz@chromium.org
Cc: dmitry.torokhov@gmail.com, rydberg@euromail.se,
rubini@cvml.unipv.it, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, derek.foreman@collabora.co.uk,
daniel.stone@collabora.co.uk, olofj@chromium.org
Subject: Re: [PATCH 10/12] Input: synaptics - decode AGM packet types
Date: Tue, 05 Jul 2011 11:17:55 -0700 [thread overview]
Message-ID: <4E135553.3000408@canonical.com> (raw)
In-Reply-To: <1309324042-22943-11-git-send-email-djkurtz@chromium.org>
On 06/28/2011 10:07 PM, djkurtz@chromium.org wrote:
> From: Daniel Kurtz <djkurtz@chromium.org>
>
> A Synaptics image sensor tracks 5 fingers, but can only report 2.
> This behavior is called "T5R2" = Track 5 Report 2
>
> Algorithm for choosing which 2 fingers to report in which packet:
> Touchpad maintains 5 slots, numbered 0 to 4.
> Initially all slots are empty.
> As new fingers are detected, they are assigned the lowest available
> slot.
> Touchpad always reports:
> SGM: lowest numbered non-empty slot
> AGM: highest numbered non-empty slot, if there is one.
>
> In addition, T5R2 touchpads have a special AGM packet type which reports
> the number of fingers currently being tracked, and which finger is in
> each of the two slots. Unfortunately, these "TYPE=2" packets are only used
> when more than 3 fingers are being tracked. When less than 4 fingers
> are present, the 'w' value must be used to track how many fingers are
> present, and knowing which fingers are being reported is much more
> difficult, if not impossible.
>
> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
> ---
> drivers/input/mouse/synaptics.c | 39 ++++++++++++++++++++++++++++++++++-----
> drivers/input/mouse/synaptics.h | 7 ++++++-
> include/linux/input.h | 1 +
> 3 files changed, 41 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
> index 2d7ac0a..19a9b7f 100644
> --- a/drivers/input/mouse/synaptics.c
> +++ b/drivers/input/mouse/synaptics.c
> @@ -401,6 +401,14 @@ static void synaptics_pt_create(struct psmouse *psmouse)
> /*****************************************************************************
> * Functions to interpret the absolute mode packets
> ****************************************************************************/
> +/* Set AGM-CONTACT finger state */
> +static void synaptics_agm_finger_update(struct synaptics_data *priv, int count,
> + int sgm, int agm)
> +{
> + priv->agm.finger_count = count;
> + priv->agm.finger_sgm = sgm;
> + priv->agm.finger_agm = agm;
> +}
>
> static int synaptics_parse_hw_state(const unsigned char buf[],
> struct synaptics_data *priv,
> @@ -438,11 +446,31 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
> if ((SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)
> || SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c))
> && hw->w == 2) {
> - /* Gesture packet: (x, y, z) at half resolution */
> - priv->agm.x = (((buf[4] & 0x0f) << 8) | buf[1]) << 1;
> - priv->agm.y = INVERT_Y((((buf[4] & 0xf0) << 4)
> - | buf[2]) << 1);
> - priv->agm.z = ((buf[3] & 0x30) | (buf[5] & 0x0f)) << 1;
> + int type; /* Packet type */
> +
> + type = (buf[5] & 0x30) >> 4;
> +
> + switch (type) {
> + case 1:
> + /* Gesture packet: (x, y, z) half resolution */
> + priv->agm.w = hw->w;
> + priv->agm.x = (((buf[4] & 0x0f) << 8)
> + | buf[1]) << 1;
> + priv->agm.y = INVERT_Y((((buf[4] & 0xf0) << 4)
> + | buf[2]) << 1);
> + priv->agm.z = ((buf[3] & 0x30)
> + | (buf[5] & 0x0f)) << 1;
> + break;
> +
> + case 2:
> + /* Finger slot update */
> + synaptics_agm_finger_update(priv, buf[1],
> + buf[2], buf[4]);
> + break;
> +
> + default:
> + break;
> + }
> return 1;
> } else {
> hw->x = (((buf[3] & 0x10) << 8) |
> @@ -804,6 +832,7 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
> input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
>
> if (SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) {
> + __set_bit(INPUT_PROP_SYNAPTICS_T5R2, dev->propbit);
> input_mt_init_slots(dev, SYN_TRACK_SLOT_COUNT);
> input_set_abs_params(dev, ABS_MT_POSITION_X, XMIN_NOMINAL,
> priv->x_max ?: XMAX_NOMINAL, fuzz, 0);
> diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
> index 1de2256..2214af6 100644
> --- a/drivers/input/mouse/synaptics.h
> +++ b/drivers/input/mouse/synaptics.h
> @@ -122,7 +122,7 @@
> #define SYN_SLOT_AGM 2
>
> /* number of tracking slots for Image Sensor firmware */
> -#define SYN_TRACK_SLOT_COUNT 2
> +#define SYN_TRACK_SLOT_COUNT 5
>
> /*
> * A structure to describe the state of the touchpad hardware (buttons and pad)
> @@ -140,6 +140,11 @@ struct synaptics_hw_state {
> unsigned int down:1;
> unsigned char ext_buttons;
> signed char scroll;
> +
> + /* Reported in AGM-CONTACT packets */
> + unsigned int finger_count; /* num fingers being tracked */
> + unsigned int finger_sgm; /* finger described by sgm */
> + unsigned int finger_agm; /* finger described by agm */
> };
>
> struct synaptics_data {
> diff --git a/include/linux/input.h b/include/linux/input.h
> index 771d6d8..732c14e 100644
> --- a/include/linux/input.h
> +++ b/include/linux/input.h
> @@ -137,6 +137,7 @@ struct input_keymap_entry {
> #define INPUT_PROP_DIRECT 0x01 /* direct input devices */
> #define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */
> #define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */
> +#define INPUT_PROP_SYNAPTICS_T5R2 0x04 /* synaptics track 5 report 2 */
>
> #define INPUT_PROP_MAX 0x1f
> #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
I'm trying to understand these later patches for T5R2. There are
"hidden" touch slots now. How does userspace tell whether a touch slot
is a hidden touch?
-- Chase
next prev parent reply other threads:[~2011-07-05 18:18 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-29 5:07 [PATCH 00/12] Synaptics image sensor support djkurtz
2011-06-29 5:07 ` [PATCH 01/12] Input: synaptics - cleanup 0x0c query documentation djkurtz
2011-07-05 17:33 ` Chase Douglas
2011-07-06 13:50 ` Daniel Kurtz
2011-07-07 6:30 ` Dmitry Torokhov
2011-06-29 5:07 ` [PATCH 02/12] Input: synaptics - do not invert y if 0 djkurtz
2011-07-04 21:08 ` Henrik Rydberg
2011-07-05 4:29 ` Daniel Kurtz
2011-07-05 18:07 ` Henrik Rydberg
2011-07-05 18:39 ` Chris Bagwell
2011-07-05 23:02 ` Daniel Kurtz
2011-07-05 17:42 ` Chase Douglas
2011-07-05 22:50 ` Daniel Kurtz
2011-07-05 23:06 ` Chase Douglas
2011-07-05 23:15 ` Daniel Kurtz
2011-07-05 23:25 ` Dmitry Torokhov
2011-06-29 5:07 ` [PATCH 03/12] Input: synaptics - fix minimum reported ABS_TOOL_WIDTH djkurtz
2011-06-29 13:28 ` Chris Bagwell
2011-06-29 16:48 ` Daniel Kurtz
2011-06-29 19:46 ` Chris Bagwell
2011-07-04 21:14 ` Henrik Rydberg
2011-07-09 6:24 ` Jeffrey Brown
2011-06-29 5:07 ` [PATCH 04/12] Input: synaptics - set resolution for MT_POSITION_X/Y axes djkurtz
2011-07-05 17:44 ` Chase Douglas
2011-07-07 6:23 ` Dmitry Torokhov
2011-06-29 5:07 ` [PATCH 05/12] Input: synaptics - process button bits in AGM packets djkurtz
2011-07-04 21:24 ` Henrik Rydberg
2011-07-05 4:38 ` Daniel Kurtz
2011-07-05 18:18 ` Henrik Rydberg
2011-07-05 18:19 ` Chase Douglas
2011-07-05 17:47 ` Chase Douglas
2011-07-07 6:24 ` Dmitry Torokhov
2011-06-29 5:07 ` [PATCH 06/12] Input: synaptics - fuzz position if touchpad reports reduced filtering djkurtz
2011-07-05 17:49 ` Chase Douglas
2011-07-07 6:25 ` Dmitry Torokhov
2011-06-29 5:07 ` [PATCH 07/12] Input: synaptics - rename synaptics_data.mt to agm djkurtz
2011-07-04 21:26 ` Henrik Rydberg
2011-07-05 4:39 ` Daniel Kurtz
2011-07-05 18:20 ` Henrik Rydberg
2011-07-05 17:53 ` Chase Douglas
2011-06-29 5:07 ` [PATCH 08/12] Input: synaptics - rename set_slot to be more descriptive djkurtz
2011-07-05 17:54 ` Chase Douglas
2011-07-07 6:27 ` Dmitry Torokhov
2011-06-29 5:07 ` [PATCH 09/12] Input: synaptics - add image sensor support djkurtz
2011-07-04 21:42 ` Henrik Rydberg
2011-07-05 5:08 ` Daniel Kurtz
2011-07-05 19:27 ` Henrik Rydberg
2011-07-06 16:41 ` Daniel Kurtz
2011-07-06 17:08 ` Chase Douglas
2011-07-06 17:45 ` Dmitry Torokhov
2011-07-06 18:47 ` Henrik Rydberg
2011-07-06 18:58 ` Dmitry Torokhov
2011-07-06 19:31 ` Henrik Rydberg
2011-07-06 20:00 ` Dmitry Torokhov
2011-07-06 20:20 ` Henrik Rydberg
2011-07-06 21:22 ` Chase Douglas
2011-07-06 21:36 ` Dmitry Torokhov
2011-07-06 22:16 ` Chase Douglas
2011-07-06 22:35 ` Henrik Rydberg
2011-07-06 23:30 ` Chase Douglas
2011-06-29 5:07 ` [PATCH 10/12] Input: synaptics - decode AGM packet types djkurtz
2011-06-29 10:02 ` Chase Douglas
2011-06-29 10:07 ` Daniel Stone
2011-06-29 10:32 ` Chase Douglas
2011-06-29 11:26 ` Daniel Kurtz
2011-06-29 11:04 ` Daniel Kurtz
2011-07-05 18:17 ` Chase Douglas [this message]
2011-07-05 18:55 ` Chris Bagwell
2011-07-06 16:53 ` Daniel Kurtz
2011-06-29 5:07 ` [PATCH 11/12] Input: synaptics - process finger (<=3) transitions djkurtz
2011-06-29 5:07 ` [PATCH 12/12] Input: synaptics - process finger (<=5) transitions djkurtz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E135553.3000408@canonical.com \
--to=chase.douglas@canonical.com \
--cc=daniel.stone@collabora.co.uk \
--cc=derek.foreman@collabora.co.uk \
--cc=djkurtz@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olofj@chromium.org \
--cc=rubini@cvml.unipv.it \
--cc=rydberg@euromail.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).