summaryrefslogtreecommitdiffstats
path: root/desktop/lxpanel/fix_battery_alarm.patch
blob: 27536194444049922ddfbdcd3a74b3267f514b2f (plain)
From 19936f24c343437447ef7e765113fc4679df07eb Mon Sep 17 00:00:00 2001
From: Andriy Grytsenko <andrej@rep.kiev.ua>
Date: Wed, 27 Feb 2019 02:49:00 +0200
Subject: [PATCH] fix battery alarm when measurement of current is missing.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=854643
---
 ChangeLog           | 4 ++++
 plugins/batt/batt.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index c0861de..0d610c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+0.10.1
+-------------------------------------------------------------------------
+* Fixed battery alarm when measurement of current is missing.
+
 0.10.0
 -------------------------------------------------------------------------
 * Fixed delayed application of font cnahges on dclock and weather plugins.
diff --git a/plugins/batt/batt.c b/plugins/batt/batt.c
index f47549c..cc7bfea 100644
--- a/plugins/batt/batt.c
+++ b/plugins/batt/batt.c
@@ -111,6 +111,7 @@ static void * alarmProcess(void *arg) {
     sem_wait(a->lock);
     if (system(a->command) != 0)
         g_warning("plugin batt: failed to execute alarm command \"%s\"", a->command);
+    sleep(51); /* do not spam messages more often than once a minute */
     sem_post(a->lock);
 
     g_free(a);
@@ -257,7 +258,7 @@ void update_display(lx_battery *lx_b, gboolean repaint) {
         isCharging = battery_is_charging ( b );
 
     /* Consider running the alarm command */
-    if ( !isCharging && rate > 0 &&
+    if ( !isCharging &&
         ( ( battery_get_remaining( b ) / 60 ) < (int)lx_b->alarmTime ) )
     {
         /* FIXME: this should be done using glibs process functions */
-- 
2.1.4