Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mellanox] Fix issue: read data from eeprom should trim tail \0 #33

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions platform/mellanox/mlnx-platform-api/sonic_platform/eeprom.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,26 @@ def _load_eeprom(self):
self._base_mac = self.mgmtaddrstr(eeprom)
if self._base_mac is None:
self._base_mac = "Undefined."
else:
self._base_mac = self._base_mac.strip('\0')

self._serial_str = self.serial_number_str(eeprom)
if self._serial_str is None:
self._serial_str = "Undefined."
else:
self._serial_str = self._serial_str.strip('\0')

self._product_name = self.modelstr(eeprom)
if self._product_name is None:
self._product_name = "Undefined."
else:
self._product_name = self._product_name.strip('\0')

self._part_number = self.part_number_str(eeprom)
if self._part_number is None:
self._part_number = "Undefined."
else:
self._part_number = self._part_number.strip('\0')

original_stdout = sys.stdout
sys.stdout = StringIO()
Expand Down