[Xfce4-commits] <xfce4-sensors-plugin:master> read ACPI from info instead of info_ and additionally try sys stuff in case of failure

Fabian noreply at xfce.org
Sun Dec 12 20:20:02 CET 2010


Updating branch refs/heads/master
         to 2de3ecda14df363a20ab643a0f8f33f24976b94c (commit)
       from 4a4f25aa78b7bd567077b0a69c709f6329f185d3 (commit)

commit 2de3ecda14df363a20ab643a0f8f33f24976b94c
Author: Fabian <timystery at arcor.de>
Date:   Fri Dec 10 20:51:07 2010 +0100

    read ACPI from info instead of info_ and additionally try sys stuff in case of failure

 include/acpi.h |    2 +-
 lib/acpi.c     |   33 ++++++++++++++++++++++++++++-----
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/include/acpi.h b/include/acpi.h
index 5be01bc..9fe7005 100644
--- a/include/acpi.h
+++ b/include/acpi.h
@@ -30,7 +30,7 @@
 #define ACPI_FILE_BATTERY_INFO  "info"
 #define ACPI_FILE_FAN           "state"
 
-#define ACPI_INFO               "info_"
+#define ACPI_INFO               "info"
 
 /* Gtk/Glib includes */
 #include <glib.h>
diff --git a/lib/acpi.c b/lib/acpi.c
index 9ea746c..79e655c 100644
--- a/lib/acpi.c
+++ b/lib/acpi.c
@@ -619,6 +619,10 @@ acpi_ignore_directory_entry (struct dirent *de)
 }
 
 
+/**
+ * Obtains ACPI version information.
+ * Might foget some space or tab bytes due to g_strchomp
+ **/
 char *
 get_acpi_info (void)
 {
@@ -627,16 +631,35 @@ get_acpi_info (void)
     TRACE ("enters get_acpi_info");
 
     filename = g_strdup_printf ("%s/%s", ACPI_PATH, ACPI_INFO);
-
-    TRACE ("leaves get_acpi_info");
-
     version = get_acpi_value (filename);
     g_free (filename);
+
     if (version!=NULL)
         version = g_strchomp (version);
 
-    if (version==NULL)
-        version = _("<Unknown>");
+		else // if (version==NULL)
+		{
+  	  filename = g_strdup_printf ("%s/%s_", ACPI_PATH, ACPI_INFO);
+      version = get_acpi_value (filename);
+      g_free (filename);
+		
+      if (version!=NULL)
+        version = g_strchomp (version);
+		
+  		else //if (version==NULL)
+  	
+  		{
+  			version = get_acpi_value ("/sys/module/acpi/parameters/acpica_version");
+  			if (version!=NULL)
+          version = g_strchomp (version);
+  		}
+		}
+  
+		// who knows, if we obtain non-NULL version at all...
+    if (version==NULL) // || g_strisempty(version))
+        version = g_strdup(_("<Unknown>"));
+
+    TRACE ("leaves get_acpi_info");
 
     return version;
 }



More information about the Xfce4-commits mailing list