|
11 | 11 |
|
12 | 12 | import logging |
13 | 13 | from ...codes.public.cmis import CmisCodes |
| 14 | +from ...codes.public.cdb import CdbCodes |
14 | 15 | from ...codes.public.sff8024 import Sff8024 |
15 | 16 | from ...fields import consts |
| 17 | +from ...mem_maps.public.cdb import CdbMemMap |
| 18 | +from ...cdb.cdb_fw import CdbFwHandler as CdbFw |
16 | 19 | from ..xcvr_api import XcvrApi |
17 | 20 | from .cmisCDB import CmisCdbApi |
18 | 21 | from .cmisVDM import CmisVdmApi |
@@ -135,11 +138,17 @@ def set_cache_enabled(cls, enabled: bool): |
135 | 138 | """ |
136 | 139 | cls.cache_enabled = bool(enabled) |
137 | 140 |
|
138 | | - def __init__(self, xcvr_eeprom, cdb_fw_hdlr=None): |
| 141 | + def __init__(self, xcvr_eeprom, init_cdb=False): |
139 | 142 | super(CmisApi, self).__init__(xcvr_eeprom) |
140 | 143 | self.vdm = CmisVdmApi(xcvr_eeprom) if not self.is_flat_memory() else None |
141 | 144 | self.cdb = CmisCdbApi(xcvr_eeprom) if self.is_cdb_supported() else None |
142 | | - self.cdb_fw_hdlr = cdb_fw_hdlr if self.is_cdb_supported() else None |
| 145 | + self.cdb_fw_hdlr = self._create_cdb_fw_handler() if init_cdb else None |
| 146 | + |
| 147 | + def _create_cdb_fw_handler(self): |
| 148 | + if not self.is_cdb_supported(): |
| 149 | + return None |
| 150 | + cdb_mem_map = CdbMemMap(CdbCodes) |
| 151 | + return CdbFw(self.xcvr_eeprom.reader, self.xcvr_eeprom.writer, cdb_mem_map) |
143 | 152 |
|
144 | 153 | def get_cdb_fw_handler(self): |
145 | 154 | return self.cdb_fw_hdlr |
|
0 commit comments