-
-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HidSharp.dll, add test program for LibreHardwareMonitor
- Loading branch information
1 parent
497d25e
commit a67b154
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
56 changes: 56 additions & 0 deletions
56
external/LibreHardwareMonitor/test_librehardwaremonitor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters