Having got used to my replacement laptop, I’ve decided to keep using it, but there was one thing annoying me - the trackpad!
The trackpad is definately not the same quality as the MacBook Pro I was used to, but I could cope as the main features are there. However, I often move around a lot going from meeting to meeting, making use of the sleep/suspend capability.
That was when the trouble started…
Upon waking from suspend, the touchpad was sluggish and jumping all over the place, rendering the machine unusable without a mouse!
The best way it seemed to get the touchpad to behave was to add post suspend script using systemd to reload the driver. A little hacky but effective!
Systemd and Suspend/Hibernation Hooks
It is really easy to perform an action either before or after you suspend, with systemd providing a nice script based hook within its systemd-suspend.service system service.
To use this, all you need to do is put an executable script under /usr/lib/systemd/system-sleep/ that checks whether the first argument is ‘pre’ for before the system suspends, or ‘post’ for after the system wakes. The script can have any name.
You can see more information in it’s man page:
To sort this once and for all on the HP ProBook I wrote the following into a file called /lib/systemd/system-sleep/touchpad-reload:
#!/bin/sh case $1 in post) /sbin/rmmod i2c_hid && /sbin/modprobe i2c_hid ;; esac
And now the touchpad is as happy post-suspend as it is on a fresh restart. Happy days!