diff options
author | Paul Fertser <fercerpav@gmail.com> | 2020-02-11 09:37:58 +0300 |
---|---|---|
committer | Paul Fertser <fercerpav@gmail.com> | 2020-02-11 09:48:21 +0300 |
commit | f0eb83eb8234add5a4248a6084ebd57953b29c2d (patch) | |
tree | fb78714cc829410565cbcfaba65b5e63489d5c8a /src/Xmobar/Plugins/Monitors | |
parent | 690446b534a1d88b64030cb300f0178b4680b0d8 (diff) | |
download | xmobar-f0eb83eb8234add5a4248a6084ebd57953b29c2d.tar.gz xmobar-f0eb83eb8234add5a4248a6084ebd57953b29c2d.tar.bz2 |
Battery: fix time calculations on some Linux systems
The calculations are based on the assumption that current_now (or
power_now) are always positive. However, power_supply documentation in
the kernel sources say nothing about it, and so some drivers provide a
signed value (e.g. bq27xxx_battery_current).
Discovered and fixed on ac100/paz00 netbook.
Diffstat (limited to 'src/Xmobar/Plugins/Monitors')
-rw-r--r-- | src/Xmobar/Plugins/Monitors/Batt.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Batt.hs b/src/Xmobar/Plugins/Monitors/Batt.hs index 4ea7591..af932ae 100644 --- a/src/Xmobar/Plugins/Monitors/Batt.hs +++ b/src/Xmobar/Plugins/Monitors/Batt.hs @@ -227,7 +227,7 @@ readBattery sc files = a' = max a b -- sometimes the reported max charge is lower than return $ Battery (3600 * a' / sc') -- wattseconds (3600 * b / sc') -- wattseconds - (d / sc') -- watts + (abs d / sc') -- watts s -- string: Discharging/Charging/Full where grab f = handle onError $ withFile f ReadMode (fmap read . hGetLine) onError = const (return (-1)) :: SomeException -> IO Float |