aboutsummaryrefslogtreecommitdiff
path: root/sysutils/sensors-applet
diff options
context:
space:
mode:
authorJean-Yves Lefort <jylefort@FreeBSD.org>2006-05-03 20:37:12 +0000
committerJean-Yves Lefort <jylefort@FreeBSD.org>2006-05-03 20:37:12 +0000
commitda2a2c99cf783e8b62398cf4e0b7ca75f434cbe0 (patch)
tree0d97a35934e70bbdb26498f6c58e0c2869e896fd /sysutils/sensors-applet
parentf6fe529f4ed190c749b776fde316fa7bfed550aa (diff)
downloadports-da2a2c99cf783e8b62398cf4e0b7ca75f434cbe0.tar.gz
ports-da2a2c99cf783e8b62398cf4e0b7ca75f434cbe0.zip
Notes
Diffstat (limited to 'sysutils/sensors-applet')
-rw-r--r--sysutils/sensors-applet/Makefile29
-rw-r--r--sysutils/sensors-applet/distinfo3
-rw-r--r--sysutils/sensors-applet/files/mbmon-sensors-interface.c161
-rw-r--r--sysutils/sensors-applet/files/mbmon-sensors-interface.h30
-rw-r--r--sysutils/sensors-applet/files/patch-src_Makefile.in42
-rw-r--r--sysutils/sensors-applet/files/patch-src_sensors-applet.c47
-rw-r--r--sysutils/sensors-applet/files/patch-src_sensors-applet.h36
-rw-r--r--sysutils/sensors-applet/pkg-descr9
-rw-r--r--sysutils/sensors-applet/pkg-plist31
9 files changed, 388 insertions, 0 deletions
diff --git a/sysutils/sensors-applet/Makefile b/sysutils/sensors-applet/Makefile
new file mode 100644
index 000000000000..7990eb1a6aa5
--- /dev/null
+++ b/sysutils/sensors-applet/Makefile
@@ -0,0 +1,29 @@
+# New ports collection makefile for: sensors-applet
+# Date created: 03 May 2006
+# Whom: Jean-Yves Lefort <jylefort@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= sensors-applet
+PORTVERSION= 1.6.1
+CATEGORIES= sysutils
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR= ${PORTNAME}
+
+MAINTAINER= jylefort@FreeBSD.org
+COMMENT= A GNOME applet displaying hardware sensor values
+
+RUN_DEPENDS= mbmon:${PORTSDIR}/sysutils/mbmon
+
+USE_X_PREFIX= yes
+USE_GNOME= gnomehack gnomeprefix intlhack gnomepanel
+GNU_CONFIGURE= yes
+USE_GMAKE= yes
+CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include -DMBMON_EXECUTABLE=\\\"${LOCALBASE}/bin/mbmon\\\"" \
+ LDFLAGS="-L${LOCALBASE}/lib"
+
+post-patch:
+ @${CP} -f ${FILESDIR}/mbmon-sensors-interface.* ${WRKSRC}/src
+
+.include <bsd.port.mk>
diff --git a/sysutils/sensors-applet/distinfo b/sysutils/sensors-applet/distinfo
new file mode 100644
index 000000000000..631935ff22d1
--- /dev/null
+++ b/sysutils/sensors-applet/distinfo
@@ -0,0 +1,3 @@
+MD5 (sensors-applet-1.6.1.tar.gz) = b1feac15a8354fe0f3fd62a16b38293d
+SHA256 (sensors-applet-1.6.1.tar.gz) = 1ac5c6760e976366a1f12024325ba83a22e46e7f84f59dbdc89eb985c04260d2
+SIZE (sensors-applet-1.6.1.tar.gz) = 222358
diff --git a/sysutils/sensors-applet/files/mbmon-sensors-interface.c b/sysutils/sensors-applet/files/mbmon-sensors-interface.c
new file mode 100644
index 000000000000..9fdd8564698a
--- /dev/null
+++ b/sysutils/sensors-applet/files/mbmon-sensors-interface.c
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2006 Jean-Yves Lefort <jylefort@FreeBSD.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <stdlib.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#include "mbmon-sensors-interface.h"
+#include "sensors-applet.h"
+
+static struct
+{
+ const char *name;
+ const char *label;
+ SensorType type;
+ const char *icon;
+ double value;
+} mbmon_sensors[] = {
+ { "TEMP0", N_("Main Board"), TEMP_SENSOR, MEM_ICON },
+ { "TEMP1", N_("CPU"), TEMP_SENSOR, CPU_ICON },
+ { "TEMP2", N_("PSU"), TEMP_SENSOR, GENERIC_ICON },
+ { "FAN0", N_("Main Board Fan"), FAN_SENSOR, FAN_ICON },
+ { "FAN1", N_("CPU Fan"), FAN_SENSOR, FAN_ICON },
+ { "FAN2", N_("PSU Fan"), FAN_SENSOR, FAN_ICON },
+ { "VC0", N_("Vc0"), VOLTAGE_SENSOR, VOLTAGE_ICON },
+ { "VC1", N_("Vc1"), VOLTAGE_SENSOR, VOLTAGE_ICON },
+ { "V33", N_("V33"), VOLTAGE_SENSOR, VOLTAGE_ICON },
+ { "V50P", N_("V50P"), VOLTAGE_SENSOR, VOLTAGE_ICON },
+ { "V12P", N_("V12P"), VOLTAGE_SENSOR, VOLTAGE_ICON },
+ { "V12N", N_("V12N"), VOLTAGE_SENSOR, VOLTAGE_ICON },
+ { "V50N", N_("V50N"), VOLTAGE_SENSOR, VOLTAGE_ICON }
+};
+
+static gboolean
+mbmon_watch_cb (GIOChannel *source, GIOCondition condition, gpointer user_data)
+{
+ char *line;
+ gsize terminator;
+
+ while (g_io_channel_read_line(source, &line, NULL, &terminator, NULL) == G_IO_STATUS_NORMAL)
+ {
+ char *space;
+
+ line[terminator] = 0;
+
+ space = strchr(line, ' ');
+ if (space)
+ {
+ int name_len;
+ int i;
+
+ name_len = space - line;
+ for (i = 0; i < G_N_ELEMENTS(mbmon_sensors); i++)
+ if (! strncmp(mbmon_sensors[i].name, line, name_len))
+ {
+ char *value_start;
+
+ value_start = strstr(space + 1, ": ");
+ if (value_start)
+ {
+ double value;
+ char *end;
+
+ value = strtod(value_start + 2, &end);
+ if (*end == 0)
+ mbmon_sensors[i].value = value;
+ }
+
+ break;
+ }
+ }
+
+ g_free(line);
+ }
+
+ return TRUE; /* keep source */
+}
+
+void
+mbmon_sensors_interface_init(SensorsApplet *sensors_applet)
+{
+ GError *err = NULL;
+ char *argv[] = { MBMON_EXECUTABLE, "-r", "10", NULL };
+ int mbmon_stdout;
+ GIOChannel *channel;
+ int i;
+
+ sensors_applet_register_sensors_interface(sensors_applet,
+ MBMON,
+ mbmon_sensors_interface_get_sensor_value);
+
+ if (! g_spawn_async_with_pipes(NULL,
+ argv,
+ NULL,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ &mbmon_stdout,
+ NULL,
+ &err))
+ {
+ g_warning("Unable to execute mbmon: %s", err->message);
+ g_error_free(err);
+ return;
+ }
+
+ channel = g_io_channel_unix_new(mbmon_stdout);
+ g_io_channel_set_flags(channel, G_IO_FLAG_NONBLOCK, NULL);
+ g_io_add_watch(channel, G_IO_IN, mbmon_watch_cb, NULL);
+
+ for (i = 0; i < G_N_ELEMENTS(mbmon_sensors); i++)
+ {
+ char *path;
+
+ path = g_strdup_printf("/mbmon/%s", mbmon_sensors[i].name);
+ sensors_applet_add_sensor(sensors_applet,
+ path,
+ mbmon_sensors[i].name,
+ mbmon_sensors[i].label,
+ MBMON,
+ TRUE,
+ mbmon_sensors[i].type,
+ mbmon_sensors[i].icon);
+ g_free(path);
+ }
+}
+
+gdouble
+mbmon_sensors_interface_get_sensor_value (const gchar *path,
+ const gchar *id,
+ SensorType type,
+ GError **error)
+{
+ int i;
+
+ for (i = 0; i < G_N_ELEMENTS(mbmon_sensors); i++)
+ if (! strcmp(mbmon_sensors[i].name, id))
+ return mbmon_sensors[i].value;
+
+ g_set_error(error, 0, 0, "Unknown sensor \"%s\"", id);
+ return 0;
+}
diff --git a/sysutils/sensors-applet/files/mbmon-sensors-interface.h b/sysutils/sensors-applet/files/mbmon-sensors-interface.h
new file mode 100644
index 000000000000..d85d3aa6c28a
--- /dev/null
+++ b/sysutils/sensors-applet/files/mbmon-sensors-interface.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2006 Jean-Yves Lefort <jylefort@FreeBSD.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef MBMON_SENSORS_INTERFACE_H
+#define MBMON_SENSORS_INTERFACE_H
+
+#include "sensors-applet.h"
+
+void mbmon_sensors_interface_init(SensorsApplet *sensors_applet);
+gdouble mbmon_sensors_interface_get_sensor_value(const gchar *path,
+ const gchar *id,
+ SensorType type,
+ GError **error);
+
+#endif /* MBMON_SENSORS_INTERFACE_H*/
diff --git a/sysutils/sensors-applet/files/patch-src_Makefile.in b/sysutils/sensors-applet/files/patch-src_Makefile.in
new file mode 100644
index 000000000000..6c894c86d11a
--- /dev/null
+++ b/sysutils/sensors-applet/files/patch-src_Makefile.in
@@ -0,0 +1,42 @@
+--- src/Makefile.in.orig Fri Mar 24 15:54:47 2006
++++ src/Makefile.in Wed May 3 22:09:21 2006
+@@ -206,21 +206,8 @@
+ sensors-applet.h \
+ sensors-applet-gconf.c \
+ sensors-applet-gconf.h \
+- acpi-sensors-interface.c \
+- acpi-sensors-interface.h \
+- ibm-acpi-sensors-interface.c \
+- ibm-acpi-sensors-interface.h \
+- omnibook-sensors-interface.c \
+- omnibook-sensors-interface.h \
+- pmu-sys-sensors-interface.c \
+- pmu-sys-sensors-interface.h \
+- i8k-sensors-interface.c \
+- i8k-sensors-interface.h \
+- hddtemp-sensors-interface.c \
+- hddtemp-sensors-interface.h \
+- smu-sys-sensors-interface.c \
+- smu-sys-sensors-interface.h \
+- $(sensors_SRC)
++ mbmon-sensors-interface.c \
++ mbmon-sensors-interface.h
+
+ subdir = src
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+@@ -250,13 +237,8 @@
+ am_sensors_applet_OBJECTS = main.$(OBJEXT) about-dialog.$(OBJEXT) \
+ active-sensor.$(OBJEXT) prefs-dialog.$(OBJEXT) \
+ sensor-config-dialog.$(OBJEXT) sensors-applet.$(OBJEXT) \
+- sensors-applet-gconf.$(OBJEXT) acpi-sensors-interface.$(OBJEXT) \
+- ibm-acpi-sensors-interface.$(OBJEXT) \
+- omnibook-sensors-interface.$(OBJEXT) \
+- pmu-sys-sensors-interface.$(OBJEXT) \
+- i8k-sensors-interface.$(OBJEXT) \
+- hddtemp-sensors-interface.$(OBJEXT) \
+- smu-sys-sensors-interface.$(OBJEXT) $(am__objects_1)
++ sensors-applet-gconf.$(OBJEXT) \
++ mbmon-sensors-interface.$(OBJEXT)
+ sensors_applet_OBJECTS = $(am_sensors_applet_OBJECTS)
+ sensors_applet_LDADD = $(LDADD)
+ sensors_applet_DEPENDENCIES =
diff --git a/sysutils/sensors-applet/files/patch-src_sensors-applet.c b/sysutils/sensors-applet/files/patch-src_sensors-applet.c
new file mode 100644
index 000000000000..74d75227348e
--- /dev/null
+++ b/sysutils/sensors-applet/files/patch-src_sensors-applet.c
@@ -0,0 +1,47 @@
+--- src/sensors-applet.c.orig Fri Mar 24 15:42:32 2006
++++ src/sensors-applet.c Wed May 3 22:07:12 2006
+@@ -29,22 +29,13 @@
+ #include "sensors-applet.h"
+ #include "active-sensor.h"
+ #include "sensors-applet-gconf.h"
+-#include "acpi-sensors-interface.h"
+
+ /* use libsensors if available, otherwise manually find sensors */
+ #ifdef HAVE_LIBSENSORS
+ #include "libsensors-sensors-interface.h"
+-#else
+-#include "i2c-sys-sensors-interface.h"
+-#include "i2c-proc-sensors-interface.h"
+ #endif
+
+-#include "i8k-sensors-interface.h"
+-#include "ibm-acpi-sensors-interface.h"
+-#include "omnibook-sensors-interface.h"
+-#include "pmu-sys-sensors-interface.h"
+-#include "smu-sys-sensors-interface.h"
+-#include "hddtemp-sensors-interface.h"
++#include "mbmon-sensors-interface.h"
+ #include "prefs-dialog.h"
+ #include "about-dialog.h"
+
+@@ -754,19 +745,10 @@
+ }
+
+ static void sensors_applet_setup_sensors_interfaces(SensorsApplet *sensors_applet) {
+- acpi_sensors_interface_init(sensors_applet);
+- hddtemp_sensors_interface_init(sensors_applet);
+ #ifdef HAVE_LIBSENSORS
+ libsensors_sensors_interface_init(sensors_applet);
+-#else
+- i2c_proc_sensors_interface_init(sensors_applet);
+- i2c_sys_sensors_interface_init(sensors_applet);
+ #endif
+- i8k_sensors_interface_init(sensors_applet);
+- ibm_acpi_sensors_interface_init(sensors_applet);
+- omnibook_sensors_interface_init(sensors_applet);
+- pmu_sys_sensors_interface_init(sensors_applet);
+- smu_sys_sensors_interface_init(sensors_applet);
++ mbmon_sensors_interface_init(sensors_applet);
+ }
+
+
diff --git a/sysutils/sensors-applet/files/patch-src_sensors-applet.h b/sysutils/sensors-applet/files/patch-src_sensors-applet.h
new file mode 100644
index 000000000000..e1d1c60871fe
--- /dev/null
+++ b/sysutils/sensors-applet/files/patch-src_sensors-applet.h
@@ -0,0 +1,36 @@
+--- src/sensors-applet.h.orig Fri Mar 24 15:44:07 2006
++++ src/sensors-applet.h Wed May 3 22:07:18 2006
+@@ -42,31 +42,15 @@
+
+ typedef enum {
+ UNUSED = 0, /* as a flag to test against later */
+- ACPI,
+- HDDTEMP,
+- I2C_SYS,
+- I2C_PROC,
+- IBM_ACPI,
+- I8K,
+ LIBSENSORS,
+- OMNIBOOK,
+- PMU_SYS,
+- SMU_SYS,
++ MBMON,
+ N_SENSOR_INTERFACES
+ } SensorInterface;
+
+ static const gchar *sensor_interface[] = {
+ "unused",
+- "acpi",
+- "hddtemp",
+- "i2c-sys",
+- "i2c-proc",
+- "ibm-acpi",
+- "i8k",
+ "libsensors",
+- "omnibook",
+- "pmu-sys",
+- "smu-sys",
++ "mbmon"
+ };
+
+ /* enumeration used to identify columns in the GtkTreeStore data
diff --git a/sysutils/sensors-applet/pkg-descr b/sysutils/sensors-applet/pkg-descr
new file mode 100644
index 000000000000..412a6f079e8f
--- /dev/null
+++ b/sysutils/sensors-applet/pkg-descr
@@ -0,0 +1,9 @@
+GNOME Sensors Applet is an applet for the GNOME Panel to display readings from
+hardware sensors, including CPU temperature, fan speeds and voltage readings.
+
+On FreeBSD, sensor values are obtained from the sysutils/mbmon port.
+
+WWW: http://sensors-applet.sourceforge.net/
+
+- Jean-Yves Lefort
+jylefort@FreeBSD.org
diff --git a/sysutils/sensors-applet/pkg-plist b/sysutils/sensors-applet/pkg-plist
new file mode 100644
index 000000000000..0545b76efab1
--- /dev/null
+++ b/sysutils/sensors-applet/pkg-plist
@@ -0,0 +1,31 @@
+libdata/bonobo/servers/SensorsApplet.server
+libexec/sensors-applet
+share/gnome/gnome-2.0/ui/SensorsApplet.xml
+share/gnome/help/sensors-applet/C/figures/applet_in_panel.png
+share/gnome/help/sensors-applet/C/legal.xml
+share/gnome/help/sensors-applet/C/sensors-applet.xml
+share/gnome/omf/sensors-applet/sensors-applet-C.omf
+share/gnome/pixmaps/sensors-applet/battery-icon.png
+share/gnome/pixmaps/sensors-applet/case-icon.png
+share/gnome/pixmaps/sensors-applet/cpu-icon.png
+share/gnome/pixmaps/sensors-applet/fan-icon.png
+share/gnome/pixmaps/sensors-applet/hdd-icon.png
+share/gnome/pixmaps/sensors-applet/high-temp-icon.png
+share/gnome/pixmaps/sensors-applet/low-temp-icon.png
+share/gnome/pixmaps/sensors-applet/memory-icon.png
+share/gnome/pixmaps/sensors-applet/normal-temp-icon.png
+share/gnome/pixmaps/sensors-applet/sensors-applet-icon.png
+share/gnome/pixmaps/sensors-applet/very-high-temp-icon.png
+share/gnome/pixmaps/sensors-applet/very-low-temp-icon.png
+share/locale/de/LC_MESSAGES/sensors-applet.mo
+share/locale/es/LC_MESSAGES/sensors-applet.mo
+share/locale/fi/LC_MESSAGES/sensors-applet.mo
+share/locale/fr/LC_MESSAGES/sensors-applet.mo
+share/locale/it/LC_MESSAGES/sensors-applet.mo
+share/locale/pl/LC_MESSAGES/sensors-applet.mo
+share/locale/ro/LC_MESSAGES/sensors-applet.mo
+share/locale/ru/LC_MESSAGES/sensors-applet.mo
+@dirrm share/gnome/help/sensors-applet/C/figures
+@dirrm share/gnome/help/sensors-applet/C
+@dirrm share/gnome/omf/sensors-applet
+@dirrm share/gnome/pixmaps/sensors-applet