1

I have a Lenovo thinkpad X1 carbon 7th gen. When I enter suspend (by any method) the laptop wakes from suspend by itself. I noticed that this behavior only occurs when the laptop is docked (Lenovo USB-C gen2 dock), since I use my laptop docked 90% of the time it is important to get suspend working.

Things I have tried:

Disabling all PCI wakeup:

cat /proc/acpi/wakeup

Then setting echo <deviceHere> > /proc/acpi/wakeup for all enabled devices (except LID so that I can resume by lid if needed)

Disabling all USB wakeup:

cat /sys/bus/usb/devices/*/power/wakeup

ll /sys/bus/usb/devices/*/power/wakeup

Then setting echo "disabled" > /sys/bus/usb/devices/<deviceHere>/power/wakeup for all enabled devices

0

I noticed that there were two PXSX devices when running cat /proc/acpi/wakeup

PXSX      S4    *disabled
PXSX      S4    *enabled   pci:0000:05:00.0

When I tried to disable PXSX via command echo PXSX > /proc/acpi/wakeup then nothing happened (one PXSX stayed enabled and one stayed disabled, I assume this is because this command could not reach the second PXSX.

I also tried running acpitool -w then acpitool -W <deviceNumberHere> to disable the second PXSX, which was unsuccessful. I'm not sure why wake cannot be disabled on this second PXSX device.

This device only appears when the laptop is docked so it is safe to assume this device is part of the dock.

Next step was to somehow disable this device to stop it from waking the laptop. I found the command echo 1 > /sys/bus/pci/devices/0000:05:00.0/remove would disable this PCI device. After running this command, suspend worked correctly! The only problem is that if I tried to perform suspend again the laptop would exhibit the previous behavior (immediate wake). This was confirmed by running cat /proc/acpi/wakeup to see that PXSX had re-enabled itself: somehow during wake the device was re-enabling itself.

My next idea was to disable this device during pre-suspend. I created this file: /lib/systemd/system-sleep/pre-suspend.sh, made it executable and wrote these contents:

#!/bin/sh

case $1 in
  pre)
    echo 1 > /sys/bus/pci/devices/0000:05:00.0/remove
    ;;
esac

This code ensures that the problem device will be disabled immediately prior to suspending. Currently, my laptop successfully sleeps without waking itself 100% of the time.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.