From: Mike Yuan Date: Fri, 9 Jun 2023 16:30:41 +0000 (+0800) Subject: battery-util: debug log when we're unsure about the battery level X-Git-Tag: v254-rc1~239 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13119207dab02305cecaa50212a738d575e2c05a;p=thirdparty%2Fsystemd.git battery-util: debug log when we're unsure about the battery level --- 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; }