From 3992aafc087acfa68f9b717a2a25a1dd02bb46f8 Mon Sep 17 00:00:00 2001 From: "Oliveira, Daniel" Date: Wed, 23 Aug 2023 23:44:26 -0500 Subject: [PATCH] rocm_smi_lib/rocm_smi.py: Fix rocm-smi --resetfans shows 'permission denied' Properly handles 'Not supported' fan cases where: * sysfs file (pwm#_enable) exists * sysfs file (pwm#_enable) does not exist Change-Id: Ifa3c290e5ee1d27a550e94d86cd25ad8dcef3f59 Signed-off-by: Oliveira, Daniel [ROCm/rocm_smi_lib commit: 654f65118b15dea36625e4b72a291556f96a7a1a] --- projects/rocm-smi-lib/python_smi_tools/rocm_smi.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py b/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py index 8483d804b8..24e13e882e 100755 --- a/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py +++ b/projects/rocm-smi-lib/python_smi_tools/rocm_smi.py @@ -785,8 +785,12 @@ def resetFans(deviceList): for device in deviceList: sensor_ind = c_uint32(0) ret = rocmsmi.rsmi_dev_fan_reset(device, sensor_ind) - if rsmi_ret_ok(ret, device, 'reset_fan'): - printLog(device, 'Successfully reset fan speed to driver control', None) + if (ret == rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED) or (ret == rsmi_status_t.RSMI_STATUS_PERMISSION): + if not rsmi_ret_ok(rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED, device, 'reset_fan'): + continue + else: + if rsmi_ret_ok(ret, device, 'reset_fan'): + printLog(device, 'Successfully reset fan speed to driver control', None) printLogSpacer()