diff --git a/external/LibreHardwareMonitor/HidSharp.dll b/external/LibreHardwareMonitor/HidSharp.dll new file mode 100644 index 00000000..895c318a Binary files /dev/null and b/external/LibreHardwareMonitor/HidSharp.dll differ diff --git a/external/LibreHardwareMonitor/test_librehardwaremonitor.py b/external/LibreHardwareMonitor/test_librehardwaremonitor.py new file mode 100644 index 00000000..782a58ad --- /dev/null +++ b/external/LibreHardwareMonitor/test_librehardwaremonitor.py @@ -0,0 +1,56 @@ +# Use this file to display all hardware & sensors available from LibreHardwareMonitor on your computer +# Windows only - needs administrative rights +import ctypes +import sys +import clr +import os +from win32api import * + +if ctypes.windll.shell32.IsUserAnAdmin() == 0: + print("Program is not running as administrator. Please run with admin rights or choose another HW_SENSORS option " + "in config.yaml") + try: + sys.exit(0) + except: + os._exit(0) + +# noinspection PyUnresolvedReferences +clr.AddReference(os.getcwd() + '\\LibreHardwareMonitorLib.dll') +# noinspection PyUnresolvedReferences +clr.AddReference(os.getcwd() + '\\HidSharp.dll') +# noinspection PyUnresolvedReferences +from LibreHardwareMonitor import Hardware + +File_information = GetFileVersionInfo(os.getcwd() + '\\LibreHardwareMonitorLib.dll', "\\") +ms_file_version = File_information['FileVersionMS'] +ls_file_version = File_information['FileVersionLS'] +print("Found LibreHardwareMonitorLib %s" % ".".join([str(HIWORD(ms_file_version)), str(LOWORD(ms_file_version)), + str(HIWORD(ls_file_version)), + str(LOWORD(ls_file_version))])) + +File_information = GetFileVersionInfo(os.getcwd() + '\\HidSharp.dll', "\\") +ms_file_version = File_information['FileVersionMS'] +ls_file_version = File_information['FileVersionLS'] +print("Found HidSharp %s" % ".".join([str(HIWORD(ms_file_version)), str(LOWORD(ms_file_version)), + str(HIWORD(ls_file_version)), + str(LOWORD(ls_file_version))])) + +handle = Hardware.Computer() +handle.IsCpuEnabled = True +handle.IsGpuEnabled = True +handle.IsMemoryEnabled = True +handle.IsMotherboardEnabled = True +handle.IsControllerEnabled = True +handle.IsNetworkEnabled = True +handle.IsStorageEnabled = True +handle.Open() + +for hw in handle.Hardware: + print("%s | %s | %s" % (hw.HardwareType, hw.Name, hw.Identifier)) + hw.Update() + + for sensor in hw.Sensors: + print(" %s | %s | %s" % (sensor.SensorType, sensor.Name, sensor.Value)) + print("----------------------------------------------------") + +handle.Close() diff --git a/library/sensors/sensors_librehardwaremonitor.py b/library/sensors/sensors_librehardwaremonitor.py index a9c215f2..d03df754 100644 --- a/library/sensors/sensors_librehardwaremonitor.py +++ b/library/sensors/sensors_librehardwaremonitor.py @@ -17,6 +17,8 @@ # noinspection PyUnresolvedReferences clr.AddReference(lhm_dll) # noinspection PyUnresolvedReferences +clr.AddReference(os.getcwd() + '\\external\\LibreHardwareMonitor\\HidSharp.dll') +# noinspection PyUnresolvedReferences from LibreHardwareMonitor import Hardware File_information = GetFileVersionInfo(lhm_dll, "\\")