Re: [PATCH v3 4/4] input: alps: Fix trackstick detection

From: Dmitry Torokhov
Date: Sun Nov 09 2014 - 03:05:22 EST


Hi Pali,

On Sun, Nov 02, 2014 at 12:25:10AM +0100, Pali Rohár wrote:
> int alps_detect(struct psmouse *psmouse, bool set_properties)
> {
> - struct alps_data dummy;
> + unsigned char e6[4];
>
> - if (alps_identify(psmouse, &dummy) < 0)
> - return -1;
> + /*
> + * Try "E6 report".
> + * ALPS should return 0,0,10 or 0,0,100 if no buttons are pressed.
> + * The bits 0-2 of the first byte will be 1s if some buttons are
> + * pressed.
> + */
> + if (alps_rpt_cmd(psmouse, PSMOUSE_CMD_SETRES,
> + PSMOUSE_CMD_SETSCALE11, e6))
> + return -EIO;
> +
> + if ((e6[0] & 0xf8) != 0 || e6[1] != 0 || (e6[2] != 10 && e6[2] != 100))
> + return -EINVAL;
>
> if (set_properties) {
> + /*
> + * NOTE: To detect model and trackstick presence we need to do
> + * full device reset. To speed up detection and prevent
> + * calling duplicate initialization sequence (both in
> + * alps_detect() and alps_init()) we set model/protocol
> + * version and correct name in alps_init() (which will
> + * do full device reset). For now set name to DualPoint.
> + */
> psmouse->vendor = "ALPS";
> - psmouse->name = dummy.flags & ALPS_DUALPOINT ?
> - "DualPoint TouchPad" : "GlidePoint";
> - psmouse->model = dummy.proto_version << 8;
> + psmouse->name = "DualPoint TouchPad";
> }
> +
> return 0;

We can't do this; going by e6 only will give us false positives and
alps_detect is supposed to be authoritative.

Thanks.

--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/