Explorar el Código

added support for hwmons with their name file in the device subdirectory

Malte Veerman hace 5 años
padre
commit
061345de24
Se han modificado 1 ficheros con 10 adiciones y 2 borrados
  1. 10 2
      import/src/hwmon.cpp

+ 10 - 2
import/src/hwmon.cpp

@@ -62,12 +62,20 @@ Hwmon::Hwmon(const QString &path, Loader *parent) : QObject(parent),
             m_valid = false;
         }
 
-        const auto nameFile = new QFile(path + "/name");
+        auto nameFile = new QFile(path + "/name");
 
         if (nameFile->open(QFile::ReadOnly))
             m_name = QTextStream(nameFile).readLine();
         else
-            m_name = path.split('/').last();
+        {
+            delete nameFile;
+            nameFile = new QFile(path + "/device/name");
+
+            if (nameFile->open(QFile::ReadOnly))
+                m_name = QTextStream(nameFile).readLine();
+            else
+                m_name = path.split('/').last();
+        }
 
         delete nameFile;
     }