From 239212e11dcb3f7f8092417d7dd444e898a5c952 Mon Sep 17 00:00:00 2001 From: Robert Antoni Buj Gelonch Date: Wed, 30 Dec 2020 08:37:07 +0100 Subject: Drop aticonfig plugin (#119) * aticonfig-plugin: remove unused variable warning reported by cppcheck * Remove aticonfig plugin --- configure.ac | 29 ------- plugins/Makefile.am | 8 +- plugins/aticonfig/Makefile.am | 24 ------ plugins/aticonfig/aticonfig-plugin.c | 156 ----------------------------------- plugins/aticonfig/aticonfig-plugin.h | 25 ------ po/POTFILES.in | 1 - 6 files changed, 3 insertions(+), 240 deletions(-) delete mode 100644 plugins/aticonfig/Makefile.am delete mode 100644 plugins/aticonfig/aticonfig-plugin.c delete mode 100644 plugins/aticonfig/aticonfig-plugin.h diff --git a/configure.ac b/configure.ac index 22c368b..e0f8b7d 100644 --- a/configure.ac +++ b/configure.ac @@ -215,34 +215,6 @@ AM_CONDITIONAL(NVIDIA, test -n "$NVIDIA_LIBS") AC_SUBST(NVIDIA_CFLAGS) AC_SUBST(NVIDIA_LIBS) -AC_ARG_WITH(aticonfig, -[ --with-aticonfig[=PATH] use aticonfig plugin with optional binary provided - by PATH], [ - if test "$withval" != "no" -a "$withval" != "yes"; then - aticonfig_exe=$withval - else - aticonfig_exe=aticonfig - fi - with_aticonfig=$withval ], [ - aticonfig_exe=aticonfig - with_aticonfig="check" -]) - -if test "x$with_aticonfig" = "xcheck"; then - AC_CHECK_PROG(ATICONFIG_EXE, ["$aticonfig_exe"], yes, no) - if test "x$ATICONFIG_EXE" = "xno"; then - with_aticonfig="no" - fi -fi - -AM_CONDITIONAL(ATICONFIG, test "$with_aticonfig" != "no") -if test "$with_aticonfig" = "no"; then - echo "Disabling aticonfig support" -else - AC_DEFINE(HAVE_ATICONFIG,1,[using aticonfig]) - AC_DEFINE_UNQUOTED(ATICONFIG_EXE, ["$aticonfig_exe"], [aticonfig executable]) -fi - # enable netbsd plugin AC_ARG_ENABLE(netbsd, AS_HELP_STRING([--enable-netbsd], @@ -293,7 +265,6 @@ AC_CONFIG_FILES([ plugins/mbmon/Makefile plugins/netbsd/Makefile plugins/nvidia/Makefile - plugins/aticonfig/Makefile plugins/omnibook/Makefile plugins/pmu-sys/Makefile plugins/smu-sys/Makefile diff --git a/plugins/Makefile.am b/plugins/Makefile.am index a3245b2..74dc757 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -1,3 +1,5 @@ +NULL= + DIST_SUBDIRS = \ acpi \ dummy \ @@ -15,7 +17,7 @@ DIST_SUBDIRS = \ pmu-sys \ smu-sys \ sonypi \ - aticonfig + $(NULL) SUBDIRS = \ acpi \ @@ -50,8 +52,4 @@ if NVIDIA SUBDIRS += nvidia endif -if ATICONFIG -SUBDIRS += aticonfig -endif - -include $(top_srcdir)/git.mk diff --git a/plugins/aticonfig/Makefile.am b/plugins/aticonfig/Makefile.am deleted file mode 100644 index d9f7524..0000000 --- a/plugins/aticonfig/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# ATICONFIG plugin -plugindir = $(libdir)/mate-sensors-applet/plugins - -AM_CPPFLAGS = -DMATELOCALEDIR=\""$(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) \ - $(WARN_CFLAGS) - -plugin_LTLIBRARIES = libaticonfig.la - -libaticonfig_la_SOURCES = \ - aticonfig-plugin.h \ - aticonfig-plugin.c - -libaticonfig_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) $(GLIB_LIBS) -libaticonfig_la_LIBADD = $(top_builddir)/lib/libmate-sensors-applet-plugin.la - --include $(top_srcdir)/git.mk diff --git a/plugins/aticonfig/aticonfig-plugin.c b/plugins/aticonfig/aticonfig-plugin.c deleted file mode 100644 index 0fedc05..0000000 --- a/plugins/aticonfig/aticonfig-plugin.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2009 Jaap Versteegh - * Copyright (C) 2005-2009 Alex Murray - * - * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#ifdef HAVE_STDIO_H -#include -#endif /* HAVE_STDIO_H */ - -#ifdef HAVE_TIME_H -#include -#endif /* HAVE_TIME_H */ - -#ifdef HAVE_UNISTD_H -#include -#endif /* HAVE_UNISTD_H */ - -#include -#include -#include "aticonfig-plugin.h" - -const gchar *plugin_name = "aticonfig"; - -#define GPU_CORE_TEMP "CoreTemp" -#define MAX_GPUS 4 -#define SENSOR_ID_PREFIX "ATIGPU" - -static gdouble gpu_temps[MAX_GPUS]; -static int num_gpus = 0; - -static int ati_get_temps(gdouble temps[], int max_temps) -{ - double temp; - int read_count; - int gpu_no = 0; - -#ifdef HAVE_STDIO_H - FILE *aticonfig = popen(ATICONFIG_EXE - " --adapter=all --od-gettemperature", "r"); - if (aticonfig == NULL) { - return 0; - } - while ((read_count = fscanf(aticonfig, "Temperature - %lf", &temp)) != EOF) { - if (read_count < 1) { - getc(aticonfig); - } - else { - temps[gpu_no] = (gdouble)temp; - if (++gpu_no >= max_temps) - break; - } - } - pclose(aticonfig); -#endif - - return gpu_no; -} - -static void ati_update_temps(void) -{ -#ifdef HAVE_TIME_H - static time_t last = 0; - time_t now = time(NULL); - /* Only update when more than two seconds have passed since last update */ - if (timediff(now, last) > 2) { -#endif - num_gpus = ati_get_temps(&gpu_temps, MAX_GPUS); -#ifdef HAVE_TIME_H - last = now; - } -#endif -} - - -static GList *aticonfig_plugin_init(void) -{ - GList *sensors = NULL; - - g_debug("Initializing aticonfig plugin\n"); - - int sensor_count = ati_get_temps(&gpu_temps, MAX_GPUS); - - int i; - for (i = 0; i < sensor_count; i++) { - gchar *id = g_strdup_printf("%s%d%s", SENSOR_ID_PREFIX, i, GPU_CORE_TEMP); - sensors_applet_plugin_add_sensor(&sensors, - GPU_CORE_TEMP, - id, - _("GPU"), - TEMP_SENSOR, - TRUE, - GPU_ICON, - DEFAULT_GRAPH_COLOR); - g_free(id); - } - - return sensors; -} - -static gdouble aticonfig_plugin_get_sensor_value(const gchar *path, - const gchar *id, - SensorType type, - GError **error) -{ - - if (g_ascii_strcasecmp(path, GPU_CORE_TEMP) != 0 || type != TEMP_SENSOR) { - g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, - 0, "Invalid sensor value request to aticonfig plugin"); - return 0; - } - ati_update_temps(); - - int i = g_ascii_strtoll(id + strlen(SENSOR_ID_PREFIX), NULL, 10); - if (i < 0 || i >= num_gpus) { - g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, - 0, "Sensor index out of range in aticonfig plugin"); - return 0; - } - return gpu_temps[i]; -} - -const gchar *sensors_applet_plugin_name(void) -{ - return plugin_name; -} - -GList *sensors_applet_plugin_init(void) -{ - return aticonfig_plugin_init(); -} - -gdouble sensors_applet_plugin_get_sensor_value(const gchar *path, - const gchar *id, - SensorType type, - GError **error) -{ - return aticonfig_plugin_get_sensor_value(path, id, type, error); -} diff --git a/plugins/aticonfig/aticonfig-plugin.h b/plugins/aticonfig/aticonfig-plugin.h deleted file mode 100644 index 1122902..0000000 --- a/plugins/aticonfig/aticonfig-plugin.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2009 Jaap Versteegh - * Copyright (C) 2005-2009 Alex Murray - * - * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef ATICONFIG_PLUGIN_H -#define ATICONFIG_PLUGIN_H - -#include - -#endif /* ATICONFIG_PLUGIN_H*/ diff --git a/po/POTFILES.in b/po/POTFILES.in index 3524695..4f48e14 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -11,7 +11,6 @@ plugins/nvidia/nvidia-plugin.c plugins/i2c-proc/i2c-proc-plugin.c plugins/acpi/acpi-plugin.c plugins/smu-sys/smu-sys-plugin.c -plugins/aticonfig/aticonfig-plugin.c sensors-applet/prefs-dialog.c sensors-applet/sensors-applet.h sensors-applet/active-sensor.c -- cgit v1.2.1