Ver código fonte

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

Malte Veerman 5 anos atrás
pai
commit
061345de24
1 arquivos alterados com 10 adições e 2 exclusões
  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;
     }