Re: [PATCH v5 7/8] Input: elantech - add v3 hardware support

From: JJ Ding
Date: Mon Sep 05 2011 - 03:07:59 EST


Hi Daniel,

On Mon, 5 Sep 2011 12:35:28 +0800, Daniel Kurtz <djkurtz@xxxxxxxxxxxx> wrote:
> Hi JJ,
>
> On Mon, Sep 5, 2011 at 10:16 AM, JJ Ding <jj_ding@xxxxxxxxxx> wrote:
> > diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
> > index 2ae7c49..c4ceefd 100644
> > --- a/drivers/input/mouse/elantech.c
> > +++ b/drivers/input/mouse/elantech.c
> > @@ -108,6 +108,16 @@ static int elantech_read_reg(struct psmouse *psmouse, unsigned char reg,
> > Â Â Â Â Â Â Â Â Â Â Â Ârc = -1;
> > Â Â Â Â Â Â Â Â}
> > Â Â Â Â Â Â Â Âbreak;
> > +
> > + Â Â Â case 3:
> > + Â Â Â Â Â Â Â if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) ||
> > + Â Â Â Â Â Â Â Â Â elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READWRITE) ||
> > + Â Â Â Â Â Â Â Â Â elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) ||
> > + Â Â Â Â Â Â Â Â Â elantech_ps2_command(psmouse, NULL, reg) ||
> > + Â Â Â Â Â Â Â Â Â elantech_ps2_command(psmouse, param, PSMOUSE_CMD_GETINFO)) {
> > + Â Â Â Â Â Â Â Â Â Â Â rc = -1;
> > + Â Â Â Â Â Â Â }
> > + Â Â Â Â Â Â Â break;
> > Â Â Â Â}
> >
> > Â Â Â Âif (rc)
> > @@ -154,6 +164,18 @@ static int elantech_write_reg(struct psmouse *psmouse, unsigned char reg,
> > Â Â Â Â Â Â Â Â Â Â Â Ârc = -1;
> > Â Â Â Â Â Â Â Â}
> > Â Â Â Â Â Â Â Âbreak;
> > +
> > + Â Â Â case 3:
> > + Â Â Â Â Â Â Â if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) ||
> > + Â Â Â Â Â Â Â Â Â elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READWRITE) ||
> > + Â Â Â Â Â Â Â Â Â elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) ||
> > + Â Â Â Â Â Â Â Â Â elantech_ps2_command(psmouse, NULL, reg) ||
> > + Â Â Â Â Â Â Â Â Â elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) ||
> > + Â Â Â Â Â Â Â Â Â elantech_ps2_command(psmouse, NULL, val) ||
> > + Â Â Â Â Â Â Â Â Â elantech_ps2_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) {
> > + Â Â Â Â Â Â Â Â Â Â Â rc = -1;
> > + Â Â Â Â Â Â Â }
> > + Â Â Â Â Â Â Â break;
> > Â Â Â Â}
> >
> > Â Â Â Âif (rc)
> > @@ -350,6 +372,84 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
> > Â Â Â Âinput_sync(dev);
> > Â}
> >
> > +/*
> > + * Interpret complete data packets and report absolute mode input events for
> > + * hardware version 3. (12 byte packets for two fingers)
> > + */
> > +static void elantech_report_absolute_v3(struct psmouse *psmouse,
> > + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â int packet_type)
> > +{
> > + Â Â Â struct input_dev *dev = psmouse->dev;
> > + Â Â Â struct elantech_data *etd = psmouse->private;
> > + Â Â Â unsigned char *packet = psmouse->packet;
> > + Â Â Â unsigned int fingers = 0, x1 = 0, y1 = 0, x2 = 0, y2 = 0;
> > + Â Â Â unsigned int width = 0, pres = 0;
> > +
> > + Â Â Â /* byte 0: n1 Ân0 Â . Â . Â . Â . Â R Â L */
> > + Â Â Â fingers = (packet[0] & 0xc0) >> 6;
> > +
> > + Â Â Â switch (fingers) {
> > + Â Â Â case 3:
> > + Â Â Â case 1:
> > + Â Â Â Â Â Â Â /*
> > + Â Â Â Â Â Â Â Â* byte 1: Â. Â . Â . Â . Âx11 x10 x9 Âx8
> > + Â Â Â Â Â Â Â Â* byte 2: x7 Âx6 Âx5 Âx4 Âx4 Âx2 Âx1 Âx0
> > + Â Â Â Â Â Â Â Â*/
> > + Â Â Â Â Â Â Â x1 = ((packet[1] & 0x0f) << 8) | packet[2];
> > + Â Â Â Â Â Â Â /*
> > + Â Â Â Â Â Â Â Â* byte 4: Â. Â . Â . Â . Ây11 y10 y9 Ây8
> > + Â Â Â Â Â Â Â Â* byte 5: y7 Ây6 Ây5 Ây4 Ây3 Ây2 Ây1 Ây0
> > + Â Â Â Â Â Â Â Â*/
> > + Â Â Â Â Â Â Â y1 = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]);
> > + Â Â Â Â Â Â Â break;
> > +
> > + Â Â Â case 2:
> > + Â Â Â Â Â Â Â if (packet_type == PACKET_V3_HEAD) {
> > + Â Â Â Â Â Â Â Â Â Â Â /*
> > + Â Â Â Â Â Â Â Â Â Â Â Â* byte 1: Â . Â Â. Â Â. Â Â. Âax11 ax10 ax9 Âax8
> > + Â Â Â Â Â Â Â Â Â Â Â Â* byte 2: ax7 Âax6 Âax5 Âax4 Âax3 Âax2 Âax1 Âax0
> > + Â Â Â Â Â Â Â Â Â Â Â Â*/
> > + Â Â Â Â Â Â Â Â Â Â Â etd->prev_x = ((packet[1] & 0x0f) << 8) | packet[2];
> > + Â Â Â Â Â Â Â Â Â Â Â /*
> > + Â Â Â Â Â Â Â Â Â Â Â Â* byte 4: Â . Â Â. Â Â. Â Â. Âay11 ay10 ay9 Âay8
> > + Â Â Â Â Â Â Â Â Â Â Â Â* byte 5: ay7 Âay6 Âay5 Âay4 Âay3 Âay2 Âay1 Âay0
> > + Â Â Â Â Â Â Â Â Â Â Â Â*/
> > + Â Â Â Â Â Â Â Â Â Â Â etd->prev_y = etd->y_max -
> > + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â (((packet[4] & 0x0f) << 8) | packet[5]);
> > + Â Â Â Â Â Â Â Â Â Â Â /*
> > + Â Â Â Â Â Â Â Â Â Â Â Â* wait for next packet
> > + Â Â Â Â Â Â Â Â Â Â Â Â*/
> > + Â Â Â Â Â Â Â Â Â Â Â return;
> > + Â Â Â Â Â Â Â }
> > +
> > + Â Â Â Â Â Â Â /* packet_type == PACKET_V3_TAIL */
> > + Â Â Â Â Â Â Â x1 = etd->prev_x;
> > + Â Â Â Â Â Â Â y1 = etd->prev_y;
> > + Â Â Â Â Â Â Â x2 = ((packet[1] & 0x0f) << 8) | packet[2];
> > + Â Â Â Â Â Â Â y2 = etd->y_max - (((packet[4] & 0x0f) << 8) | packet[5]);
> > + Â Â Â Â Â Â Â break;
> > + Â Â Â }
> > +
> > + Â Â Â pres = (packet[1] & 0xf0) | ((packet[4] & 0xf0) >> 4);
> > + Â Â Â width = ((packet[0] & 0x30) >> 2) | ((packet[3] & 0x30) >> 4);
> > +
> > + Â Â Â input_report_key(dev, BTN_TOUCH, fingers != 0);
> > + Â Â Â if (fingers != 0) {
> > + Â Â Â Â Â Â Â input_report_abs(dev, ABS_X, x1);
> > + Â Â Â Â Â Â Â input_report_abs(dev, ABS_Y, y1);
> > + Â Â Â }
> > + Â Â Â elantech_report_semi_mt_data(dev, fingers, x1, y1, x2, y2);
>
> Originally, v3 was using semi-mt, which reported corner coordinates of
> a box containing at least two of the N touches on the touchpad. I
> thought this was due to hardware limitation.
>
> If the hardware really can report true positions for (up to) 3
> contacts, then using pure MT-B is a good approach. This driver still
> seems to mix semi-mt and MT-B together a bit.
>
> Can you report all three contacts in their own slots, 0, 1 and 2,
> instead of just reoprting two of them with 0,1?
>
> Also, when reporting the 'legacy single touch' coordinate (ABS_X,
> ABS_Y), please use:
> input_mt_report_pointer_emulation(), instead of always reporting the
> last (x1,y1). Otherwise the single touch point will bounce back and
> forth between 1st and 3rd touch.

v3 can only track the true positions of two fingers. With 3 finger
touch, it reports the lowest value of x and the biggest value of y,
among the three fingers. v3 changed the protocol so it could report
2-finger touch data w/o reduced resolution and improved the hardware to
truly track 2 fingers independently, otherwise it's pretty much the same
as v2.

> > + Â Â Â input_report_key(dev, BTN_TOOL_FINGER, fingers == 1);
> > + Â Â Â input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2);
> > + Â Â Â input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3);
>
> Use input_mt_report_pointer_emulation() with use_count = true. This
> will also report ABS_PRESURE (but not ABS_TOOL_WIDTH, unfortunately).
>
> > + Â Â Â input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
> > + Â Â Â input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
> > + Â Â Â input_report_abs(dev, ABS_PRESSURE, pres);
> > + Â Â Â input_report_abs(dev, ABS_TOOL_WIDTH, width);
> > +
> > + Â Â Â input_sync(dev);
> > +}
> > +
> > Âstatic int elantech_packet_check_v1(struct psmouse *psmouse)
> > Â{
> > Â Â Â Âstruct elantech_data *etd = psmouse->private;
> > @@ -403,11 +503,37 @@ static int elantech_packet_check_v2(struct psmouse *psmouse)
> > Â}
> >
> > Â/*
> > + * We check the constant bits to determine what packet type we get,
> > + * so packet checking is mandatory for v3 hardware.
> > + */
> > +static int elantech_packet_check_v3(struct psmouse *psmouse)
> > +{
> > + Â Â Â const u8 debounce_packet[] = { 0xc4, 0xff, 0xff, 0x02, 0xff, 0xff };
> > + Â Â Â unsigned char *packet = psmouse->packet;
> > +
> > + Â Â Â /*
> > + Â Â Â Â* check debounce first, it has the same signature in byte 0
> > + Â Â Â Â* and byte 3 as PACKET_V3_HEAD.
> > + Â Â Â Â*/
> > + Â Â Â if (!memcmp(packet, debounce_packet, sizeof(debounce_packet)))
> > + Â Â Â Â Â Â Â return PACKET_DEBOUNCE;
> > +
> > + Â Â Â if ((packet[0] & 0x0c) == 0x04 && (packet[3] & 0xcf) == 0x02)
> > + Â Â Â Â Â Â Â return PACKET_V3_HEAD;
> > +
> > + Â Â Â if ((packet[0] & 0x0c) == 0x0c && (packet[3] & 0xce) == 0x0c)
> > + Â Â Â Â Â Â Â return PACKET_V3_TAIL;
> > +
> > + Â Â Â return PACKET_UNKNOWN;
> > +}
> > +
> > +/*
> > Â* Process byte stream from mouse and handle complete packets
> > Â*/
> > Âstatic psmouse_ret_t elantech_process_byte(struct psmouse *psmouse)
> > Â{
> > Â Â Â Âstruct elantech_data *etd = psmouse->private;
> > + Â Â Â int packet_type;
> >
> > Â Â Â Âif (psmouse->pktcnt < psmouse->pktsize)
> > Â Â Â Â Â Â Â Âreturn PSMOUSE_GOOD_DATA;
> > @@ -429,6 +555,18 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse)
> >
> > Â Â Â Â Â Â Â Âelantech_report_absolute_v2(psmouse);
> > Â Â Â Â Â Â Â Âbreak;
> > +
> > + Â Â Â case 3:
> > + Â Â Â Â Â Â Â packet_type = elantech_packet_check_v3(psmouse);
> > + Â Â Â Â Â Â Â /* ignore debounce */
> > + Â Â Â Â Â Â Â if (packet_type == PACKET_DEBOUNCE)
> > + Â Â Â Â Â Â Â Â Â Â Â return PSMOUSE_FULL_PACKET;
> > +
> > + Â Â Â Â Â Â Â if (packet_type == PACKET_UNKNOWN)
> > + Â Â Â Â Â Â Â Â Â Â Â return PSMOUSE_BAD_DATA;
> > +
> > + Â Â Â Â Â Â Â elantech_report_absolute_v3(psmouse, packet_type);
> > + Â Â Â Â Â Â Â break;
> > Â Â Â Â}
> >
> > Â Â Â Âreturn PSMOUSE_FULL_PACKET;
> > @@ -463,8 +601,15 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
> > Â Â Â Â Â Â Â Â Â Âelantech_write_reg(psmouse, 0x11, etd->reg_11) ||
> > Â Â Â Â Â Â Â Â Â Âelantech_write_reg(psmouse, 0x21, etd->reg_21)) {
> > Â Â Â Â Â Â Â Â Â Â Â Ârc = -1;
> > - Â Â Â Â Â Â Â Â Â Â Â break;
> > Â Â Â Â Â Â Â Â}
> > + Â Â Â Â Â Â Â break;
> > +
> > + Â Â Â case 3:
> > + Â Â Â Â Â Â Â etd->reg_10 = 0x0b;
> > + Â Â Â Â Â Â Â if (elantech_write_reg(psmouse, 0x10, etd->reg_10))
> > + Â Â Â Â Â Â Â Â Â Â Â rc = -1;
> > +
> > + Â Â Â Â Â Â Â break;
> > Â Â Â Â}
> >
> > Â Â Â Âif (rc == 0) {
> > @@ -498,11 +643,12 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
> > Â Â Â Âreturn rc;
> > Â}
> >
> > -static void set_range(struct psmouse *psmouse, unsigned int *x_min,
> > +static int set_range(struct psmouse *psmouse, unsigned int *x_min,
> > Â Â Â Â Â Â Â Â Â Â unsigned int *y_min, unsigned int *x_max,
> > Â Â Â Â Â Â Â Â Â Â unsigned int *y_max)
> > Â{
> > Â Â Â Âstruct elantech_data *etd = psmouse->private;
> > + Â Â Â unsigned char param[3];
> > Â Â Â Âint i;
> >
> > Â Â Â Âswitch (etd->hw_version) {
> > @@ -530,19 +676,30 @@ static void set_range(struct psmouse *psmouse, unsigned int *x_min,
> > Â Â Â Â Â Â Â Â Â Â Â Â*y_max = (etd->capabilities[2] - i) * 64;
> > Â Â Â Â Â Â Â Â}
> > Â Â Â Â Â Â Â Âbreak;
> > +
> > + Â Â Â case 3:
> > + Â Â Â Â Â Â Â if (synaptics_send_cmd(psmouse, ETP_FW_ID_QUERY, param))
> > + Â Â Â Â Â Â Â Â Â Â Â return -1;
> > +
> > + Â Â Â Â Â Â Â *x_max = (0x0f & param[0]) << 8 | param[1];
> > + Â Â Â Â Â Â Â *y_max = (0xf0 & param[0]) << 4 | param[2];
> > + Â Â Â Â Â Â Â break;
> > Â Â Â Â}
> > +
> > + Â Â Â return 0;
> > Â}
> >
> > Â/*
> > Â* Set the appropriate event bits for the input subsystem
> > Â*/
> > -static void elantech_set_input_params(struct psmouse *psmouse)
> > +static int elantech_set_input_params(struct psmouse *psmouse)
> > Â{
> > Â Â Â Âstruct input_dev *dev = psmouse->dev;
> > Â Â Â Âstruct elantech_data *etd = psmouse->private;
> > Â Â Â Âunsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0;
> >
> > - Â Â Â set_range(psmouse, &x_min, &y_min, &x_max, &y_max);
> > + Â Â Â if (set_range(psmouse, &x_min, &y_min, &x_max, &y_max))
> > + Â Â Â Â Â Â Â return -1;
> >
> > Â Â Â Â__set_bit(EV_KEY, dev->evbit);
> > Â Â Â Â__set_bit(EV_ABS, dev->evbit);
> > @@ -570,6 +727,9 @@ static void elantech_set_input_params(struct psmouse *psmouse)
> >
> > Â Â Â Âcase 2:
> > Â Â Â Â Â Â Â Â__set_bit(BTN_TOOL_QUADTAP, dev->keybit);
> > + Â Â Â Â Â Â Â __set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
> > + Â Â Â Â Â Â Â /* fall through */
> > + Â Â Â case 3:
> > Â Â Â Â Â Â Â Âinput_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0);
> > Â Â Â Â Â Â Â Âinput_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0);
> > Â Â Â Â Â Â Â Âif (etd->reports_pressure) {
> > @@ -578,7 +738,6 @@ static void elantech_set_input_params(struct psmouse *psmouse)
> > Â Â Â Â Â Â Â Â Â Â Â Âinput_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2,
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ETP_WMAX_V2, 0, 0);
> > Â Â Â Â Â Â Â Â}
> > - Â Â Â Â Â Â Â __set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
> > Â Â Â Â Â Â Â Âinput_mt_init_slots(dev, 2);
>
> Should this be 3?
>
> > Â Â Â Â Â Â Â Âinput_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0);
> > Â Â Â Â Â Â Â Âinput_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0);
> > @@ -586,6 +745,8 @@ static void elantech_set_input_params(struct psmouse *psmouse)
> > Â Â Â Â}
> >
> > Â Â Â Âetd->y_max = y_max;
> > +
> > + Â Â Â return 0;
> > Â}
> >
> > Âstruct elantech_attr_data {
> > @@ -727,7 +888,8 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
> > Â Â Â Â * Report this in case there are Elantech models that use a different
> > Â Â Â Â * set of magic numbers
> > Â Â Â Â */
> > - Â Â Â if (param[0] != 0x3c || param[1] != 0x03 || param[2] != 0xc8) {
> > + Â Â Â if (param[0] != 0x3c || param[1] != 0x03 ||
> > + Â Â Â Â Â (param[2] != 0xc8 && param[2] != 0x00)) {
> > Â Â Â Â Â Â Â Âpr_debug("unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n",
> > Â Â Â Â Â Â Â Â Â Â Â Â param[0], param[1], param[2]);
> > Â Â Â Â Â Â Â Âreturn -1;
> > @@ -793,16 +955,16 @@ static int elantech_reconnect(struct psmouse *psmouse)
> > Â/*
> > Â* determine hardware version and set some properties according to it.
> > Â*/
> > -static void elantech_set_properties(struct elantech_data *etd)
> > +static int elantech_set_properties(struct elantech_data *etd)
> > Â{
> > - Â Â Â /*
> > - Â Â Â Â* Assume every version greater than 0x020030 is new EeePC style
> > - Â Â Â Â* hardware with 6 byte packets, except 0x020600
> > - Â Â Â Â*/
> > Â Â Â Âif (etd->fw_version < 0x020030 || etd->fw_version == 0x020600)
> > Â Â Â Â Â Â Â Âetd->hw_version = 1;
> > - Â Â Â else
> > + Â Â Â else if (etd->fw_version < 0x150600)
> > Â Â Â Â Â Â Â Âetd->hw_version = 2;
> > + Â Â Â else if ((etd->fw_version & 0x0f0000) >> 16 == 5)
> > + Â Â Â Â Â Â Â etd->hw_version = 3;
> > + Â Â Â else
> > + Â Â Â Â Â Â Â return -1;
> >
> > Â Â Â Â/*
> > Â Â Â Â * Turn on packet checking by default.
> > @@ -817,13 +979,15 @@ static void elantech_set_properties(struct elantech_data *etd)
> > Â Â Â Âetd->jumpy_cursor =
> > Â Â Â Â Â Â Â Â(etd->fw_version == 0x020022 || etd->fw_version == 0x020600);
> >
> > - Â Â Â if (etd->hw_version == 2) {
> > + Â Â Â if (etd->hw_version > 1) {
> > Â Â Â Â Â Â Â Â/* For now show extra debug information */
> > Â Â Â Â Â Â Â Âetd->debug = 1;
> >
> > Â Â Â Â Â Â Â Âif (etd->fw_version >= 0x020800)
> > Â Â Â Â Â Â Â Â Â Â Â Âetd->reports_pressure = true;
> > Â Â Â Â}
> > +
> > + Â Â Â return 0;
> > Â}
> >
> > Â/*
> > @@ -850,9 +1014,12 @@ int elantech_init(struct psmouse *psmouse)
> > Â Â Â Â Â Â Â Âpr_err("failed to query firmware version.\n");
> > Â Â Â Â Â Â Â Âgoto init_fail;
> > Â Â Â Â}
> > -
> > Â Â Â Âetd->fw_version = (param[0] << 16) | (param[1] << 8) | param[2];
> > - Â Â Â elantech_set_properties(etd);
> > +
> > + Â Â Â if (elantech_set_properties(etd)) {
> > + Â Â Â Â Â Â Â pr_err("unknown hardware version, aborting...\n");
> > + Â Â Â Â Â Â Â goto init_fail;
> > + Â Â Â }
> > Â Â Â Âpr_info("assuming hardware version %d "
> > Â Â Â Â Â Â Â Â"(with firmware version 0x%02x%02x%02x)\n",
> > Â Â Â Â Â Â Â Âetd->hw_version, param[0], param[1], param[2]);
> > @@ -871,7 +1038,10 @@ int elantech_init(struct psmouse *psmouse)
> > Â Â Â Â Â Â Â Âgoto init_fail;
> > Â Â Â Â}
> >
> > - Â Â Â elantech_set_input_params(psmouse);
> > + Â Â Â if (elantech_set_input_params(psmouse)) {
> > + Â Â Â Â Â Â Â pr_err("failed to query touchpad range.\n");
> > + Â Â Â Â Â Â Â goto init_fail;
> > + Â Â Â }
> >
> > Â Â Â Âerror = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj,
> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &elantech_attr_group);
> > @@ -883,7 +1053,7 @@ int elantech_init(struct psmouse *psmouse)
> > Â Â Â Âpsmouse->protocol_handler = elantech_process_byte;
> > Â Â Â Âpsmouse->disconnect = elantech_disconnect;
> > Â Â Â Âpsmouse->reconnect = elantech_reconnect;
> > - Â Â Â psmouse->pktsize = etd->hw_version == 2 ? 6 : 4;
> > + Â Â Â psmouse->pktsize = etd->hw_version > 1 ? 6 : 4;
> >
> > Â Â Â Âreturn 0;
> >
> > diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
> > index d9e6144..236c33c 100644
> > --- a/drivers/input/mouse/elantech.h
> > +++ b/drivers/input/mouse/elantech.h
> > @@ -16,6 +16,7 @@
> > Â/*
> > Â* Command values for Synaptics style queries
> > Â*/
> > +#define ETP_FW_ID_QUERY Â Â Â Â Â Â Â Â Â Â Â Â0x00
> > Â#define ETP_FW_VERSION_QUERY Â Â Â Â Â 0x01
> > Â#define ETP_CAPABILITIES_QUERY Â Â Â Â 0x02
> >
> > @@ -24,6 +25,7 @@
> > Â*/
> > Â#define ETP_REGISTER_READ Â Â Â Â Â Â Â0x10
> > Â#define ETP_REGISTER_WRITE Â Â Â Â Â Â 0x11
> > +#define ETP_REGISTER_READWRITE Â Â Â Â 0x00
> >
> > Â/*
> > Â* Hardware version 2 custom PS/2 command value
> > @@ -79,6 +81,14 @@
> > Â#define ETP_WMIN_V2 Â Â Â Â Â Â Â Â Â Â0
> > Â#define ETP_WMAX_V2 Â Â Â Â Â Â Â Â Â Â15
> >
> > +/*
> > + * v3 hardware has 2 kinds of packet types.
> > + */
> > +#define PACKET_UNKNOWN Â Â Â Â Â Â Â Â 0x01
> > +#define PACKET_DEBOUNCE Â Â Â Â Â Â Â Â Â Â Â Â0x02
> > +#define PACKET_V3_HEAD Â Â Â Â Â Â Â Â 0x03
> > +#define PACKET_V3_TAIL Â Â Â Â Â Â Â Â 0x04
> > +
> > Âstruct elantech_data {
> > Â Â Â Âunsigned char reg_10;
> > Â Â Â Âunsigned char reg_11;
> > @@ -98,6 +108,8 @@ struct elantech_data {
> > Â Â Â Âunsigned int fw_version;
> > Â Â Â Âunsigned int single_finger_reports;
> > Â Â Â Âunsigned int y_max;
> > + Â Â Â unsigned int prev_x;
> > + Â Â Â unsigned int prev_y;
> > Â Â Â Âunsigned char parity[256];
> > Â};
> >
> > --
> > 1.7.4.1
> >
>
èº{.nÇ+‰·Ÿ®‰­†+%ŠËlzwm…ébëæìr¸›zX§»®w¥Š{ayºÊÚë,j­¢f£¢·hš‹àz¹®w¥¢¸ ¢·¦j:+v‰¨ŠwèjØm¶Ÿÿ¾«‘êçzZ+ƒùšŽŠÝj"ú!¶iO•æ¬z·švØ^¶m§ÿðà nÆàþY&—