Bug 251618 - sysutils/battmond: battmond won't act if battery level suddenly drops to zero
Summary: sysutils/battmond: battmond won't act if battery level suddenly drops to zero
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-05 20:40 UTC by dirtystickyfloor
Modified: 2020-12-05 20:40 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (ntarmos)


Attachments
proposed patch (418 bytes, text/plain)
2020-12-05 20:40 UTC, dirtystickyfloor
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description dirtystickyfloor 2020-12-05 20:40:18 UTC
Created attachment 220292 [details]
proposed patch

I configured battmond to suspend (option -z) after reaching a threshold of 5% (-H 5). In some cases, e.g. when running the system under high load and/or if the battery becomes old, it is not unusual that the battery level drops suddenly from more than 5 percent to zero percent. In this case the system will shut off unexpectedly instead of going to sleep. This is because battmond checks for remaining capacity greater than zero and not greater than or equal to zero (Line 192 in battmond.c).

Patchfile attached.