Input: psmouse - fix Synaptics detection when protocol is disabled
authorDaniel Drake <dsd@laptop.org>
Thu, 7 Jan 2010 09:52:39 +0000 (01:52 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 7 Jan 2010 09:53:30 +0000 (01:53 -0800)
For configurations where Synaptics hardware is present but the Synaptics
extensions support is not compiled in, the mouse is reprobed and a new
device is allocated on every suspend/resume.

During probe, psmouse_switch_protocol() calls psmouse_extensions() with
set_properties=1. This calls the dummy synaptics_init() which returns an
error code, instructing us not to use the synaptics extensions.

During resume, psmouse_reconnect() calls psmouse_extensions() with
set_properties=0, in which case call to synaptics_init() is bypassed and
PSMOUSE_SYNAPTICS is returned. Since the result is different from previous
attempt psmouse_reconnect() fails and full re-probe happens.

Fix this by tweaking the set_properties=0 codepath in psmouse_extensions()
to be more careful about offering PSMOUSE_SYNAPTICS extensions.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/mouse/psmouse-base.c
drivers/input/mouse/synaptics.c
drivers/input/mouse/synaptics.h

index d59e18b..cabf4e1 100644 (file)
@@ -627,8 +627,15 @@ static int psmouse_extensions(struct psmouse *psmouse,
                synaptics_hardware = true;
 
                if (max_proto > PSMOUSE_IMEX) {
-                       if (!set_properties || synaptics_init(psmouse) == 0)
+/*
+ * Try activating protocol, but check if support is enabled first, since
+ * we try detecting Synaptics even when protocol is disabled.
+ */
+                       if (synaptics_supported() &&
+                           (!set_properties || synaptics_init(psmouse) == 0)) {
                                return PSMOUSE_SYNAPTICS;
+                       }
+
 /*
  * Some Synaptics touchpads can emulate extended protocols (like IMPS/2).
  * Unfortunately Logitech/Genius probes confuse some firmware versions so
index 05689e7..d3f5243 100644 (file)
@@ -743,6 +743,11 @@ int synaptics_init(struct psmouse *psmouse)
        return -1;
 }
 
+bool synaptics_supported(void)
+{
+       return true;
+}
+
 #else /* CONFIG_MOUSE_PS2_SYNAPTICS */
 
 void __init synaptics_module_init(void)
@@ -754,5 +759,10 @@ int synaptics_init(struct psmouse *psmouse)
        return -ENOSYS;
 }
 
+bool synaptics_supported(void)
+{
+       return false;
+}
+
 #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
 
index 838e7f2..f0f40a3 100644 (file)
@@ -109,5 +109,6 @@ void synaptics_module_init(void);
 int synaptics_detect(struct psmouse *psmouse, bool set_properties);
 int synaptics_init(struct psmouse *psmouse);
 void synaptics_reset(struct psmouse *psmouse);
+bool synaptics_supported(void);
 
 #endif /* _SYNAPTICS_H */