Skip to content

Commit c853246

Browse files
Zongmin Zhoudtor
authored andcommitted
Input: vmmouse - disable vmmouse before entering suspend mode
Currently, when trying to suspend and resume with VirtualPS/2 VMMouse there is an error message after resuming: psmouse serio1: vmmouse: Unable to re-enable mouse when reconnecting, err: -6 and the mouse will no longer be operable, requiring full rescan to find a another driver to use for the port. This error is due to QEMU still generating PS2 events which the kernel is not consuming until resume time, where they interfere with mouse identification and ultimately resulting in an error getting VMMOUSE_VERSION_ID. Test scenario: 1) start virtual machine with qemu command "vmport=on" 2) click suspend botton to enter suspend mode 3) resume and observe the error message in the kernel logs Let's fix this by disabling the vmmouse in its reset handler. This will notify qemu to stop vmmouse and remove the handler. Signed-off-by: Zongmin Zhou<zhouzongmin@kylinos.cn> Reviewed-by: Zack Rusin <zackr@vmware.com> Link: https://lore.kernel.org/r/20220322021046.1087954-1-zhouzongmin@kylinos.cn Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 1b3ce51 commit c853246

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/input/mouse/vmmouse.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,19 @@ int vmmouse_detect(struct psmouse *psmouse, bool set_properties)
365365
return 0;
366366
}
367367

368+
/**
369+
* vmmouse_reset - Disable vmmouse and reset
370+
*
371+
* @psmouse: Pointer to the psmouse struct
372+
*
373+
* Tries to disable vmmouse mode before enter suspend.
374+
*/
375+
static void vmmouse_reset(struct psmouse *psmouse)
376+
{
377+
vmmouse_disable(psmouse);
378+
psmouse_reset(psmouse);
379+
}
380+
368381
/**
369382
* vmmouse_disconnect - Take down vmmouse driver
370383
*
@@ -472,6 +485,7 @@ int vmmouse_init(struct psmouse *psmouse)
472485
psmouse->protocol_handler = vmmouse_process_byte;
473486
psmouse->disconnect = vmmouse_disconnect;
474487
psmouse->reconnect = vmmouse_reconnect;
488+
psmouse->cleanup = vmmouse_reset;
475489

476490
return 0;
477491

0 commit comments

Comments
 (0)