summaryrefslogtreecommitdiff
path: root/plugins/libsensors
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2011-11-21 23:44:15 +0100
committerStefano Karapetsas <[email protected]>2011-11-21 23:44:15 +0100
commit69ecddf1317e71f35b1c1de00392dc76f8f1701c (patch)
treeaba29401d8d4b88f14d67aac2b0e60980a78fa2e /plugins/libsensors
downloadmate-sensors-applet-69ecddf1317e71f35b1c1de00392dc76f8f1701c.tar.bz2
mate-sensors-applet-69ecddf1317e71f35b1c1de00392dc76f8f1701c.tar.xz
Initial release bases on sensors-applet
Diffstat (limited to 'plugins/libsensors')
-rw-r--r--plugins/libsensors/Makefile.am21
-rw-r--r--plugins/libsensors/Makefile.in584
-rw-r--r--plugins/libsensors/libsensors-plugin.c515
-rw-r--r--plugins/libsensors/libsensors-plugin.h24
4 files changed, 1144 insertions, 0 deletions
diff --git a/plugins/libsensors/Makefile.am b/plugins/libsensors/Makefile.am
new file mode 100644
index 0000000..082257b
--- /dev/null
+++ b/plugins/libsensors/Makefile.am
@@ -0,0 +1,21 @@
+plugindir = $(libdir)/sensors-applet/plugins
+
+# libsensors plugin
+INCLUDES = -DGNOMELOCALEDIR=\""$(datadir)/locale/"\" \
+ -DG_LOG_DOMAIN=\""Sensors Applet"\" \
+ -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \
+ -DDATADIR=\""$(datadir)"\" \
+ -DLIBDIR=\""$(libdir)"\" \
+ -DSYSCONFDIR=\""$(sysconfdir)"\" \
+ -DPREFIX=\""$(prefix)"\" \
+ -I$(top_srcdir) \
+ $(GLIB_CFLAGS) $(LIBSENSORS_CFLAGS)
+
+plugin_LTLIBRARIES = liblibsensors.la
+
+liblibsensors_la_SOURCES = \
+ libsensors-plugin.h \
+ libsensors-plugin.c
+
+liblibsensors_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) $(LIBSENSORS_LIBS)
+liblibsensors_la_LIBADD = $(top_builddir)/lib/libsensors-applet-plugin.la
diff --git a/plugins/libsensors/Makefile.in b/plugins/libsensors/Makefile.in
new file mode 100644
index 0000000..70adb15
--- /dev/null
+++ b/plugins/libsensors/Makefile.in
@@ -0,0 +1,584 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = plugins/libsensors
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/sensors-applet/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(plugindir)"
+LTLIBRARIES = $(plugin_LTLIBRARIES)
+liblibsensors_la_DEPENDENCIES = \
+ $(top_builddir)/lib/libsensors-applet-plugin.la
+am_liblibsensors_la_OBJECTS = libsensors-plugin.lo
+liblibsensors_la_OBJECTS = $(am_liblibsensors_la_OBJECTS)
+liblibsensors_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(liblibsensors_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/sensors-applet
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(liblibsensors_la_SOURCES)
+DIST_SOURCES = $(liblibsensors_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LINGUAS = @ALL_LINGUAS@
+AMTAR = @AMTAR@
+AR = @AR@
+ATICONFIG_EXE = @ATICONFIG_EXE@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+CAIRO_LIBS = @CAIRO_LIBS@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DBUSGLIB_CFLAGS = @DBUSGLIB_CFLAGS@
+DBUSGLIB_LIBS = @DBUSGLIB_LIBS@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@
+DOC_USER_FORMATS = @DOC_USER_FORMATS@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_LIBS = @GLIB_LIBS@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GNOME_CFLAGS = @GNOME_CFLAGS@
+GNOME_LIBS = @GNOME_LIBS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+HELP_DIR = @HELP_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBATASMART_CFLAGS = @LIBATASMART_CFLAGS@
+LIBATASMART_LIBS = @LIBATASMART_LIBS@
+LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@
+LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSENSORS_CFLAGS = @LIBSENSORS_CFLAGS@
+LIBSENSORS_LIBS = @LIBSENSORS_LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGFMT_OPTS = @MSGFMT_OPTS@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NVIDIA_CFLAGS = @NVIDIA_CFLAGS@
+NVIDIA_LIBS = @NVIDIA_LIBS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OMF_DIR = @OMF_DIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PLUGIN_LIBTOOL_FLAGS = @PLUGIN_LIBTOOL_FLAGS@
+POFILES = @POFILES@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+XGETTEXT = @XGETTEXT@
+XSLTPROC = @XSLTPROC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+plugindir = $(libdir)/sensors-applet/plugins
+
+# libsensors plugin
+INCLUDES = -DGNOMELOCALEDIR=\""$(datadir)/locale/"\" \
+ -DG_LOG_DOMAIN=\""Sensors Applet"\" \
+ -DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \
+ -DDATADIR=\""$(datadir)"\" \
+ -DLIBDIR=\""$(libdir)"\" \
+ -DSYSCONFDIR=\""$(sysconfdir)"\" \
+ -DPREFIX=\""$(prefix)"\" \
+ -I$(top_srcdir) \
+ $(GLIB_CFLAGS) $(LIBSENSORS_CFLAGS)
+
+plugin_LTLIBRARIES = liblibsensors.la
+liblibsensors_la_SOURCES = \
+ libsensors-plugin.h \
+ libsensors-plugin.c
+
+liblibsensors_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) $(LIBSENSORS_LIBS)
+liblibsensors_la_LIBADD = $(top_builddir)/lib/libsensors-applet-plugin.la
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/libsensors/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu plugins/libsensors/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)"
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
+ }
+
+uninstall-pluginLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \
+ done
+
+clean-pluginLTLIBRARIES:
+ -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
+ @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+liblibsensors.la: $(liblibsensors_la_OBJECTS) $(liblibsensors_la_DEPENDENCIES)
+ $(liblibsensors_la_LINK) -rpath $(plugindir) $(liblibsensors_la_OBJECTS) $(liblibsensors_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsensors-plugin.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(plugindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pluginLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pluginLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-pluginLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-pluginLTLIBRARIES \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-pluginLTLIBRARIES
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/plugins/libsensors/libsensors-plugin.c b/plugins/libsensors/libsensors-plugin.c
new file mode 100644
index 0000000..f9c6830
--- /dev/null
+++ b/plugins/libsensors/libsensors-plugin.c
@@ -0,0 +1,515 @@
+/*
+ * Copyright (C) 2005-2009 Alex Murray <[email protected]>
+ *
+ * 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
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_REGEX_H
+#include <regex.h>
+#endif
+
+#ifdef HAVE_SENSORS_SENSORS_H
+#include <sensors/sensors.h>
+#endif
+
+#include "libsensors-plugin.h"
+
+const gchar *plugin_name = "libsensors";
+
+GHashTable *hash_table = NULL;
+
+enum {
+ LIBSENSORS_CHIP_PARSE_ERROR,
+ LIBSENSORS_MISSING_FEATURE_ERROR,
+ LIBSENSORS_REGEX_URL_COMPILE_ERROR,
+ LIBSENSORS_CHIP_NOT_FOUND_ERROR
+};
+
+#if SENSORS_API_VERSION < 0x400
+#define LIBSENSORS_CONFIG_FILE "/etc/sensors.conf"
+#define LIBSENSORS_ALTERNATIVE_CONFIG_FILE "/usr/local/etc/sensors.conf"
+#endif
+
+regex_t uri_re;
+
+static char *get_chip_name_string(const sensors_chip_name *chip) {
+ char *name;
+
+#if SENSORS_API_VERSION < 0x400
+ // taken from lm-sensors:prog/sensors/main.c:sprintf_chip_name
+ switch (chip->bus) {
+ case SENSORS_CHIP_NAME_BUS_ISA:
+ name = g_strdup_printf ("%s-isa-%04x", chip->prefix, chip->addr);
+ break;
+ case SENSORS_CHIP_NAME_BUS_DUMMY:
+ name = g_strdup_printf ("%s-%s-%04x", chip->prefix, chip->busname, chip->addr);
+ break;
+ case SENSORS_CHIP_NAME_BUS_PCI:
+ name = g_strdup_printf ("%s-pci-%04x", chip->prefix, chip->addr);
+ break;
+ default:
+ name = g_strdup_printf ("%s-i2c-%d-%02x", chip->prefix, chip->bus, chip->addr);
+ break;
+ }
+#else
+ // adapted from lm-sensors:prog/sensors/main.c:sprintf_chip_name
+ // in lm-sensors-3.0
+#define BUF_SIZE 200
+ name = g_malloc0(BUF_SIZE);
+ if (sensors_snprintf_chip_name(name, BUF_SIZE, chip) < 0) {
+ g_free(name);
+ name = NULL;
+ }
+
+#endif
+
+ return name;
+}
+
+#if SENSORS_API_VERSION < 0x400
+static SensorType get_sensor_type (const char *name) {
+ SensorType type = CURRENT_SENSOR;
+
+ if (g_strrstr(name, "in")) {
+ type = VOLTAGE_SENSOR;
+ }
+ else if (g_strrstr(name, "fan")) {
+ type = FAN_SENSOR;
+ }
+ else if (g_strrstr(name, "temp")) {
+ type = TEMP_SENSOR;
+ } else {
+ g_debug("sensor %s not recognised as either voltage, fan or temp sensor - assuming is a current sensor", name);
+ type = CURRENT_SENSOR;
+ }
+ return type;
+}
+
+
+/* If a sensor is 'interesting' to us then return its label, otherwise NULL. */
+static char *get_sensor_interesting_label (sensors_chip_name chip, int feature) {
+ char *label;
+
+ if (sensors_get_ignored(chip, feature) &&
+ (sensors_get_label(chip, feature, &label) == 0)) {
+ if (! (strcmp ("alarms", label) == 0 || strncmp ("sensor", label, 6) == 0)) {
+ return label;
+ } else {
+ free (label);
+ }
+ }
+
+
+ return NULL;
+}
+
+static const sensors_feature_data * get_sensor_min_max(const sensors_chip_name *chip,
+ int *n1, int *n2,
+ int number,
+ gdouble *low_value,
+ gdouble *high_value) {
+ const sensors_feature_data *data;
+ double value;
+
+ /* The sub features are returned directly after the main feature by
+ sensors_get_all_features(), so no need to iterate over all features */
+ while ((data = sensors_get_all_features (*chip, n1, n2)) != NULL &&
+ data->mapping == number) {
+ if ((data->mode & SENSORS_MODE_R) &&
+ (sensors_get_feature(*chip, data->number, &value) == 0) &&
+ data->name != NULL) {
+ if (g_str_has_suffix(data->name, "_min")) {
+
+ *low_value = value;
+
+ g_debug("overriding low value of sensor %s with value %f\n", data->name, value);
+
+ } else if (g_str_has_suffix(data->name, "_max")) {
+
+ *high_value = value;
+ g_debug("overriding high value of sensor %s with value %f\n", data->name, value);
+
+ }
+
+ }
+ }
+ return data;
+}
+
+#endif
+
+static IconType get_sensor_icon (SensorType type) {
+ switch (type) {
+ case TEMP_SENSOR:
+ return CPU_ICON;
+ case FAN_SENSOR:
+ return FAN_ICON;
+ default:
+ return GENERIC_ICON;
+ }
+}
+
+
+#if SENSORS_API_VERSION < 0x400
+static void check_sensor_with_data(GList **sensors,
+ const char * const chip_name,
+ const sensors_chip_name *chip,
+ int *n1, int *n2,
+ const sensors_feature_data *data)
+{
+ char *label;
+ double value;
+ SensorsAppletSensorInfo *sensor_info = NULL;
+
+ /* ... some of which are boring ... */
+ if ((label = get_sensor_interesting_label (*chip, data->number))) {
+ /* ... and some of which are actually sensors */
+ if ((data->mode & SENSORS_MODE_R) &&
+ (data->mapping == SENSORS_NO_MAPPING) &&
+ (sensors_get_feature(*chip, data->number, &value) == 0) // make sure we can actually get a value for it
+ ) {
+ SensorType type;
+ gboolean visible;
+ IconType icon;
+ gdouble low_value, high_value;
+
+ gchar *url;
+
+ type = get_sensor_type (data->name);
+ visible = (type == TEMP_SENSOR ? TRUE : FALSE);
+ icon = get_sensor_icon(type);
+
+ // the 'path' contains all the information we need to
+ // identify this sensor later
+ url = g_strdup_printf ("sensor://%s/%d", chip_name, data->number);
+
+ // get low and high values
+ sensors_applet_plugin_default_sensor_limits(type,
+ &low_value,
+ &high_value);
+
+ data = get_sensor_min_max(chip, n1, n2, data->number,
+ &low_value, &high_value);
+ if (data != NULL) {
+ // try adding this one
+ // at this point we have called sensors_get_all_features() and stopped when we have a potential new sensor, so make sure we try this as well - do a recursive call
+ check_sensor_with_data(sensors, chip_name, chip, n1, n2, data);
+
+ }
+
+ g_hash_table_insert(hash_table, g_strdup(url), (void *)chip);
+ // the id identifies a particular sensor for the user;
+ // we default to the label returned by libsensors
+ sensors_applet_plugin_add_sensor_with_limits(sensors,
+ url,
+ label,
+ label,
+ type,
+ visible,
+ low_value,
+ high_value,
+ icon,
+ DEFAULT_GRAPH_COLOR);
+ g_free(url);
+ }
+ free (label);
+ }
+
+}
+
+#endif
+
+
+static GList *libsensors_plugin_get_sensors(void) {
+ const sensors_chip_name *chip_name;
+ int i;
+ GList *sensors = NULL;
+
+#if SENSORS_API_VERSION < 0x400
+ FILE *file;
+ g_debug("%s: using libsensors version < 4", __FUNCTION__);
+
+ /* try to open config file, otherwise try alternate config
+ * file - if neither succeed, exit */
+ if ((file = fopen (LIBSENSORS_CONFIG_FILE, "r")) == NULL) {
+ if ((file = fopen (LIBSENSORS_ALTERNATIVE_CONFIG_FILE, "r")) == NULL) {
+ g_debug("%s: error opening libsensors config file... ", __FUNCTION__);
+ return sensors;
+ }
+ }
+
+ /* at this point should have an open config file, if is not
+ * valid, close file and return */
+ if (sensors_init(file) != 0) {
+ fclose(file);
+ g_debug("%s: error initing libsensors from config file...", __FUNCTION__);
+ return sensors;
+ }
+ fclose(file);
+
+ /* libsensors exposes a number of chips - ... */
+ i = 0;
+ while ((chip_name = sensors_get_detected_chips (&i)) != NULL) {
+ char *chip_name_string;
+ const sensors_feature_data *data;
+ int n1 = 0, n2 = 0;
+
+ chip_name_string = get_chip_name_string(chip_name);
+
+ /* ... each of which has one or more 'features' ... */
+ while ((data = sensors_get_all_features (*chip_name, &n1, &n2)) != NULL) { // error
+ // fill in list for us
+ check_sensor_with_data(&sensors, chip_name_string,
+ chip_name, &n1, &n2, data);
+ }
+ g_free (chip_name_string);
+ }
+
+#else
+ g_debug("%s: using libsensors version >= 4", __FUNCTION__);
+
+ int nr = 0;
+ if (sensors_init(NULL) != 0) {
+ g_debug("%s: error initing libsensors", __FUNCTION__);
+ return sensors;
+ }
+ i = 0;
+ while ((chip_name = sensors_get_detected_chips(NULL, &nr)))
+ {
+ char *chip_name_string, *label;
+ const sensors_subfeature *input_feature;
+ const sensors_subfeature *low_feature;
+ const sensors_subfeature *high_feature;
+ const sensors_feature *main_feature;
+ SensorType type;
+ gint nr1 = 0;
+ gdouble value, low, high;
+ gchar *path;
+ gboolean visible;
+ IconType icon;
+
+ chip_name_string = get_chip_name_string(chip_name);
+ if (chip_name_string == NULL) {
+ g_debug("%s: %d: error getting name string for sensor: %s\n",
+ __FILE__, __LINE__, chip_name->path);
+ continue;
+ }
+
+ while ((main_feature = sensors_get_features(chip_name, &nr1)))
+ {
+ switch (main_feature->type)
+ {
+ case SENSORS_FEATURE_IN:
+ type = VOLTAGE_SENSOR;
+ input_feature = sensors_get_subfeature(chip_name,
+ main_feature,
+ SENSORS_SUBFEATURE_IN_INPUT);
+ low_feature = sensors_get_subfeature(chip_name,
+ main_feature,
+ SENSORS_SUBFEATURE_IN_MIN);
+ high_feature = sensors_get_subfeature(chip_name,
+ main_feature,
+ SENSORS_SUBFEATURE_IN_MAX);
+ break;
+ case SENSORS_FEATURE_FAN:
+ type = FAN_SENSOR;
+ input_feature = sensors_get_subfeature(chip_name,
+ main_feature,
+ SENSORS_SUBFEATURE_FAN_INPUT);
+ low_feature = sensors_get_subfeature(chip_name,
+ main_feature,
+ SENSORS_SUBFEATURE_FAN_MIN);
+ // no fan max feature
+ high_feature = NULL;
+ break;
+ case SENSORS_FEATURE_TEMP:
+ type = TEMP_SENSOR;
+ input_feature = sensors_get_subfeature(chip_name,
+ main_feature,
+ SENSORS_SUBFEATURE_TEMP_INPUT);
+ low_feature = sensors_get_subfeature(chip_name,
+ main_feature,
+ SENSORS_SUBFEATURE_TEMP_MIN);
+ high_feature = sensors_get_subfeature(chip_name,
+ main_feature,
+ SENSORS_SUBFEATURE_TEMP_MAX);
+ if (!high_feature)
+ high_feature = sensors_get_subfeature(chip_name,
+ main_feature,
+ SENSORS_SUBFEATURE_TEMP_CRIT);
+ break;
+ default:
+ g_debug("%s: %d: error determining type for: %s\n",
+ __FILE__, __LINE__, chip_name_string);
+ continue;
+ }
+
+ if (!input_feature)
+ {
+ g_debug("%s: %d: could not get input subfeature for: %s\n",
+ __FILE__, __LINE__, chip_name_string);
+ continue;
+ }
+ // if still here we got input feature so get label
+ label = sensors_get_label(chip_name, main_feature);
+ if (!label)
+ {
+ g_debug("%s: %d: error: could not get label for: %s\n",
+ __FILE__, __LINE__, chip_name_string);
+ continue;
+ }
+
+ g_assert(chip_name_string && label);
+
+ icon = get_sensor_icon(type);
+ visible = (type == TEMP_SENSOR ? TRUE : FALSE);
+ sensors_applet_plugin_default_sensor_limits(type,
+ &low,
+ &high);
+ if (low_feature) {
+ sensors_get_value(chip_name, low_feature->number, &low);
+ }
+
+ if (high_feature) {
+ sensors_get_value(chip_name, high_feature->number, &high);
+ }
+
+
+ if (sensors_get_value(chip_name, input_feature->number, &value) < 0) {
+ g_debug("%s: %d: error: could not get value for input feature of sensor: %s\n",
+ __FILE__, __LINE__, chip_name_string);
+ free(label);
+ continue;
+ }
+
+ g_debug("for chip %s (type %s) got label %s and value %f", chip_name_string,
+ (type == TEMP_SENSOR ? "temp" :
+ (type == FAN_SENSOR ? "fan" :
+ (type == VOLTAGE_SENSOR ? "voltage" : "error"))), label, value);
+
+ path = g_strdup_printf ("sensor://%s/%d", chip_name_string, input_feature->number);
+ g_hash_table_insert(hash_table, g_strdup(path), (void *)chip_name);
+ sensors_applet_plugin_add_sensor_with_limits(&sensors,
+ path,
+ label,
+ label,
+ type,
+ visible,
+ low,
+ high,
+ icon,
+ DEFAULT_GRAPH_COLOR);
+ }
+ g_free(chip_name_string);
+
+
+ }
+#endif
+
+ return sensors;
+}
+
+static gdouble libsensors_plugin_get_sensor_value(const gchar *path,
+ const gchar *id,
+ SensorType type,
+ GError **error) {
+ gdouble result = 0;
+ regmatch_t m[3];
+
+ /* parse the uri into a (chip, feature) tuplet */
+ if (regexec (&uri_re, path, 3, m, 0) == 0) {
+ const sensors_chip_name *found_chip;
+ int feature;
+ int i;
+
+ if ((found_chip = g_hash_table_lookup(hash_table,
+ path)) != NULL)
+ {
+ gdouble value;
+ feature = atoi(path + m[2].rm_so);
+#if SENSORS_API_VERSION < 0x400
+ /* retrieve the value of the feature */
+ if (sensors_get_feature (*found_chip, feature, &value) == 0) {
+ result = value;
+ } else {
+ g_set_error (error, SENSORS_APPLET_PLUGIN_ERROR, LIBSENSORS_MISSING_FEATURE_ERROR, "Error retrieving sensor value");
+ }
+#else
+ if (sensors_get_value(found_chip, feature, &value) >= 0) {
+ result = value;
+ } else {
+ g_set_error (error, SENSORS_APPLET_PLUGIN_ERROR, LIBSENSORS_MISSING_FEATURE_ERROR, "Error retrieving sensor value");
+ }
+#endif
+ } else {
+ g_set_error (error, SENSORS_APPLET_PLUGIN_ERROR, LIBSENSORS_CHIP_NOT_FOUND_ERROR, "Chip not found");
+ }
+ } else {
+ g_set_error (error, SENSORS_APPLET_PLUGIN_ERROR, LIBSENSORS_REGEX_URL_COMPILE_ERROR, "Error compiling URL regex");
+ }
+ return result;
+}
+
+
+static GList *libsensors_plugin_init() {
+ /* compile the regular expressions */
+ if (regcomp(&uri_re, "^sensor://([a-z0-9_-]+)/([0-9]+)$",
+ REG_EXTENDED | REG_ICASE) != 0) {
+ g_debug("Error compiling regexp...not initing libsensors sensors interface");
+ return NULL;
+ }
+
+ /* create hash table to associate path strings with sensors_chip_name
+ * pointers - make sure it free's the keys strings on destroy */
+ hash_table = g_hash_table_new_full(g_str_hash,
+ g_str_equal,
+ g_free,
+ NULL);
+ return libsensors_plugin_get_sensors();
+}
+
+
+const gchar *sensors_applet_plugin_name(void)
+{
+ return plugin_name;
+}
+
+GList *sensors_applet_plugin_init(void)
+{
+ return libsensors_plugin_init();
+}
+
+gdouble sensors_applet_plugin_get_sensor_value(const gchar *path,
+ const gchar *id,
+ SensorType type,
+ GError **error) {
+ return libsensors_plugin_get_sensor_value(path, id, type, error);
+}
diff --git a/plugins/libsensors/libsensors-plugin.h b/plugins/libsensors/libsensors-plugin.h
new file mode 100644
index 0000000..6b03047
--- /dev/null
+++ b/plugins/libsensors/libsensors-plugin.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2005-2009 Alex Murray <[email protected]>
+ *
+ * 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 LIBSENSORS_SENSORS_INTERFACE_H
+#define LIBSENSORS_SENSORS_INTERFACE_H
+
+#include <sensors-applet/sensors-applet-plugin.h>
+
+#endif /* LIBSENSORS_SENSORS_INTERFACE_H*/