2022.08 Vol. 1

A 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.

  1. I enabled systemd debug logging and don’t see anything triggering suspend on undocking
  2. I don’t see anything triggering suspend in dmesg
  3. 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)
  4. If I disable the HandleLidSwitch setting 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.