Bug 251618

Summary: sysutils/battmond: battmond won't act if battery level suddenly drops to zero
Product: Ports & Packages Reporter: dirtystickyfloor
Component: Individual Port(s)Assignee: Alexandre C. Guimarães <rigoletto>
Status: Closed FIXED    
Severity: Affects Some People CC: ntarmos, rigoletto
Priority: --- Flags: dirtystickyfloor: maintainer-feedback-
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
proposed patch none

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.
Comment 1 commit-hook freebsd_committer freebsd_triage 2021-04-11 13:14:30 UTC
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(+)
Comment 2 Alexandre C. Guimarães freebsd_committer freebsd_triage 2021-04-11 13:15:33 UTC
Committed. Thanks. :-)