@@ -284,9 +284,6 @@ static int focaltech_switch_protocol(struct psmouse *psmouse)
if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETSCALE11))
return -EIO;
- if (ps2_command(ps2dev, param, PSMOUSE_CMD_ENABLE))
- return -EIO;
-
return 0;
}
@@ -413,6 +410,8 @@ int focaltech_init(struct psmouse *psmouse)
/* resync is not supported yet */
psmouse->resync_time = 0;
+ psmouse->skip_standard_init = true;
+
return 0;
fail:
@@ -697,6 +697,8 @@ static void psmouse_apply_defaults(struct psmouse *psmouse)
psmouse->cleanup = NULL;
psmouse->pt_activate = NULL;
psmouse->pt_deactivate = NULL;
+
+ psmouse->skip_standard_init = false;
}
/*
@@ -1157,7 +1159,7 @@ static void psmouse_initialize(struct psmouse *psmouse)
* We set the mouse report rate, resolution and scaling.
*/
- if (psmouse_max_proto != PSMOUSE_PS2) {
+ if (psmouse_max_proto != PSMOUSE_PS2 && !psmouse->skip_standard_init) {
psmouse->set_rate(psmouse, psmouse->rate);
psmouse->set_resolution(psmouse, psmouse->resolution);
ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11);
@@ -64,6 +64,11 @@ struct psmouse {
unsigned int resync_time;
bool smartscroll; /* Logitech only */
+ /* FocalTech touchpads sometimes stop responding when standard commands
+ * are sent after the custom protocol has been selected, so this flag
+ * makes the code skip psmouse_initialize */
+ bool skip_standard_init;
+
psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse);
void (*set_rate)(struct psmouse *psmouse, unsigned int rate);
void (*set_resolution)(struct psmouse *psmouse, unsigned int resolution);
The driver used to skip all initialization code for FocalTech touchpads because they stop responding when certain commands are sent. The new driver failed reproduce this behaviour and psmouse_reconnect would still cause standard initialization code to be executed. This patch introduces a field "skip_standard_init" to struct psmouse. If this field is set to true, psmouse_initialize will not do anything. This solution is somewhat ugly, but I believe it is the least ugly way to introduce this apparently required special case. Also, the code is modified to not send PSMOUSE_CMD_ENABLE twice (once in focaltech.c, once in the generic code in psmouse-base.c). Signed-off-by: Mathias Gottschlag <mgottschlag@gmail.com> --- drivers/input/mouse/focaltech.c | 5 ++--- drivers/input/mouse/psmouse-base.c | 4 +++- drivers/input/mouse/psmouse.h | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-)