@@ -781,7 +781,25 @@ def get_transceiver_info_dict(self, port_num):
781781 transceiver_info_dict ['nominal_bit_rate' ] = 'N/A'
782782
783783 else :
784+ file_path = self ._get_port_eeprom_path (port_num , self .IDENTITY_EEPROM_ADDR )
785+ if not self ._sfp_eeprom_present (file_path , 0 ):
786+ print ("Error, file not exist %s" % file_path )
787+ return None
788+
789+ try :
790+ sysfsfile_eeprom = open (file_path , mode = "rb" , buffering = 0 )
791+ except IOError :
792+ print ("Error: reading sysfs file %s" % file_path )
793+ return None
794+
784795 if port_num in self .qsfp_ports :
796+ # Check for QSA adapter
797+ byte0 = self ._read_eeprom_specific_bytes (sysfsfile_eeprom , 0 , 1 )[0 ]
798+ is_qsfp = (byte0 != '03' and byte0 != '0b' )
799+ else :
800+ is_qsfp = False
801+
802+ if is_qsfp :
785803 offset = 128
786804 vendor_rev_width = XCVR_HW_REV_WIDTH_QSFP
787805 cable_length_width = XCVR_CABLE_LENGTH_WIDTH_QSFP
@@ -805,17 +823,6 @@ def get_transceiver_info_dict(self, port_num):
805823 print ("Error: sfp_object open failed" )
806824 return None
807825
808- file_path = self ._get_port_eeprom_path (port_num , self .IDENTITY_EEPROM_ADDR )
809- if not self ._sfp_eeprom_present (file_path , 0 ):
810- print ("Error, file not exist %s" % file_path )
811- return None
812-
813- try :
814- sysfsfile_eeprom = open (file_path , mode = "rb" , buffering = 0 )
815- except IOError :
816- print ("Error: reading sysfs file %s" % file_path )
817- return None
818-
819826 sfp_interface_bulk_raw = self ._read_eeprom_specific_bytes (sysfsfile_eeprom , (offset + XCVR_INTFACE_BULK_OFFSET ), interface_info_bulk_width )
820827 if sfp_interface_bulk_raw is not None :
821828 sfp_interface_bulk_data = sfpi_obj .parse_sfp_info_bulk (sfp_interface_bulk_raw , 0 )
0 commit comments