## hpr3536 :: Laptop power problems

 This is a story of a laptop with two power problems.
The first and less severe is that sometimes the charging of the battery will get stuck at a certain percentage. This is not simply due to the effect commonly found with aging batteries but a fault with the laptop's charging hardware. A full reset of the charging system can fix it, which for this ASUS Zenbook UX550vd laptop requires a long press — meaning 40 seconds — from its shutdown state.
The second and more serious issue is that the laptop thinks that it is plugged into AC power even when it is running only on battery. I ruled out an operating system or software issue because the issue remains whether running GNU/linux or Windows. The problem is serious because the power management software, in my case in KDE, will not respond to critically low battery levels by suspending or gracefully shutting down. It may be that a sudden loss of power damaged the previous SSD in this laptop, which was the subject of HPR 3428.
My first attempt to fool KDE into seeing accurate battery information under /sys/class/power_supply/BAT0 using an overlay filesystem failed presumably because KDE's power system is listening out for some kind of event rather than simply monitoring those files. My second and successful attempt involved writing my own bash scripts run by cron to monitor battery levels and initiate actions when they got too low. There were errors with comedic consequences along the way. In fact, while writing these shownotes after I finished recording the audio, the laptop suspended itself because of a bug in my script - I used le (less than or equal to) rather than lt (less than) in my test for a change in the battery charge leading to unintended and fun consequences when the battery was fully charged.
