Skip to content

Commit e4e6efd

Browse files
Daniel Drakedtor
authored andcommitted
Input: psmouse - fix Synaptics detection when protocol is disabled
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>
1 parent 6f2701b commit e4e6efd

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

‎drivers/input/mouse/psmouse-base.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,15 @@ static int psmouse_extensions(struct psmouse *psmouse,
627627
synaptics_hardware = true;
628628

629629
if (max_proto > PSMOUSE_IMEX) {
630-
if (!set_properties || synaptics_init(psmouse) == 0)
630+
/*
631+
* Try activating protocol, but check if support is enabled first, since
632+
* we try detecting Synaptics even when protocol is disabled.
633+
*/
634+
if (synaptics_supported() &&
635+
(!set_properties || synaptics_init(psmouse) == 0)) {
631636
return PSMOUSE_SYNAPTICS;
637+
}
638+
632639
/*
633640
* Some Synaptics touchpads can emulate extended protocols (like IMPS/2).
634641
* Unfortunately Logitech/Genius probes confuse some firmware versions so

‎drivers/input/mouse/synaptics.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,11 @@ int synaptics_init(struct psmouse *psmouse)
743743
return -1;
744744
}
745745

746+
bool synaptics_supported(void)
747+
{
748+
return true;
749+
}
750+
746751
#else /* CONFIG_MOUSE_PS2_SYNAPTICS */
747752

748753
void __init synaptics_module_init(void)
@@ -754,5 +759,10 @@ int synaptics_init(struct psmouse *psmouse)
754759
return -ENOSYS;
755760
}
756761

762+
bool synaptics_supported(void)
763+
{
764+
return false;
765+
}
766+
757767
#endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
758768

‎drivers/input/mouse/synaptics.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,6 @@ void synaptics_module_init(void);
109109
int synaptics_detect(struct psmouse *psmouse, bool set_properties);
110110
int synaptics_init(struct psmouse *psmouse);
111111
void synaptics_reset(struct psmouse *psmouse);
112+
bool synaptics_supported(void);
112113

113114
#endif /* _SYNAPTICS_H */

0 commit comments

Comments
 (0)