summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkos Chandras <hwoarang@gentoo.org>2012-02-04 10:30:35 +0000
committerMarkos Chandras <hwoarang@gentoo.org>2012-02-04 10:30:35 +0000
commit13a5689f64ff1b7946a42531fbfa2682c6a19a32 (patch)
treeb2d943d589e7135a931d94450d5be570a18fa4fe /lxde-base/lxpanel
parentVersion bump, remove old. (diff)
downloadgentoo-2-13a5689f64ff1b7946a42531fbfa2682c6a19a32.tar.gz
gentoo-2-13a5689f64ff1b7946a42531fbfa2682c6a19a32.tar.bz2
gentoo-2-13a5689f64ff1b7946a42531fbfa2682c6a19a32.zip
Support sysfs and proc interfaces in lxpanel. Bug #400855
(Portage version: 2.2.0_alpha84/cvs/Linux x86_64)
Diffstat (limited to 'lxde-base/lxpanel')
-rw-r--r--lxde-base/lxpanel/ChangeLog8
-rw-r--r--lxde-base/lxpanel/files/lxpanel-0.5.8-thermal-plugin.patch202
-rw-r--r--lxde-base/lxpanel/lxpanel-0.5.8-r2.ebuild57
3 files changed, 266 insertions, 1 deletions
diff --git a/lxde-base/lxpanel/ChangeLog b/lxde-base/lxpanel/ChangeLog
index 76694dd3a761..8554a74240ad 100644
--- a/lxde-base/lxpanel/ChangeLog
+++ b/lxde-base/lxpanel/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for lxde-base/lxpanel
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/lxde-base/lxpanel/ChangeLog,v 1.36 2012/01/01 13:39:25 vostorga Exp $
+# $Header: /var/cvsroot/gentoo-x86/lxde-base/lxpanel/ChangeLog,v 1.37 2012/02/04 10:30:35 hwoarang Exp $
+
+*lxpanel-0.5.8-r2 (04 Feb 2012)
+
+ 04 Feb 2012; Markos Chandras <hwoarang@gentoo.org>
+ +files/lxpanel-0.5.8-thermal-plugin.patch, +lxpanel-0.5.8-r2.ebuild:
+ Support sysfs and proc interfaces in lxpanel. Bug #400855
*lxpanel-0.5.8-r1 (01 Jan 2012)
diff --git a/lxde-base/lxpanel/files/lxpanel-0.5.8-thermal-plugin.patch b/lxde-base/lxpanel/files/lxpanel-0.5.8-thermal-plugin.patch
new file mode 100644
index 000000000000..0db90b7a19e3
--- /dev/null
+++ b/lxde-base/lxpanel/files/lxpanel-0.5.8-thermal-plugin.patch
@@ -0,0 +1,202 @@
+From 266c072d1e954266157989891eec069006772e97 Mon Sep 17 00:00:00 2001
+From: Henry Gebhardt <hsggebhardt@googlemail.com>
+Date: Fri, 23 Dec 2011 21:02:53 +0100
+Subject: [PATCH] plugins/thermal: support both /proc and sysfs interfaces
+
+---
+ src/plugins/thermal/thermal.c | 108 +++++++++++++++++++++++++++++++++++------
+ 1 files changed, 93 insertions(+), 15 deletions(-)
+
+diff --git a/src/plugins/thermal/thermal.c b/src/plugins/thermal/thermal.c
+index afe5e89..616c4a0 100644
+--- a/src/plugins/thermal/thermal.c
++++ b/src/plugins/thermal/thermal.c
+@@ -32,12 +32,17 @@
+
+ #include "dbg.h"
+
+-#define THERMAL_DIRECTORY "/proc/acpi/thermal_zone/" /* must be slash-terminated */
+-#define THERMAL_TEMPF "temperature"
+-#define THERMAL_TRIP "trip_points"
+-#define TRIP_CRITICAL "critical (S5):"
++#define PROC_THERMAL_DIRECTORY "/proc/acpi/thermal_zone/" /* must be slash-terminated */
++#define PROC_THERMAL_TEMPF "temperature"
++#define PROC_THERMAL_TRIP "trip_points"
++#define PROC_TRIP_CRITICAL "critical (S5):"
+
+-typedef struct {
++#define SYSFS_THERMAL_DIRECTORY "/sys/class/thermal/thermal_zone0/" /* must be slash-terminated */
++#define SYSFS_THERMAL_TEMPF "temp"
++#define SYSFS_THERMAL_TRIP "trip_point_0_temp"
++
++
++typedef struct thermal {
+ Plugin * plugin;
+ GtkWidget *main;
+ GtkWidget *namew;
+@@ -54,17 +59,20 @@ typedef struct {
+ GdkColor cl_normal,
+ cl_warning1,
+ cl_warning2;
++ gint (*get_temperature)(struct thermal *th);
++ gint (*get_critical)(struct thermal *th);
+ } thermal;
+
++
+ static gint
+-get_critical(thermal *th){
++proc_get_critical(thermal *th){
+ FILE *state;
+ char buf[ 256 ], sstmp [ 100 ];
+ char* pstr;
+
+ if(th->sensor == NULL) return -1;
+
+- sprintf(sstmp,"%s%s",th->sensor,THERMAL_TRIP);
++ sprintf(sstmp,"%s%s",th->sensor,PROC_THERMAL_TRIP);
+
+ if (!(state = fopen( sstmp, "r"))) {
+ //printf("cannot open %s\n",sstmp);
+@@ -72,10 +80,10 @@ get_critical(thermal *th){
+ }
+
+ while( fgets(buf, 256, state) &&
+- ! ( pstr = strstr(buf, TRIP_CRITICAL) ) );
++ ! ( pstr = strstr(buf, PROC_TRIP_CRITICAL) ) );
+ if( pstr )
+ {
+- pstr += strlen(TRIP_CRITICAL);
++ pstr += strlen(PROC_TRIP_CRITICAL);
+ while( *pstr && *pstr == ' ' )
+ ++pstr;
+
+@@ -90,14 +98,14 @@ get_critical(thermal *th){
+ }
+
+ static gint
+-get_temperature(thermal *th){
++proc_get_temperature(thermal *th){
+ FILE *state;
+ char buf[ 256 ], sstmp [ 100 ];
+ char* pstr;
+
+ if(th->sensor == NULL) return -1;
+
+- sprintf(sstmp,"%s%s",th->sensor,THERMAL_TEMPF);
++ sprintf(sstmp,"%s%s",th->sensor,PROC_THERMAL_TEMPF);
+
+ if (!(state = fopen( sstmp, "r"))) {
+ //printf("cannot open %s\n",sstmp);
+@@ -122,11 +130,79 @@ get_temperature(thermal *th){
+ }
+
+ static gint
++sysfs_get_critical(thermal *th){
++ FILE *state;
++ char buf[ 256 ], sstmp [ 100 ];
++ char* pstr;
++
++ if(th->sensor == NULL) return -1;
++
++ sprintf(sstmp,"%s%s",th->sensor,SYSFS_THERMAL_TRIP);
++
++ if (!(state = fopen( sstmp, "r"))) {
++ //printf("cannot open %s\n",sstmp);
++ return -1;
++ }
++
++ while( fgets(buf, 256, state) &&
++ ! ( pstr = buf ) );
++ if( pstr )
++ {
++ printf("Critical: [%s]\n",pstr);
++ fclose(state);
++ return atoi(pstr)/1000;
++ }
++
++ fclose(state);
++ return -1;
++}
++
++static gint
++sysfs_get_temperature(thermal *th){
++ FILE *state;
++ char buf[ 256 ], sstmp [ 100 ];
++ char* pstr;
++
++ if(th->sensor == NULL) return -1;
++
++ sprintf(sstmp,"%s%s",th->sensor,SYSFS_THERMAL_TEMPF);
++
++ if (!(state = fopen( sstmp, "r"))) {
++ //printf("cannot open %s\n",sstmp);
++ return -1;
++ }
++
++ while (fgets(buf, 256, state) &&
++ ! ( pstr = buf ) );
++ if( pstr )
++ {
++ fclose(state);
++ return atoi(pstr)/1000;
++ }
++
++ fclose(state);
++ return -1;
++}
++
++
++static void
++set_get_functions(thermal *th)
++{
++ if (strncmp(th->sensor, "/sys/", 5) == 0){
++ th->get_temperature = sysfs_get_temperature;
++ th->get_critical = sysfs_get_critical;
++ } else {
++ th->get_temperature = proc_get_temperature;
++ th->get_critical = proc_get_critical;
++ }
++}
++
++static gint
+ update_display(thermal *th)
+ {
+ char buffer [60];
+ int n;
+- int temp = get_temperature(th);
++ int temp = th->get_temperature(th);
+ GdkColor color;
+
+ if(temp >= th->warning2)
+@@ -155,7 +231,7 @@ check_sensors( thermal* th )
+ const char *sensor_name;
+ char sensor_path[100];
+
+- if (! (sensorsDirectory = g_dir_open(THERMAL_DIRECTORY, 0, NULL)))
++ if (! (sensorsDirectory = g_dir_open(PROC_THERMAL_DIRECTORY, 0, NULL)))
+ {
+ th->sensor = NULL;
+ return;
+@@ -164,7 +240,7 @@ check_sensors( thermal* th )
+ /* Scan the thermal_zone directory for available sensors */
+ while ((sensor_name = g_dir_read_name(sensorsDirectory))) {
+ if (sensor_name[0] != '.') {
+- sprintf(sensor_path,"%s%s/",THERMAL_DIRECTORY, sensor_name);
++ sprintf(sensor_path,"%s%s/",PROC_THERMAL_DIRECTORY, sensor_name);
+ if(th->sensor) {
+ g_free(th->sensor);
+ th->sensor = NULL;
+@@ -254,7 +330,9 @@ thermal_constructor(Plugin *p, char** fp)
+ if(th->sensor == NULL) th->auto_sensor = TRUE;
+ if(th->auto_sensor) check_sensors(th);
+
+- th->critical = get_critical(th);
++ set_get_functions(th);
++
++ th->critical = th->get_critical(th);
+
+ if(!th->custom_levels){
+ th->warning1 = th->critical - 10;
+--
+1.7.4.1
+
diff --git a/lxde-base/lxpanel/lxpanel-0.5.8-r2.ebuild b/lxde-base/lxpanel/lxpanel-0.5.8-r2.ebuild
new file mode 100644
index 000000000000..404e858f8ddb
--- /dev/null
+++ b/lxde-base/lxpanel/lxpanel-0.5.8-r2.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/lxde-base/lxpanel/lxpanel-0.5.8-r2.ebuild,v 1.1 2012/02/04 10:30:35 hwoarang Exp $
+
+EAPI="4"
+
+inherit autotools eutils
+
+DESCRIPTION="Lightweight X11 desktop panel for LXDE"
+HOMEPAGE="http://lxde.org/"
+SRC_URI="mirror://sourceforge/lxde/${P}.tar.gz"
+
+LICENSE="GPL-2"
+KEYWORDS="~alpha ~amd64 ~arm ~ppc ~x86 ~x86-interix ~amd64-linux ~x86-linux"
+SLOT="0"
+IUSE="+alsa"
+RESTRICT="test" # bug 249598
+
+RDEPEND="x11-libs/gtk+:2
+ x11-libs/libXmu
+ x11-libs/libXpm
+ lxde-base/lxmenu-data
+ lxde-base/menu-cache
+ alsa? ( media-libs/alsa-lib )"
+DEPEND="${RDEPEND}
+ dev-util/pkgconfig
+ sys-devel/gettext"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-0.5.1-sandbox.patch
+ epatch "${FILESDIR}"/${PN}-0.5.6-broken-apps.patch
+ epatch "${FILESDIR}"/${P}-battery-meter.patch
+ epatch "${FILESDIR}"/${P}-thermal-plugin.patch
+ eautoreconf
+}
+
+src_configure() {
+ local plugins=all
+ [[ ${CHOST} == *-interix* ]] && plugins=deskno,kbled,xkb
+
+ econf $(use_enable alsa) --with-x --with-plugins=${plugins}
+ # the gtk+ dep already pulls in libX11, so we might as well hardcode with-x
+}
+
+src_install () {
+ emake DESTDIR="${D}" install
+ dodoc AUTHORS ChangeLog README
+
+ # Get rid of the .la files.
+ find "${D}" -name '*.la' -delete
+}
+
+pkg_postinst() {
+ elog "If you have problems with broken icons shown in the main panel,"
+ elog "you will have to configure panel settings via its menu."
+ elog "This will not be an issue with first time installations."
+}