@Gordon The main reason I did not make it the script return 0 when no battery is detected, is because the same way we fail to detect a power source although one exists, we might also be failing to detect a battery when one might also exist. Currently the 255 error code is handled as if you are on power in packages like unattended upgrades. Not directly exiting the script with 0 on no battery gives us a chance to run the remaining methods the script has. These might be able to detect a power source and tell if it is online or offline. Otherwise 255 will be returned.
Having said so, systemd does ignore this case and considers a machine with no battery as directly online. So I have did the change now to emulate this behavior although it could mean that the reporting might be less accurate, I made sure that it will only return that the system is online if all other checks fail and a battery is not detected. You can test the latest version of the MR and confirm if it is working as intended now on your system. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1980991 Title: /usr/sbin/on_ac_power incorrectly reporting ac power status To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/powermgmt-base/+bug/1980991/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
