Skip to content

Commit d363667

Browse files
committed
Try to use pyadl for GPU fan if psutil did not find any
1 parent bb9d92a commit d363667

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

library/sensors/sensors_python.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,18 @@ def fps() -> int:
325325
@staticmethod
326326
def fan_percent() -> float:
327327
try:
328+
# Try with psutil fans
328329
fans = sensors_fans_percent()
329330
if fans:
330331
for name, entries in fans.items():
331332
for entry in entries:
332333
if "gpu" in (entry.label or name):
333334
return entry.current
335+
336+
# Try with pyadl if psutil did not find GPU fan
337+
if pyadl:
338+
return pyadl.ADLManager.getInstance().getDevices()[0].getCurrentFanSpeed(
339+
pyadl.ADL_DEVICE_FAN_SPEED_TYPE_PERCENTAGE)
334340
except:
335341
pass
336342

0 commit comments

Comments
 (0)