uniq_

fix suspending ThinkPad S1 Yoga on Debian 10

On Debian 10 suspending ThinkPad S1 Yoga does not work for me. When I call systemctl suspend the device suspends and instantly wakes up again. I could fix it by flicking the XHC switch in /proc/acpi/wakeup. I used to use persist this in /etc/rc.local in the past. But it's not there anymore on Debian 10. So here's how I persisted this using a systemd unit:

cat << EOF | sudo bash -c 'cat > /etc/systemd/system/thinkpad-s1-suspend-fix.service'
[Unit]
Description=thinkpad_s1_suspend_fix

[Service]
Type=oneshot
ExecStart=bash -c 'grep 'XHC.*enabled' /proc/acpi/wakeup && echo XHC > /proc/acpi/wakeup'
StandardOutput=tty
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
EOF

Now lets tell systemd to apply this fix on boot and also apply it right now:

sudo systemctl enable thinkpad-s1-suspend-fix.service
sudo systemctl start thinkpad-s1-suspend-fix.service

written by uniq on 2019-10-08