On start up, on_ac_power on my system always return 1 instead of 0 (even though AC adapter is plugged in). If I unplug then plug the adapter, it will return 0 correctly.

Is there a way to force on_ac_power to "recheck" the AC status at system start up instead of having to unplug-plug the adapter?

My system's info:

  • Kernel: 4.18.0-17-generic
  • Laptop: MacBook Air 2015
  • It is a command, not a shell variable. Its exit code determine whether the system is on ac power or not. 0 is true, 1 is false.
    – herophuong
    Apr 9 '19 at 12:15
  • I'm on kernel 4.14.110 and my Dell AW17R3 laptop has been plugged in for the last 100 boots or more. When typing: if on_ac_power ; then echo YES ; fi the response is YES. Maybe it's not the software but rather the hardware or your configuration? Apr 10 '19 at 0:19
  • I know that this problem is unique to my system. That's why I ask for a way to "force refresh" it. Battery indicator in my desktop always shows the ac status correctly.
    – herophuong
    Apr 11 '19 at 3:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.