Ubuntu 18.04 mouse issues after suspend

Solution 1:

Faced this problem today and this is what worked for me.

Make sure your device module is psmouse by running,

lsmod | grep psmouse

if its not, find the relavant module name.

$ cd /lib/systemd/system-sleep/
$ sudo vi fixtouchpad

then paste and save the following

#!/bin/bash
[ "$1" = "post" ] && exec modprobe psmouse
[ "$1" = "pre" ] && exec rmmod psmouse
exit 0

This will reload your psmouse module after resuming. Replace 'psmouse' with your module name.

Be sure to make the script executable

sudo chmod +x fixtouchpad

Solution 2:

I was having similar issues with 18.04 and they actually got worse since upgrading to 18.10. I have a Logitech "unifying receiver" that has both a mouse and keyboard paired with it. When resuming from sleep, fairly often either the mouse or the keyboard no longer work. I don't remember suffering these issues with 17.10...

The following script fixed it for me:

for mod in hid_logitech_hidpp hid_logitech_dj usbhid; do
   sudo rmmod $mod && sleep 3
   sudo modprobe $mod
done

If you create a script with this, don't forget to make it executable, eg with chmod +x $HOME/fix_logitech.sh

(not sure what the various modules are for but they looked like good candidates). I used my laptop's integrated keyboard to type this. If the approach works, I might consider @imeshU's approach to hook this into the System-D sleep/resume process.