Skip to content

Commit

Permalink
fix sysfs reading that gets garbage end of line using strip
Browse files Browse the repository at this point in the history
update file header to 2024
  • Loading branch information
dbarashinvd committed Jan 16, 2024
1 parent 6107b51 commit 667ddbc
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
# Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES.
# Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -279,14 +279,11 @@ 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()
val = module_fd.read().strip()
module_fd.seek(0)
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]))
# workaround for garbage received after the 0 or 1 value of sysfs i.e. 0#012 or 1#012
if len(val) > 1:
val = val[0]
if self.is_dummy_event(int(val), module_obj):
logger.log_info(f"dynamic detection dummy event port {module_obj.port_num} from fd number {fd}")
continue
Expand Down

0 comments on commit 667ddbc

Please sign in to comment.