[PATCH 1/1] Input: elantech - touchpad driver miss-recognising logitech mice

Stefan Bader stefan.bader at canonical.com
Wed Mar 18 16:51:04 UTC 2009


Andy Whitcroft wrote:
> From: Arjan Opmeer <arjan at opmeer.net>
> 
> Bug: #318722
> 
> commit 9ab7b25e6a30d2292bd6d4913b71c918ee1e21b4 upstream
> 
> Some Logitech mice react to the magic knock like Elantech touchpad would.
> This leads to those mice being misdetected as Elantech touchpads.  Add a
> version query to elantech_detect() to distinguish the two.
> 
> [dtor at mail.ru:
>  - lower severity of some messages - when we are not sure yet if
>    device is Elantech or not not responding to knock is not an error.
> ]
> 
> Signed-off-by: Arjan Opmeer <arjan at opmeer.net>
> Signed-off-by: Dmitry Torokhov <dtor at mail.ru>
> Signed-off-by: Andy Whitcroft <apw at canonical.com>
> ---
>  drivers/input/mouse/elantech.c |   32 ++++++++++++++++++++++++--------
>  1 files changed, 24 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
> index b9a25d5..6ab0eb1 100644
> --- a/drivers/input/mouse/elantech.c
> +++ b/drivers/input/mouse/elantech.c
> @@ -542,7 +542,7 @@ int elantech_detect(struct psmouse *psmouse, int set_properties)
>  	    ps2_command(ps2dev,  NULL, PSMOUSE_CMD_SETSCALE11) ||
>  	    ps2_command(ps2dev,  NULL, PSMOUSE_CMD_SETSCALE11) ||
>  	    ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) {
> -		pr_err("elantech.c: sending Elantech magic knock failed.\n");
> +		pr_debug("elantech.c: sending Elantech magic knock failed.\n");
>  		return -1;
>  	}
>  
> @@ -551,8 +551,27 @@ int elantech_detect(struct psmouse *psmouse, int set_properties)
>  	 * set of magic numbers
>  	 */
>  	if (param[0] != 0x3c || param[1] != 0x03 || param[2] != 0xc8) {
> -		pr_info("elantech.c: unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n",
> -			param[0], param[1], param[2]);
> +		pr_debug("elantech.c: "
> +			 "unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n",
> +			 param[0], param[1], param[2]);
> +		return -1;
> +	}
> +
> +	/*
> +	 * Query touchpad's firmware version and see if it reports known
> +	 * value to avoid mis-detection. Logitech mice are known to respond
> +	 * to Elantech magic knock and there might be more.
> +	 */
> +	if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
> +		pr_debug("elantech.c: failed to query firmware version.\n");
> +		return -1;
> +	}
> +
> +	pr_debug("elantech.c: Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
> +		 param[0], param[1], param[2]);
> +
> +	if (param[0] == 0 || param[1] != 0) {
> +		pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
>  		return -1;
>  	}
>  
> @@ -600,8 +619,7 @@ int elantech_init(struct psmouse *psmouse)
>  	int i, error;
>  	unsigned char param[3];
>  
> -	etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL);
> -	psmouse->private = etd;
> +	psmouse->private = etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL);
>  	if (!etd)
>  		return -1;
>  
> @@ -610,14 +628,12 @@ int elantech_init(struct psmouse *psmouse)
>  		etd->parity[i] = etd->parity[i & (i - 1)] ^ 1;
>  
>  	/*
> -	 * Find out what version hardware this is
> +	 * Do the version query again so we can store the result
>  	 */
>  	if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
>  		pr_err("elantech.c: failed to query firmware version.\n");
>  		goto init_fail;
>  	}
> -	pr_info("elantech.c: Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
> -		param[0], param[1], param[2]);
>  	etd->fw_version_maj = param[0];
>  	etd->fw_version_min = param[2];
>  
Looks sensible. ACK

-- 

When all other means of communication fail, try words!






More information about the kernel-team mailing list