Summary: | sysutils/battmond: battmond dies after first suspend | ||||||||
---|---|---|---|---|---|---|---|---|---|
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: |
|
Comment on attachment 220293 [details] proposed patch >--- battmond.c.orig 2020-12-05 20:19:13 UTC >+++ battmond.c >@@ -194,8 +194,7 @@ int main(int argc, char ** argv) > if (dosuspend) { // Suspend > syslog(LOG_EMERG, BATT_SUSP); > close(acpifd); >- execl("/usr/sbin/acpiconf", "acpiconf", "-s3", NULL); >- oops("execl"); >+ system("/usr/sbin/acpiconf -s3"); > } else { // Halt > syslog(LOG_EMERG, BATT_HALT); > close(acpifd); Created attachment 220296 [details]
proposed patch
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. :-) |
Created attachment 220293 [details] proposed patch I configured battmond to suspend instead of shutting down the system. In line 197 exec is used to invoke suspend: execl("/usr/sbin/acpiconf", "acpiconf", "-s3", NULL); As exec will replace the current process image with the new process, battmond is no longer running when the system resumes after battmond suspended for the first time. To make sure that battmond is running after resume, I see two possible solutions: 1.) Replace exec with system or 2.) Restart battmond on resume using rc-scripts I attached a patch for solution #1