Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269453
b: refs/heads/master
c: a6ca40c
h: refs/heads/master
i:
  269451: e54a2a4
v: v3
  • Loading branch information
Daniel Kurtz authored and Dmitry Torokhov committed Aug 24, 2011
1 parent 16e7777 commit d082559
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3cdfee9ea7e98eb6e8c3d4d66f2dfcfffe6afc4d
refs/heads/master: a6ca40c11eb5d98e53176adf527e430f7037a8c9
36 changes: 30 additions & 6 deletions trunk/drivers/input/mouse/synaptics.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,15 +420,39 @@ static void synaptics_pt_create(struct psmouse *psmouse)
* Functions to interpret the absolute mode packets
****************************************************************************/

static void synaptics_mt_state_set(struct synaptics_mt_state *state, int count,
int sgm, int agm)
{
state->count = count;
state->sgm = sgm;
state->agm = agm;
}

static void synaptics_parse_agm(const unsigned char buf[],
struct synaptics_data *priv)
struct synaptics_data *priv,
struct synaptics_hw_state *hw)
{
struct synaptics_hw_state *agm = &priv->agm;
int agm_packet_type;

agm_packet_type = (buf[5] & 0x30) >> 4;
switch (agm_packet_type) {
case 1:
/* Gesture packet: (x, y, z) half resolution */
agm->w = hw->w;
agm->x = (((buf[4] & 0x0f) << 8) | buf[1]) << 1;
agm->y = (((buf[4] & 0xf0) << 4) | buf[2]) << 1;
agm->z = ((buf[3] & 0x30) | (buf[5] & 0x0f)) << 1;
break;

/* Gesture packet: (x, y, z) at half resolution */
agm->x = (((buf[4] & 0x0f) << 8) | buf[1]) << 1;
agm->y = (((buf[4] & 0xf0) << 4) | buf[2]) << 1;
agm->z = ((buf[3] & 0x30) | (buf[5] & 0x0f)) << 1;
case 2:
/* AGM-CONTACT packet: (count, sgm, agm) */
synaptics_mt_state_set(&agm->mt_state, buf[1], buf[2], buf[4]);
break;

default:
break;
}
}

static int synaptics_parse_hw_state(const unsigned char buf[],
Expand Down Expand Up @@ -467,7 +491,7 @@ 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) {
synaptics_parse_agm(buf, priv);
synaptics_parse_agm(buf, priv, hw);
return 1;
}

Expand Down
14 changes: 13 additions & 1 deletion trunk/drivers/input/mouse/synaptics.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,18 @@
#define SYN_REDUCED_FILTER_FUZZ 8

/*
* A structure to describe the state of the touchpad hardware (buttons and pad)
* A structure to describe which internal touchpad finger slots are being
* reported in raw packets.
*/
struct synaptics_mt_state {
int count; /* num fingers being tracked */
int sgm; /* which slot is reported by sgm pkt */
int agm; /* which slot is reported by agm pkt*/
};

/*
* A structure to describe the state of the touchpad hardware (buttons and pad)
*/
struct synaptics_hw_state {
int x;
int y;
Expand All @@ -130,6 +139,9 @@ struct synaptics_hw_state {
unsigned int down:1;
unsigned char ext_buttons;
signed char scroll;

/* As reported in last AGM-CONTACT packets */
struct synaptics_mt_state mt_state;
};

struct synaptics_data {
Expand Down

0 comments on commit d082559

Please sign in to comment.