linux-surface / linux-surface

Linux Kernel for Surface Devices
4.62k stars 201 forks source link

Surface Laptop Studio acpi_listen not detecting insertion/removal of AC adapter #1326

Closed BlueCreeper512 closed 5 months ago

BlueCreeper512 commented 5 months ago

When removing or inserting the AC adapter, no power/AC adapter events are logged in the terminal when running acpi_listen, however the battery driver itself does appear to be working as the battery icon does show up in the top menu bar and it seems to be able to tell that the AC power has been removed. Also only power events seem to not show up in acpi_listen as adjusting volume/brightness and pressing the power button all get logged.

As far as I can tell this issue seems to be the cause for another issue where the PowerMizer Power Source readout in the NVIDIA X Server Settings displays "Error" when waking from the D3cold state causing the 3050 Ti to always be stuck with a 10W power limit and the lowest clock speeds even when a graphically intensive load is applied.

dmesg output: https://pastebin.com/vxaE2xMe

qzed commented 5 months ago

That is the expected behavior. acpi_listen only listens to ACPI events, so it will only work as long as the battery is implemented via ACPI (and thus sends ACPI events). On newer Surface devices, that is not the case and they instead use their own interface and driver. So those devices cannot send ACPI battery events.

I suggest you instead try upower (e.g., via upower -m), which will actually listen to battery events. Note that the kernel sends battery events regardless of how the battery is implemented. This is how the different desktop envs implement battery status information.

BlueCreeper512 commented 5 months ago

Note that the kernel sends battery events regardless of how the battery is implemented. This is how the different desktop envs implement battery status information.

So that means that the NVIDIA driver/PowerMizer should be detecting the AC adapter insertion/removal regardless of whether the battery is implemented via ACPI or in this case, its own interface and driver correct?

qzed commented 5 months ago

I would hope so. Ideally, it would just use either the kernel's /sys/class/power_supply interface directly or use upower. But I'm really not sure how that program works. In the past, I think some programs did just listen to the ACPI events (but I think those were mostly more on the side of custom scripts for stuff like xmonad or some other of these heavily customizable desktop managers though).

BlueCreeper512 commented 5 months ago

Okay, thanks for the help. I guess I'll have to ask this one over on the NVIDIA forums.