Exec actions upon sleep and resume

Hello, I have a new work laptop (HP probook 430 G6) on which i have installed Silverblue.
The touchpad stops working when the laptop resumes from sleep.
The quickest workaround I have found is to modprobe -r i2c_hid and then modprobe i2c_hid after wake up.
I would like to automate this procedure by adding it to a script in /usr/lib/systemd/system-sleep as per man 8 systemd-sleep, but it is on the read-only bind mount.
I can create an rpm to drop my script there or is there another more convenient way?

You could do something similar to this: https://ask.fedoraproject.org/t/howto-fix-surface-pro-3-wifi-issues/2273 by using your own systemd service

1 Like

Thank you! This is the unit I wrote based on your suggestion:

[Unit]
Description=Touchpad workaround
After=suspend.target

[Service]
Type=oneshot
ExecStart=/usr/sbin/modprobe -rf i2c_hid ; /usr/sbin/modprobe i2c_hid

[Install]
WantedBy=suspend.target

It solved my problem.

2 Likes