worked on smartmon support
[psensor.git] / src / lib / psensor.c
index 8d7b37e..835741f 100644 (file)
@@ -1,22 +1,21 @@
 /*
-    Copyright (C) 2010-2011 jeanfi@gmail.com
-
-    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 Street, Fifth Floor, Boston, MA
-    02110-1301 USA
-*/
-
+ * Copyright (C) 2010-2011 jeanfi@gmail.com
+ *
+ * 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 Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
 #include <stdlib.h>
 #include <string.h>
 
@@ -397,30 +396,30 @@ struct psensor **get_all_sensors(int values_max_length)
 
 const char *psensor_type_to_str(unsigned int type)
 {
-       if (type & SENSOR_TYPE_REMOTE)
-               return "Remote";
-
-       if (type & SENSOR_TYPE_LMSENSOR_TEMP)
-               return "Temperature";
-
-       if (type & SENSOR_TYPE_LMSENSOR_FAN)
-               return "Fan";
-
-       if (type & SENSOR_TYPE_NVIDIA_TEMP)
+       if ((type & SENSOR_TYPE_NVIDIA_TEMP) == SENSOR_TYPE_NVIDIA_TEMP)
                return "NVidia GPU Temperature";
 
-       if (type & SENSOR_TYPE_AMD_TEMP)
+       if ((type & SENSOR_TYPE_AMD_TEMP) == SENSOR_TYPE_AMD_TEMP)
                return "AMD GPU Temperature";
 
-       if (type & SENSOR_TYPE_AMD_FAN)
+       if ((type & SENSOR_TYPE_AMD_FAN) == SENSOR_TYPE_AMD_FAN)
                return "AMD GPU Fan Speed";
 
-       if (type & SENSOR_TYPE_HDD_TEMP)
+       if ((type & SENSOR_TYPE_HDD_TEMP) == SENSOR_TYPE_HDD_TEMP)
                return "HDD Temperature";
 
        if (type & SENSOR_TYPE_CPU_USAGE)
                return "CPU Usage";
 
+       if (type & SENSOR_TYPE_TEMP)
+               return "Temperature";
+
+       if (type & SENSOR_TYPE_FAN)
+               return "Fan";
+
+       if (type & SENSOR_TYPE_REMOTE)
+               return "Remote";
+
        return "N/A";           /* should not be possible */
 }
 
@@ -447,7 +446,9 @@ void psensor_list_update_measures(struct psensor **sensors)
        cpu_psensor_list_update(sensors);
 #endif
 
-       if (psensor_list_contains_type(sensors, SENSOR_TYPE_HDD_TEMP))
+       if (psensor_list_contains_type(sensors, SENSOR_TYPE_HDD_TEMP_HDDTEMP)
+           || psensor_list_contains_type(sensors,
+                                         SENSOR_TYPE_HDD_TEMP_ATASMART))
                hdd_psensor_list_update(sensors);
 }