From 6b25da96c333987ec43ebcc6b7f8d63c79623ede Mon Sep 17 00:00:00 2001 From: Doron Barashi Date: Tue, 26 Dec 2023 09:02:32 +0000 Subject: [PATCH] move seek to beginnig of sysfs fd before reading to resolve power_good sysfs returns empty upon plug out cable --- .../mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py b/platform/mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py index 4e96fba79006..f69d00772e68 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/modules_mgmt.py @@ -279,8 +279,8 @@ def run(self): module_fd_path = module_obj.module_power_good_fd_path self.fds_events_count_dict[module_obj.port_num][fd_name] += 1 try: - val = module_fd.read() module_fd.seek(0) + val = module_fd.read() logger.log_info("dynamic detection got module_obj {} with port {} from fd number {} path {} val {} count {}" .format(module_obj, module_obj.port_num, fd, module_fd_path , val, self.fds_events_count_dict[module_obj.port_num]))