Skip to content

Commit

Permalink
split i2c read across pages (sonic-net#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
prgeor authored Jan 6, 2022
1 parent 92203d2 commit ee12215
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 99 deletions.
6 changes: 6 additions & 0 deletions sonic_platform_base/sonic_xcvr/api/public/cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,13 @@ def get_application_advertisement(self):
}

ret = {}
# Read the application advertisment in lower memory
dic = self.xcvr_eeprom.read(consts.APPLS_ADVT_FIELD)

if not self.is_flat_memory():
# Read the application advertisement in page01
dic.update(self.xcvr_eeprom.read(consts.APPLS_ADVT_FIELD_PAGE01))

for app in range(1, 16):
buf = {}

Expand Down
1 change: 1 addition & 0 deletions sonic_platform_base/sonic_xcvr/fields/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@
MODULE_LEVEL_CONTROL = "ModuleControl"

APPLS_ADVT_FIELD = "Applications Advertisement"
APPLS_ADVT_FIELD_PAGE01 = "Applications Advertisement Pag01"
CTRLS_ADVT_FIELD = "Supported Controls Advertisement"
FLAGS_ADVT_FIELD = "Supported Flags Advertisement"
PAGE_SUPPORT_ADVT_FIELD = "Supported Pages Advertisement"
Expand Down
2 changes: 1 addition & 1 deletion sonic_platform_base/sonic_xcvr/fields/xcvr_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def __init__(self, name, offset, *fields, **kwargs):
self.format = kwargs.get("format", ">%ds" % self.size)

def decode(self, raw_data, **decoded_deps):
return struct.unpack(self.format, raw_data)[0].decode(self.encoding)
return struct.unpack(self.format, raw_data)[0].decode(self.encoding, 'ignore')

class CodeRegField(RegField):
"""
Expand Down
Loading

0 comments on commit ee12215

Please sign in to comment.