fix(battery): Make it possible to disable polling
This commit is contained in:
parent
0052ebc7a9
commit
de1d5f3f4a
@ -205,7 +205,8 @@ the resulting output might not be award-winning.
|
||||
;battery = BAT0
|
||||
;adapter = ADP1
|
||||
|
||||
; Seconds between reading battery capacity
|
||||
; Seconds between reading battery capacity.
|
||||
; If set to 0, polling will be disabled.
|
||||
;poll_interval = 3
|
||||
~~~
|
||||
|
||||
|
@ -78,7 +78,7 @@ void BatteryModule::subthread_runner()
|
||||
|
||||
// TODO(jaagr): Keep track of when the values were last read to determine
|
||||
// if we need to trigger the event manually or not.
|
||||
if ((++i % poll_seconds) == 0) {
|
||||
if (poll_seconds > 0 && (++i % poll_seconds) == 0) {
|
||||
// Trigger an inotify event in case the underlying filesystem doesn't
|
||||
log_debug("Poll battery capacity");
|
||||
io::file::get_contents("/sys/class/power_supply/BAT0/capacity");
|
||||
|
Loading…
Reference in New Issue
Block a user