You are not logged in.
Hi,
I think I'm close to getting what I need, but I might need some help with proper syntax.
I need to unload and reload a kernel module after waking from suspend2disk.
Basically i'm trying to avoid typing: 'sudo rmmod cyapa && modprobe cyapa' everytime my laptop wakes to re-enable my laptop's touchpad.
I know I need to make a systemd unit depending on the hibernate service. So here are the two units I use. The first is the hibernate service I use to suspend2disk. The second is the systemd unit i made to unload and reload the cyapa module for my touchpad. I can suspend with the hibernate service file no problem. But when I have the resume module in the directory I can't hibernate or do what the script does. Any insight would be great.
hibernate service:
[Unit]
Description=Hibernate
Documentation=man:systemd-suspend.service(8)
DefaultDependencies=no
Requires=sleep.target
After=sleep.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c 's2disk && run-parts --regex .\* -a post /usr/lib/systemd/system-sleep'
moduleloading/resume service:
local-system-resume.service
[Unit]
Description=Local system resume actions
After=hibernate.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/rmmod cyapa && /usr/sbin/modprobe cyapa
[Install]
WantedBy=hibernate.target
Offline
Why are you using s2disk and not systemd's hibernation?
systemd on sleep/hibernation/resume/thaw runs scripts in /usr/lib/systemd/system-sleep and your ExecStart partly emulates that - you could put a script there running rmmod & modprobe in case of "post".
Offline
You can also use this handy script which basically does the same as described by lucke:
Offline