Package: systemd
Version: 251.5-1

Hi,

logind seems confused

# busctl get-property org.freedesktop.login1 /org/freedesktop/login1 
org.freedesktop.login1.Manager OnExternalPower
b true
# /lib/systemd/systemd-ac-power  --verbose
no
#

The system in question actually is running on battery. Both appear to be
using the on_ac_power() C function. When running strace on the latter
one can vaguely guess that on_ac_power() is actually run. When running
strace on logind however, the sendmsg call happens immediately after the
recvmsg call, so it seems like on_ac_power() is not actually run, but
the value is cached or something. During boot, the system in question
was on ac power.

Looking closer, I now guess that the issue is here:
https://sources.debian.org/src/systemd/251.5-2/src/login/logind-dbus.c/?hl=380#L380

Could it be that the function pointer is converted to boolean rather
than being called? I.e. could it be that the function should actually be
called?

-static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_on_external_power, "b", 
manager_is_on_external_power);
+static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_on_external_power, "b", 
manager_is_on_external_power());

Admittedly, I've not tested this, because restarting logind is so
annoying as it kills all login sessions. So this could be a red herring.

Helmut

Reply via email to