Commit 2bc4298f authored by Dmitry Torokhov's avatar Dmitry Torokhov

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: c378b511 ("Input: psmouse - factor out common protocol probing code")
Reported-by: default avatarMatteo Croce <mcroce@redhat.com>
Tested-by: default avatarMatteo Croce <mcroce@redhat.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent faec44b6
...@@ -975,6 +975,21 @@ static void psmouse_apply_defaults(struct psmouse *psmouse) ...@@ -975,6 +975,21 @@ static void psmouse_apply_defaults(struct psmouse *psmouse)
psmouse->pt_deactivate = NULL; psmouse->pt_deactivate = NULL;
} }
static bool psmouse_do_detect(int (*detect)(struct psmouse *, bool),
struct psmouse *psmouse, bool allow_passthrough,
bool set_properties)
{
if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU &&
!allow_passthrough) {
return false;
}
if (set_properties)
psmouse_apply_defaults(psmouse);
return detect(psmouse, set_properties) == 0;
}
static bool psmouse_try_protocol(struct psmouse *psmouse, static bool psmouse_try_protocol(struct psmouse *psmouse,
enum psmouse_type type, enum psmouse_type type,
unsigned int *max_proto, unsigned int *max_proto,
...@@ -986,15 +1001,8 @@ static bool psmouse_try_protocol(struct psmouse *psmouse, ...@@ -986,15 +1001,8 @@ static bool psmouse_try_protocol(struct psmouse *psmouse,
if (!proto) if (!proto)
return false; return false;
if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU && if (!psmouse_do_detect(proto->detect, psmouse, proto->try_passthru,
!proto->try_passthru) { set_properties))
return false;
}
if (set_properties)
psmouse_apply_defaults(psmouse);
if (proto->detect(psmouse, set_properties) != 0)
return false; return false;
if (set_properties && proto->init && init_allowed) { if (set_properties && proto->init && init_allowed) {
...@@ -1027,8 +1035,8 @@ static int psmouse_extensions(struct psmouse *psmouse, ...@@ -1027,8 +1035,8 @@ static int psmouse_extensions(struct psmouse *psmouse,
* Always check for focaltech, this is safe as it uses pnp-id * Always check for focaltech, this is safe as it uses pnp-id
* matching. * matching.
*/ */
if (psmouse_try_protocol(psmouse, PSMOUSE_FOCALTECH, if (psmouse_do_detect(focaltech_detect,
&max_proto, set_properties, false)) { psmouse, false, set_properties)) {
if (max_proto > PSMOUSE_IMEX && if (max_proto > PSMOUSE_IMEX &&
IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH) && IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH) &&
(!set_properties || focaltech_init(psmouse) == 0)) { (!set_properties || focaltech_init(psmouse) == 0)) {
...@@ -1074,8 +1082,8 @@ static int psmouse_extensions(struct psmouse *psmouse, ...@@ -1074,8 +1082,8 @@ static int psmouse_extensions(struct psmouse *psmouse,
* probing for IntelliMouse. * probing for IntelliMouse.
*/ */
if (max_proto > PSMOUSE_PS2 && if (max_proto > PSMOUSE_PS2 &&
psmouse_try_protocol(psmouse, PSMOUSE_SYNAPTICS, &max_proto, psmouse_do_detect(synaptics_detect,
set_properties, false)) { psmouse, false, set_properties)) {
synaptics_hardware = true; synaptics_hardware = true;
if (max_proto > PSMOUSE_IMEX) { if (max_proto > PSMOUSE_IMEX) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment