Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: psmouse - fix Synaptics detection when protocol is disabled

When Synaptics protocol is disabled, we still need to try and detect the
hardware, so we can switch to SMBus device if SMbus is detected, or we know
that it is Synaptics device and reset it properly for the bare PS/2
protocol.

Fixes: c378b5119eb0 ("Input: psmouse - factor out common protocol probing code")
Reported-by: Matteo Croce <mcroce@redhat.com>
Tested-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+21 -13
+21 -13
drivers/input/mouse/psmouse-base.c
··· 975 975 psmouse->pt_deactivate = NULL; 976 976 } 977 977 978 + static bool psmouse_do_detect(int (*detect)(struct psmouse *, bool), 979 + struct psmouse *psmouse, bool allow_passthrough, 980 + bool set_properties) 981 + { 982 + if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU && 983 + !allow_passthrough) { 984 + return false; 985 + } 986 + 987 + if (set_properties) 988 + psmouse_apply_defaults(psmouse); 989 + 990 + return detect(psmouse, set_properties) == 0; 991 + } 992 + 978 993 static bool psmouse_try_protocol(struct psmouse *psmouse, 979 994 enum psmouse_type type, 980 995 unsigned int *max_proto, ··· 1001 986 if (!proto) 1002 987 return false; 1003 988 1004 - if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU && 1005 - !proto->try_passthru) { 1006 - return false; 1007 - } 1008 - 1009 - if (set_properties) 1010 - psmouse_apply_defaults(psmouse); 1011 - 1012 - if (proto->detect(psmouse, set_properties) != 0) 989 + if (!psmouse_do_detect(proto->detect, psmouse, proto->try_passthru, 990 + set_properties)) 1013 991 return false; 1014 992 1015 993 if (set_properties && proto->init && init_allowed) { ··· 1035 1027 * Always check for focaltech, this is safe as it uses pnp-id 1036 1028 * matching. 1037 1029 */ 1038 - if (psmouse_try_protocol(psmouse, PSMOUSE_FOCALTECH, 1039 - &max_proto, set_properties, false)) { 1030 + if (psmouse_do_detect(focaltech_detect, 1031 + psmouse, false, set_properties)) { 1040 1032 if (max_proto > PSMOUSE_IMEX && 1041 1033 IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH) && 1042 1034 (!set_properties || focaltech_init(psmouse) == 0)) { ··· 1082 1074 * probing for IntelliMouse. 1083 1075 */ 1084 1076 if (max_proto > PSMOUSE_PS2 && 1085 - psmouse_try_protocol(psmouse, PSMOUSE_SYNAPTICS, &max_proto, 1086 - set_properties, false)) { 1077 + psmouse_do_detect(synaptics_detect, 1078 + psmouse, false, set_properties)) { 1087 1079 synaptics_hardware = true; 1088 1080 1089 1081 if (max_proto > PSMOUSE_IMEX) {