From 233d594c00487cb125475d6c2451d4f128b84d5f Mon Sep 17 00:00:00 2001 From: David-John Willis Date: Wed, 17 Feb 2010 09:27:06 +0000 Subject: [PATCH] xfce4-battery-plugin 0.5.1: Add xfce4-battery-plugin recipe with APM/ACPI support. * Also add machine specific patch for omap3-pandora to read status of internal battery (and set package to ${MACHINE_ARCH} on that platform). --- ...e4-battery-plugin-0.5.1-pandora-hack.patch | 80 +++++++++++++++++++ .../xfce-extras/xfce4-battery-plugin_0.5.1.bb | 28 +++++++ 2 files changed, 108 insertions(+) create mode 100644 recipes/xfce-extras/xfce4-battery-plugin/xfce4-battery-plugin-0.5.1-pandora-hack.patch create mode 100644 recipes/xfce-extras/xfce4-battery-plugin_0.5.1.bb diff --git a/recipes/xfce-extras/xfce4-battery-plugin/xfce4-battery-plugin-0.5.1-pandora-hack.patch b/recipes/xfce-extras/xfce4-battery-plugin/xfce4-battery-plugin-0.5.1-pandora-hack.patch new file mode 100644 index 0000000000..ec8b16c125 --- /dev/null +++ b/recipes/xfce-extras/xfce4-battery-plugin/xfce4-battery-plugin-0.5.1-pandora-hack.patch @@ -0,0 +1,80 @@ +diff -urp xfce4-battery-plugin-0.5.1_orig/panel-plugin/battery.c xfce4-battery-plugin-0.5.1/panel-plugin/battery.c +--- xfce4-battery-plugin-0.5.1_orig/panel-plugin/battery.c 2008-09-04 23:53:40.000000000 +0300 ++++ xfce4-battery-plugin-0.5.1/panel-plugin/battery.c 2010-02-16 20:05:45.525658063 +0200 +@@ -269,6 +269,7 @@ battmon_time_labels_fits(t_battmon *batt + return labels_size <= plugin_size; + } + ++#if 0 + static gboolean + update_apm_status(t_battmon *battmon) + { +@@ -448,6 +449,15 @@ battmon.c:241: for each function it appe + battmon->flag = FALSE; + + charge = CLAMP (charge, 0, 100); ++#endif ++ ++static gboolean ++battmon_update_graph(t_battmon *battmon, int charge, int time_remaining) ++{ ++ int acline = 0; ++ gchar buffer[128]; ++ ++ + gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(battmon->battstatus), charge / 100.0); + + if(battmon->options.display_label){ +@@ -514,7 +524,7 @@ battmon.c:241: for each function it appe + if(battmon->options.display_power){ + gtk_widget_show((GtkWidget *)battmon->acfan); + gtk_widget_show((GtkWidget *)battmon->temp); +- ++#if 0 + fan=get_fan_status(); + if(acline && fan) + gtk_label_set_text(battmon->acfan,"AC FAN"); +@@ -535,6 +545,7 @@ battmon.c:241: for each function it appe + gtk_label_set_text(battmon->temp,""); + gtk_widget_hide((GtkWidget *)battmon->temp); + } ++#endif + } else { + gtk_widget_hide((GtkWidget *)battmon->acfan); + gtk_widget_hide((GtkWidget *)battmon->temp); +@@ -596,10 +607,33 @@ do_low_warn: + } + } + } +- + return TRUE; + } + ++static gboolean ++update_apm_status(t_battmon *battmon) ++{ ++ FILE *f; ++ int charge = 0; ++ int time_remaining = 0; ++ ++ ++ f = fopen("/sys/class/power_supply/bq27500-0/capacity", "r"); ++ if (f) { ++ fscanf(f, "%d", &charge); ++ fclose(f); ++ } ++ ++ f = fopen("/sys/class/power_supply/bq27500-0/time_to_empty_now", "r"); ++ if (f) { ++ fscanf(f, "%d", &time_remaining); ++ fclose(f); ++ } ++ ++ battmon->method = BM_USE_APM; ++ return battmon_update_graph(battmon, charge, time_remaining); ++} ++ + static GdkPixbuf * + battmon_icon (t_battmon *battmon) + { +Only in xfce4-battery-plugin-0.5.1/panel-plugin: battery.c.orig diff --git a/recipes/xfce-extras/xfce4-battery-plugin_0.5.1.bb b/recipes/xfce-extras/xfce4-battery-plugin_0.5.1.bb new file mode 100644 index 0000000000..ec86e7f03c --- /dev/null +++ b/recipes/xfce-extras/xfce4-battery-plugin_0.5.1.bb @@ -0,0 +1,28 @@ +DESCRIPTION = "Xfce panel plugins for battery status." +DEPENDS = "libxfcegui4 xfce4-panel" +RDEPENDS = "libxfcegui4 xfce4-panel" + +SECTION = "x11" +PR = "r1" + +inherit xfce46 + +XFCE_VERSION = "4.6.1" + +SRC_URI = "http://archive.xfce.org/src/panel-plugins/xfce4-battery-plugin/0.5/${PN}-${PV}.tar.bz2;name=tarball" +SRC_URI[tarball.md5sum] = "d8a666d85bb3c1dd007b547de4dd7037" +SRC_URI[tarball.sha256sum] = "6b90a37d8f01d2f042679a3f3f92f08dee96510096115f52fb9210ef4cad7c61" + +EXTRA_OECONF += " --program-prefix=''" + +# OpenPandora patch to let the plugin read it's internal battery status. +SRC_URI_append_omap3-pandora = " file://xfce4-battery-plugin-0.5.1-pandora-hack.patch;patch=1" +PACKAGE_ARCH_omap3-pandora = "${MACHINE_ARCH}" + +FILES_${PN} += "${datadir}/xfce4/panel-plugins/*.desktop" + +FILES_${PN}-dbg += "${libexecdir}/xfce4/panel-plugins/.debug/" + +do_configure() { + oe_runconf +} -- 2.39.5