From patchwork Sun May 2 03:07:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Fritz X-Patchwork-Id: 96327 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4231up8010882 for ; Sun, 2 May 2010 03:01:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753621Ab0EBDBy (ORCPT ); Sat, 1 May 2010 23:01:54 -0400 Received: from mail-bw0-f219.google.com ([209.85.218.219]:42123 "EHLO mail-bw0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752222Ab0EBDBx (ORCPT ); Sat, 1 May 2010 23:01:53 -0400 Received: by bwz19 with SMTP id 19so749942bwz.21 for ; Sat, 01 May 2010 20:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=WZtnzFRuXE+d9geLJngRvqgi6rZilx9kOh1/GFABhzU=; b=QhA5dodyKKLy22CSsXuDISjKj73D29bg+tg1y22NFD2annS4v4IBKaYY3IMfiIUx4Q YkWK15DRP0w+Ivj1TDUUUhcXYsMvn6H5oaAWf4Uu3C78YJWRUZHXKhW9O69ZL0mSbfbV 6F53H/rEdqKaK7iaHYqLdhO3azwYqdsr2V9is= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=a6jrjYiNLVP9mnDEo9HA53tFQqrHoGZsdkvlnzdNedw0XXJ/M9H4jXp9a+aJQvN5lI tZJo+9ybiDHMqgLUXDUsPEWF43om4jR19P47ssWxq+BS06L6CseyktLF7h1cpJHDDnMe eYkBwbAy/7Ep3ZpiTFelWWNyn5ZODdaoWU1VA= Received: by 10.204.25.8 with SMTP id x8mr8505487bkb.176.1272769312040; Sat, 01 May 2010 20:01:52 -0700 (PDT) Received: from [192.168.1.4] (p3EE0723D.dip.t-dialin.net [62.224.114.61]) by mx.google.com with ESMTPS id 14sm1175395bwz.14.2010.05.01.20.01.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 01 May 2010 20:01:49 -0700 (PDT) Subject: Re: [PATCH] Reset ps/2 port should psmouse_probe fail before retrying From: Christoph Fritz To: "Peter M. Petrakis" Cc: Dmitry Torokhov , linux-input@vger.kernel.org, rubini , Christopher Heiny In-Reply-To: <4BDB5BA0.1080104@canonical.com> References: <1271723857.6652.6.camel@lovely> <20100422215517.GB28213@core.coreip.homeip.net> <1271983668.16254.44.camel@lovely> <201004230953.52447.dmitry.torokhov@gmail.com> <4BD1EB1C.1070200@canonical.com> <20100428170721.GA6608@core.coreip.homeip.net> <4BD897D4.4060405@canonical.com> <1272560268.3987.12.camel@lovely> <4BDB5BA0.1080104@canonical.com> Date: Sun, 02 May 2010 05:07:42 +0200 Message-Id: <1272769662.3315.36.camel@lovely> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 02 May 2010 03:01:56 +0000 (UTC) diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index d8c0c8d..5e726df 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -597,7 +597,6 @@ static int cortron_detect(struct psmouse *psmouse, bool set_properties) static int psmouse_extensions(struct psmouse *psmouse, unsigned int max_proto, bool set_properties) { - bool synaptics_hardware = false; /* * We always check for lifebook because it does not disturb mouse @@ -621,10 +620,10 @@ static int psmouse_extensions(struct psmouse *psmouse, /* * Try Synaptics TouchPad. Note that probing is done even if Synaptics protocol * support is disabled in config - we need to know if it is synaptics so we - * can reset it properly after probing for intellimouse. + * can reset it properly at reconnect and after probing for intellimouse. */ if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse, set_properties) == 0) { - synaptics_hardware = true; + psmouse->model = PSMOUSE_MODEL_NEEDRESET; if (max_proto > PSMOUSE_IMEX) { /* @@ -740,7 +739,7 @@ static int psmouse_extensions(struct psmouse *psmouse, */ ps2bare_detect(psmouse, set_properties); - if (synaptics_hardware) { + if (psmouse->model == PSMOUSE_MODEL_NEEDRESET) { /* * We detected Synaptics hardware but it did not respond to IMPS/2 probes. * We need to reset the touchpad because if there is a track point on the @@ -1401,10 +1400,14 @@ static int psmouse_reconnect(struct serio *serio) if (psmouse->reconnect) { if (psmouse->reconnect(psmouse)) goto out; - } else if (psmouse_probe(psmouse) < 0 || + } else { + if (psmouse->model == PSMOUSE_MODEL_NEEDRESET) + psmouse_reset(psmouse); + if (psmouse_probe(psmouse) < 0 || psmouse->type != psmouse_extensions(psmouse, psmouse_max_proto, false)) { - goto out; + goto out; + } } /* ok, the device type (and capabilities) match the old one, diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index e053bdd..c45b5ef 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h @@ -20,6 +20,9 @@ #define PSMOUSE_RET_ACK 0xfa #define PSMOUSE_RET_NAK 0xfe +#define PSMOUSE_MODEL_UNKNOWN 0x00 +#define PSMOUSE_MODEL_NEEDRESET 0x01 + enum psmouse_state { PSMOUSE_IGNORE, PSMOUSE_INITIALIZING,