Skip to content

Commit

Permalink
Extra delay between running firmware and updating firmware version (#…
Browse files Browse the repository at this point in the history
…3610)

* Extra delay between running firmware and updating firmware version

Signed-off-by: Stephen Sun <[email protected]>

* Fix review comments

Signed-off-by: Stephen Sun <[email protected]>

---------

Signed-off-by: Stephen Sun <[email protected]>
  • Loading branch information
stephenxs authored and mssonicbld committed Nov 30, 2024
1 parent 24481f0 commit 3cc74d3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sfputil/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,9 @@ def download_firmware(port_name, filepath):
1 = Hitless Reset to Inactive Image (Default)\n \
2 = Attempt non-hitless Reset to Running Image\n \
3 = Attempt Hitless Reset to Running Image\n")
def run(port_name, mode):
@click.option('--delay', metavar='<delay>', type=click.IntRange(0, 10), default=5,
help="Delay time before updating firmware information to STATE_DB")
def run(port_name, mode, delay):
"""Run the firmware with default mode=0"""

if is_port_type_rj45(port_name):
Expand All @@ -1607,6 +1609,11 @@ def run(port_name, mode):
click.echo('Failed to run firmware in mode={}! CDB status: {}'.format(mode, status))
sys.exit(EXIT_FAIL)

# The cable firmware can be still under initialization immediately after run_firmware
# We put a delay here to avoid potential error message in accessing the cable EEPROM
if delay:
time.sleep(delay)

update_firmware_info_to_state_db(port_name)
click.echo("Firmware run in mode={} success".format(mode))

Expand Down

0 comments on commit 3cc74d3

Please sign in to comment.