summaryrefslogtreecommitdiffstats
path: root/desktop/lxpanel/patches/0001-Fix-battery-selection-it-appears-incompatible-with-0.patch
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/lxpanel/patches/0001-Fix-battery-selection-it-appears-incompatible-with-0.patch')
-rw-r--r--desktop/lxpanel/patches/0001-Fix-battery-selection-it-appears-incompatible-with-0.patch115
1 files changed, 115 insertions, 0 deletions
diff --git a/desktop/lxpanel/patches/0001-Fix-battery-selection-it-appears-incompatible-with-0.patch b/desktop/lxpanel/patches/0001-Fix-battery-selection-it-appears-incompatible-with-0.patch
new file mode 100644
index 0000000000..6210cf8d8b
--- /dev/null
+++ b/desktop/lxpanel/patches/0001-Fix-battery-selection-it-appears-incompatible-with-0.patch
@@ -0,0 +1,115 @@
+From ad0022eb8b1524b18d2b512d7dd8d2920c0f8dab Mon Sep 17 00:00:00 2001
+From: Andriy Grytsenko <andrej@rep.kiev.ua>
+Date: Fri, 25 Nov 2016 01:18:47 +0200
+Subject: [PATCH 1/2] Fix battery selection, it appears incompatible with 0.7.2
+ behavior.
+
+See https://bugs.debian.org/845555
+---
+ ChangeLog | 2 ++
+ TODO | 2 +-
+ plugins/batt/batt_sys.c | 30 +++++++++++++++---------------
+ 3 files changed, 18 insertions(+), 16 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index a21a14e..0abe16b 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,5 @@
++* Fixed battery selection, it appears incompatible with 0.7.2 behavior.
++
+ 0.9.1
+ -------------------------------------------------------------------------
+ * Fixed build failure without ALSA.
+diff --git a/TODO b/TODO
+index 965b17c..8d9f91f 100644
+--- a/TODO
++++ b/TODO
+@@ -17,7 +17,7 @@
+ * decide 'netstat' vs 'netstatus'
+ * optional libnotify support (useful for battery and volume plugins)
+ * pull improvements from Raspbian
+-* add Most Recent support into 'menu' plugin
++* add Most Recent support into 'menu' plugin (option: ones not by Run too)
+ * check and use weather-* standard themed icons for weather plugin
+ * "Remove this Launch Button" option in launchbar context menu
+ * 'usb-unmount' plugin
+diff --git a/plugins/batt/batt_sys.c b/plugins/batt/batt_sys.c
+index 154bd3d..2482c6f 100644
+--- a/plugins/batt/batt_sys.c
++++ b/plugins/batt/batt_sys.c
+@@ -4,6 +4,7 @@
+ * Copyright 2009 Juergen Hötzel <juergen@archlinux.org>
+ * 2015 Henry Gebhardt <hsggebhardt@googlemail.com>
+ * 2015 Stanislav Kozina, Ersin <xersin@users.sf.net>
++ * 2016 Andriy Grytsenko <andrej@rep.kiev.ua>
+ *
+ * Parts shameless stolen and glibified from acpi package
+ * Copyright (C) 2001 Grahame Bowland <grahame@angrygoats.net>
+@@ -295,15 +296,8 @@ battery *battery_get(int battery_number) {
+ const gchar *entry;
+ gchar *batt_name = NULL;
+ gchar *batt_path = NULL;
+- GDir * dir = g_dir_open( ACPI_PATH_SYS_POWER_SUPPLY, 0, &error );
++ GDir * dir;
+ battery *b = NULL;
+- int i;
+-
+- if ( dir == NULL )
+- {
+- g_warning( "NO ACPI/sysfs support in kernel: %s", error->message );
+- return NULL;
+- }
+
+ /* Try the expected path in sysfs first */
+ batt_name = g_strdup_printf(ACPI_BATTERY_DEVICE_NAME "%d", battery_number);
+@@ -324,13 +318,20 @@ battery *battery_get(int battery_number) {
+ g_free(batt_path);
+
+ if (b != NULL)
+- goto done;
++ return b;
+
+ /*
+ * We didn't find the expected path in sysfs.
+- * Walk the dir and blindly return n-th entry.
++ * Walk the dir and return any battery.
+ */
+- i = 0;
++ dir = g_dir_open( ACPI_PATH_SYS_POWER_SUPPLY, 0, &error );
++ if ( dir == NULL )
++ {
++ g_warning( "NO ACPI/sysfs support in kernel: %s", error->message );
++ g_error_free(error);
++ return NULL;
++ }
++
+ while ( ( entry = g_dir_read_name (dir) ) != NULL )
+ {
+ b = battery_new();
+@@ -339,9 +340,7 @@ battery *battery_get(int battery_number) {
+
+ /* We're looking for a battery with the selected ID */
+ if (b->type_battery == TRUE) {
+- if (i == battery_number)
+- break;
+- i++;
++ break;
+ }
+ battery_free(b);
+ b = NULL;
+@@ -349,9 +348,10 @@ battery *battery_get(int battery_number) {
+ if (b != NULL)
+ g_warning( "Battery entry " ACPI_BATTERY_DEVICE_NAME "%d not found, using %s",
+ battery_number, b->path);
++ // FIXME: update config?
+ else
+ g_warning( "Battery %d not found", battery_number );
+-done:
++
+ g_dir_close( dir );
+ return b;
+ }
+--
+2.11.0
+