[DellEMC] s5232f console and sfputil fix (#4424)

Remove hardcoding 115K baudrate for console
Enhance sfputil api as per spec
This commit is contained in:
Srideep 2020-04-16 04:07:51 -06:00 committed by GitHub
parent df7acdb664
commit 2ed716478b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -1,3 +1,2 @@
CONSOLE_PORT=0x3f8
CONSOLE_DEV=0
CONSOLE_SPEED=115200

View File

@ -244,6 +244,9 @@ class SfpUtil(SfpUtilBase):
def get_transceiver_change_event(self, timeout=0):
port_dict = {}
sleep_time_ms = 500 # Poll interval, in milliseconds
sleep_time = sleep_time_ms / 1000.0
elapsed_time_ms = 0
while True:
for port_num in range(self.port_start, (self.port_end + 1)):
presence = self.get_presence(port_num)
@ -256,9 +259,18 @@ class SfpUtil(SfpUtilBase):
port_dict[port_num] = '0'
if(len(port_dict) > 0):
return True, port_dict
break
if len(port_dict) > 0:
break
if timeout != 0:
elapsed_time_ms += sleep_time_ms
if elapsed_time_ms > timeout:
break
time.sleep(sleep_time)
return True, port_dict
time.sleep(0.5)
def get_transceiver_dom_info_dict(self, port_num):
transceiver_dom_info_dict = {}