aboutsummaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorAlexandre C. GuimarĂ£es <rigoletto@FreeBSD.org>2021-04-11 13:08:15 +0000
committerAlexandre C. GuimarĂ£es <rigoletto@FreeBSD.org>2021-04-11 13:08:15 +0000
commitb64f1988e365b12baed8efb0e99a07299f8741e2 (patch)
tree8c21d04ba92ac6e8a7d99f3b3ac9d1eff9f25703 /sysutils
parent9d896e7d87153dcadfe72247d08130b7569e1790 (diff)
downloadports-b64f1988e365b12baed8efb0e99a07299f8741e2.tar.gz
ports-b64f1988e365b12baed8efb0e99a07299f8741e2.zip
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)
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/battmond/files/patch-battmond.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sysutils/battmond/files/patch-battmond.c b/sysutils/battmond/files/patch-battmond.c
new file mode 100644
index 000000000000..1da5a1b6eb42
--- /dev/null
+++ b/sysutils/battmond/files/patch-battmond.c
@@ -0,0 +1,18 @@
+--- battmond.c.orig 2021-04-11 13:03:15 UTC
++++ battmond.c
+@@ -189,13 +189,12 @@ int main(int argc, char ** argv)
+ #ifdef DEBUG
+ fprintf(stderr, "Total battery capacity: %d%%\n", total_cap);
+ #endif
+- if (num_discharging && !num_charging && total_cap > 0) {
++ if (num_discharging && !num_charging && total_cap >= 0) {
+ if (total_cap <= halt) {
+ 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);