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.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=b64f1988e365b12baed8efb0e99a07299f8741e2 commit b64f1988e365b12baed8efb0e99a07299f8741e2 Author: Alexandre C. Guimarães <rigoletto@FreeBSD.org> AuthorDate: 2021-04-11 13:08:15 +0000 Commit: Alexandre C. Guimarães <rigoletto@FreeBSD.org> CommitDate: 2021-04-11 13:08:15 +0000 sysutils/battmond: Fix battmond dies after first suspend - Fix won't acting if battery level suddenly drops to zero PR: 251618 251619 Submitted by: dirtystickyfloor@web.de Approved by: ntarmos@gmail.com (maintainer timeout, 127 days) sysutils/battmond/files/patch-battmond.c (new) | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
Committed. Thanks. :-)