Little bit of suspend
It Just Works
In a weird twist, the suspend functionality on my T14 is working with my shiny thunderbolt 4 dock. These settings have been difficult for me in the past, requiring systemd tweaks and udev rules. But without any of that yet, if I plug the laptop in with its lid shut, it resumes and uses the hub for display. And if I unplug the laptop with its lid shut, it suspends.
Previously that first step would require a udev rule to enable power on settings for a USB device. This new ThinkPad uses
S2Idle suspension instead of the classic
S3 to memory. My hunch is this is what is allowing wakeup to work outta the box.
I am at a complete loss as to why the unplugging is working as I want it.
Systemd’s logind provides the “high” level interface for controlling suspend and hibernate settings. Historically (and still mentioned in the Arch docs on Power Management), logind could only process “lid” events (e.g. opening or closing a laptop’s lid). So “if the lid closes, please trigger a suspend”. It also exposed a few settings like “don’t trigger if plugged in”. What is not listed is any sort of “if unplugged, trigger suspend”. The power supply events are not handled by logind. Or so I thought.
I have done quite a bit of debugging which is leading me to think that these power events are being handled by logind, but no smoking gun proof.
- I enabled systemd debug logging and don’t see anything triggering suspend on undocking
- I don’t see anything triggering suspend in dmesg
- I have combed through my system’s udev rules and don’t see anything triggering suspend or listening for power supply events (which is how I would have guessed this was being implemented)
- If I disable the
HandleLidSwitchsetting in logind, it stops working… (maybe the most smokey of the points)
Despite this, I haven’t found anything online which would indicate that logind is supporting power supply events these days. I’ll try to just be happy that it just works.
UPDATE – Did a test where the dock is plugged into a USB C port which doesn’t supply power and saw the same behavior. So it doesn’t look like logind supports power events, but instead,
HandleLidSwitch might be called when there are no active screens.