From 13119207dab02305cecaa50212a738d575e2c05a Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sat, 10 Jun 2023 00:30:41 +0800 Subject: [PATCH] battery-util: debug log when we're unsure about the battery level --- src/shared/battery-util.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/shared/battery-util.c b/src/shared/battery-util.c index 948a5e3b9d6..43d72f9db75 100644 --- a/src/shared/battery-util.c +++ b/src/shared/battery-util.c @@ -267,13 +267,11 @@ int battery_is_discharging_and_low(void) { } /* If we found a battery whose state we couldn't read, don't assume we are in low battery state */ - if (unsure) + if (unsure) { + log_debug("Found battery with unreadable state, assuming not in low battery state."); return false; + } - /* Found no charged battery, but did find low batteries */ - if (found_low) - return true; - - /* Found neither charged nor low batteries? let's return that we aren't on low battery state */ - return false; + /* If found neither charged nor low batteries, assume that we aren't in low battery state */ + return found_low; }