Skip to content

Extra delay between running firmware and checking firmware switch done #3842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion sfputil/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,9 @@ def commit(port_name):
@firmware.command()
@click.argument('port_name', required=True, default=None)
@click.argument('filepath', required=True, default=None)
def upgrade(port_name, filepath):
@click.option('--delay', metavar='<delay>', type=click.IntRange(0, 10), default=5,
help="Delay time before checking firmware switch done")
def upgrade(port_name, filepath, delay):
"""Upgrade firmware on the transceiver"""

physical_port = logical_port_to_physical_port_index(port_name)
Expand Down Expand Up @@ -1676,6 +1678,11 @@ def upgrade(port_name, filepath):

click.echo("Firmware run in mode {} successful".format(default_mode))

# 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)

if is_fw_switch_done(port_name) != 1:
click.echo('Failed to switch firmware images!')
sys.exit(EXIT_FAIL)
Expand Down
Loading