From dc567aaead4dc270ea7a39b0c03d10922b03baec Mon Sep 17 00:00:00 2001 From: Jaap Versteegh Date: Thu, 26 Jul 2012 18:48:19 +0200 Subject: Extended description of with-aticonfig option --- configure.ac | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 5398f1d..4210b3b 100644 --- a/configure.ac +++ b/configure.ac @@ -103,9 +103,10 @@ LIBMATENOTIFY_CFLAGS= LIBMATENOTIFY_LIBS= # enable support even if not specifically asked for -AC_ARG_ENABLE(libmatenotify, [ --enable-libmatenotify enable libmatenotify support], [ - enable_libmatenotify=$enableval], [ - enable_libmatenotify="yes" +AC_ARG_ENABLE(libmatenotify, +[ --enable-libmatenotify Enable libmatenotify support], [ + enable_libmatenotify=$enableval], [ + enable_libmatenotify="yes" ]) if test "x$enable_libmatenotify" = "xno" @@ -167,7 +168,7 @@ AC_SUBST(LIBSENSORS_LIBS) # do nvidia by default if available AC_ARG_WITH(nvidia, -[ --with-nvidia[=DIR] use nvidia in DIR],[ +[ --with-nvidia[=DIR] use nvidia in DIR],[ if test "$withval" != "no" -a "$withval" != "yes"; then NVIDIA_DIR=$withval CFLAGS="${CFLAGS} -I${NVIDIA_DIR}/include" @@ -181,7 +182,7 @@ if test "$with_nvidia" = "no"; then echo "Disabling nvidia support" else AC_ARG_WITH(x11, - [ --with-x11[=DIR] use x11 in DIR],[ + [ --with-x11[=DIR] use x11 in DIR],[ if test "$withval" != "no" -a "$withval" != "yes"; then X11_DIR=$withval CFLAGS="${CFLAGS} -I${X11_DIR}/include" @@ -215,8 +216,9 @@ AM_CONDITIONAL(NVIDIA, test -n "$NVIDIA_LIBS") AC_SUBST(NVIDIA_CFLAGS) AC_SUBST(NVIDIA_LIBS) -AC_ARG_WITH(aticonfig, [ - --with-aticonfig[=PATH] use aticonfig provided by PATH], [ +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 -- cgit v1.2.1 From 58aeb9344c1794551d159d6a7dafed74ac0e08e0 Mon Sep 17 00:00:00 2001 From: Jaap Versteegh Date: Thu, 26 Jul 2012 18:49:35 +0200 Subject: List disks by persistent id rather than device node --- plugins/udisks/udisks-plugin.c | 45 +++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/plugins/udisks/udisks-plugin.c b/plugins/udisks/udisks-plugin.c index 16fed3c..9763015 100644 --- a/plugins/udisks/udisks-plugin.c +++ b/plugins/udisks/udisks-plugin.c @@ -1,4 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * vim: sts=0 sw=8 ts=8 tw=78 noexpandtab * * Copyright (C) 2009 Pramod Dematagoda * @@ -115,7 +116,7 @@ static void udisks_plugin_get_sensors(GList **sensors) { /* This proxy is used to get the required data in order to build * up the list of sensors */ - GValue model = {0, }, id = {0, }, smart_available = {0, }; + GValue smart_available = G_VALUE_INIT; gchar *path = (gchar *)g_ptr_array_index(paths, i); sensor_proxy = dbus_g_proxy_new_for_name(connection, @@ -130,27 +131,37 @@ static void udisks_plugin_get_sensors(GList **sensors) { "DriveAtaSmartIsAvailable", G_TYPE_INVALID, G_TYPE_VALUE, &smart_available, G_TYPE_INVALID)) { - gchar *id_str, *model_str; if (!g_value_get_boolean(&smart_available)) { - g_debug("Drive at path '%s' does not support Smart monitoring... ignoring", + g_debug("Drive at path '%s' does not support " + "Smart monitoring... ignoring", path); g_object_unref(sensor_proxy); g_free (path); continue; } + GValue model_v = G_VALUE_INIT; dbus_g_proxy_call(sensor_proxy, "Get", NULL, G_TYPE_STRING, UDISKS_BUS_NAME, G_TYPE_STRING, "DriveModel", G_TYPE_INVALID, - G_TYPE_VALUE, &model, + G_TYPE_VALUE, &model_v, G_TYPE_INVALID); + GValue dev_v = G_VALUE_INIT; dbus_g_proxy_call(sensor_proxy, "Get", NULL, G_TYPE_STRING, UDISKS_BUS_NAME, G_TYPE_STRING, "DeviceFile", G_TYPE_INVALID, - G_TYPE_VALUE, &id, + G_TYPE_VALUE, &dev_v, + G_TYPE_INVALID); + + GValue ids_v = G_VALUE_INIT; + dbus_g_proxy_call(sensor_proxy, "Get", NULL, + G_TYPE_STRING, UDISKS_BUS_NAME, + G_TYPE_STRING, "DeviceFileById", + G_TYPE_INVALID, + G_TYPE_VALUE, &ids_v, G_TYPE_INVALID); g_object_unref(sensor_proxy); @@ -184,24 +195,30 @@ static void udisks_plugin_get_sensors(GList **sensors) { info->changed = TRUE; g_hash_table_insert(devices, info->path, info); + gchar *model = g_value_get_string(&model_v); + gchar *dev = g_value_get_string(&dev_v); + GStrv ids = g_value_get_boxed(&ids_v); + + gchar *id = ids != NULL && ids[0] != NULL ? ids[0] : dev; + /* Write the sensor data */ - id_str = g_value_get_string(&id); - model_str = g_value_get_string(&model); sensors_applet_plugin_add_sensor(sensors, path, - id_str, - model_str, + id, + model, TEMP_SENSOR, FALSE, HDD_ICON, DEFAULT_GRAPH_COLOR); - g_free(id_str); - g_free(model_str); + g_strfreev(ids); + g_free(model); + g_free(dev); + g_debug("Added %s %s", path, id); } else { g_debug ("Cannot obtain data for device: %s\n" - "Error: %s\n", - path, - error->message); + "Error: %s\n", + path, + error->message); g_error_free (error); error = NULL; g_object_unref(sensor_proxy); -- cgit v1.2.1 From d3263c4135e55df4ceba1d609045ff680016054b Mon Sep 17 00:00:00 2001 From: Jaap Versteegh Date: Thu, 26 Jul 2012 22:30:05 +0200 Subject: Also use id in hash table of sensors --- plugins/udisks/udisks-plugin.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/plugins/udisks/udisks-plugin.c b/plugins/udisks/udisks-plugin.c index 9763015..a2d56ea 100644 --- a/plugins/udisks/udisks-plugin.c +++ b/plugins/udisks/udisks-plugin.c @@ -40,6 +40,7 @@ */ typedef struct _DevInfo{ gchar *path; + gchar *id; gboolean changed; gdouble temp; DBusGProxy *sensor_proxy; @@ -181,30 +182,32 @@ static void udisks_plugin_get_sensors(GList **sensors) { G_CALLBACK(udisks_changed_signal_cb), path, NULL); + + gchar *model = g_value_get_string(&model_v); + gchar *dev = g_value_get_string(&dev_v); + GStrv ids = g_value_get_boxed(&ids_v); + + gchar *id = ids != NULL && ids[0] != NULL ? ids[0] : dev; + info = g_malloc(sizeof(DevInfo)); if (devices == NULL) { devices = g_hash_table_new(g_str_hash, g_str_equal); } + info->id = g_strdup(id); info->path = g_strdup(path); info->sensor_proxy = sensor_proxy; /* Set the device status changed as TRUE because we need * to get the initial temperature reading */ info->changed = TRUE; - g_hash_table_insert(devices, info->path, info); - - gchar *model = g_value_get_string(&model_v); - gchar *dev = g_value_get_string(&dev_v); - GStrv ids = g_value_get_boxed(&ids_v); - - gchar *id = ids != NULL && ids[0] != NULL ? ids[0] : dev; + g_hash_table_insert(devices, info->id, info); /* Write the sensor data */ sensors_applet_plugin_add_sensor(sensors, - path, id, + "Disk Temperature", model, TEMP_SENSOR, FALSE, @@ -260,7 +263,7 @@ static gdouble udisks_plugin_get_sensor_value(const gchar *path, GValue smart_time = { 0, }; sensor_proxy = dbus_g_proxy_new_for_name(connection, UDISKS_BUS_NAME, - path, + info->path, UDISKS_PROPERTIES_INTERFACE); if (!dbus_g_proxy_call(sensor_proxy, "Get", error, G_TYPE_STRING, UDISKS_BUS_NAME, -- cgit v1.2.1