Fixing battery alarm when measurement of current is missing (Closes: #854643).
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Wed, 27 Feb 2019 00:51:33 +0000 (02:51 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Wed, 27 Feb 2019 00:51:33 +0000 (02:51 +0200)
debian/patches/50-fix-battery-notification.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/50-fix-battery-notification.patch b/debian/patches/50-fix-battery-notification.patch
new file mode 100644 (file)
index 0000000..db8e2af
--- /dev/null
@@ -0,0 +1,22 @@
+Author: Andriy Grytsenko <andrej@rep.kiev.ua>
+Description: fix battery alarm when measurement of current is missing.
+
+--- a/plugins/batt/batt.c
++++ b/plugins/batt/batt.c
+@@ -111,6 +111,7 @@
+     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 @@
+         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 */
index cf92e56..d79a5fc 100644 (file)
@@ -1 +1,2 @@
 01-default-config.patch
+50-fix-battery-notification.patch