diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py index d89a046940d0..914ef050d2c7 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/plugins/psuutil.py @@ -20,10 +20,14 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - - self.psu_path = "/bsp/module/" - self.psu_presence = "psu{}_pwr_status" - self.psu_oper_status = "psu{}_pwr_status" + self.psu_path = "" + for index in range(0, 100): + hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index) + if os.path.exists(hwmon_path): + self.psu_path = hwmon_path + break + self.psu_presence = "pwr{}" + self.psu_oper_status = "pwr{}" def get_num_psus(self): """ diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py index 01954dededf7..b9bb580d7c57 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/plugins/psuutil.py @@ -21,9 +21,14 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - self.psu_path = "/bsp/module/" - self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pwr_status" + self.psu_path = "" + for index in range(0, 100): + hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index) + if os.path.exists(hwmon_path): + self.psu_path = hwmon_path + break + self.psu_presence = "pwr{}" + self.psu_oper_status = "pwr{}" def get_num_psus(self): """ diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py index 13738bb77f46..954045dde59c 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/plugins/psuutil.py @@ -21,9 +21,14 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - self.psu_path = "/bsp/module/" - self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pwr_status" + self.psu_path = "" + for index in range(0, 100): + hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index) + if os.path.exists(hwmon_path): + self.psu_path = hwmon_path + break + self.psu_presence = "psu{}" + self.psu_oper_status = "pwr{}" def get_num_psus(self): """ diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py index 13738bb77f46..954045dde59c 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/psuutil.py @@ -21,9 +21,14 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - self.psu_path = "/bsp/module/" - self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pwr_status" + self.psu_path = "" + for index in range(0, 100): + hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index) + if os.path.exists(hwmon_path): + self.psu_path = hwmon_path + break + self.psu_presence = "psu{}" + self.psu_oper_status = "pwr{}" def get_num_psus(self): """ diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py index 13738bb77f46..8c47a0083249 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/plugins/psuutil.py @@ -20,10 +20,14 @@ class PsuUtil(PsuBase): def __init__(self): PsuBase.__init__(self) - - self.psu_path = "/bsp/module/" - self.psu_presence = "psu{}_status" - self.psu_oper_status = "psu{}_pwr_status" + self.psu_path = "" + for index in range(0, 100): + hwmon_path = "/sys/devices/platform/mlxplat/mlxreg-hotplug/hwmon/hwmon{}/".format(index) + if os.path.exists(hwmon_path): + self.psu_path = hwmon_path + break + self.psu_presence = "psu{}" + self.psu_oper_status = "pwr{}" def get_num_psus(self): """