From 8851f78a2b04aee0e3f316fb54f6d94c87f97faa Mon Sep 17 00:00:00 2001 From: goose121 Date: Wed, 9 Jul 2025 15:13:34 -0600 Subject: [PATCH] Use absolute value of current_now It seems on my system that there has been a recent kernel change where `current_now` is reported negative when discharging, leading to no reported time remaining, only a dash; given this is only on certain kernel versions, it is perhaps better to just take the absolute value of `current_now` when calculating time remaining, just to remain compatible with both --- modeline/battery-portable/battery-portable.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modeline/battery-portable/battery-portable.lisp b/modeline/battery-portable/battery-portable.lisp index 56f7e29..6e84668 100644 --- a/modeline/battery-portable/battery-portable.lisp +++ b/modeline/battery-portable/battery-portable.lisp @@ -209,7 +209,7 @@ (sysfs-int-field path "charge_now"))) (consumption () (or (sysfs-int-field path "power_now") - (sysfs-int-field path "current_now"))) + (abs (sysfs-int-field path "current_now")))) (capacity-native () (sysfs-int-field path "capacity")) (capacity-calculate ()