diff --git a/CLAUDE.md b/CLAUDE.md index 9a041bc..6942532 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -23,6 +23,7 @@ No external dependencies — Python 3 standard library only. Compatible with Tru ``` es24n_conf.py ← Entry point and main menu (run this) +firmware/ ← Firmware files (.bin, .img, .fw, etc.) — scanned at update time modules/ ui.py ← ANSI colours, display helpers, input prompts serial_port.py ← SerialPort class (termios/fcntl/select, no pyserial) @@ -53,7 +54,7 @@ Updates IOM firmware and/or Fabric Card firmware over the network: - Polls `/redfish/v1/TaskService/Tasks/` until completion - Restarts the IOM (and fabric card if applicable) after each update - The firmware file must be re-uploaded between the IOM and Fabric Card steps — it does not persist after the first update (firmware quirk, documented in `_update_fabric_fw()`) -- Scans the current working directory for firmware files (`.bin`, `.img`, `.fw`, `.hex`, `.zip`, `.tar`, `.tgz`, `.gz`) and presents them as a numbered list before falling back to manual path entry +- Scans the `firmware/` directory (next to `es24n_conf.py`) for firmware files (`.bin`, `.img`, `.fw`, `.fwc`, `.hex`, `.zip`, `.tar`, `.tgz`, `.gz`) and presents them as a numbered list before falling back to manual path entry ### 3 — System Check (`workflow_check.py`) Read-only diagnostic workflow — queries current network settings and firmware versions, makes no changes: diff --git a/firmware/ves-vds2249r-rflex-MGR-04.12.33-A2000Tfw_2.4.1.fwc b/firmware/ves-vds2249r-rflex-MGR-04.12.33-A2000Tfw_2.4.1.fwc new file mode 100644 index 0000000..abbeb5a Binary files /dev/null and b/firmware/ves-vds2249r-rflex-MGR-04.12.33-A2000Tfw_2.4.1.fwc differ diff --git a/modules/workflow_firmware.py b/modules/workflow_firmware.py index 0f23b25..3c6bc8c 100644 --- a/modules/workflow_firmware.py +++ b/modules/workflow_firmware.py @@ -25,20 +25,22 @@ from ui import ( # ── Firmware file selection helper ──────────────────────────────────────────── def _prompt_fw_file(label: str) -> str: """ - Scan the current working directory for firmware files and let the user - pick one by number, or enter a custom path as the last option. - Files are sorted most-recently-modified first. + Scan the firmware/ directory (next to es24n_conf.py) for firmware files + and let the user pick one by number, or enter a custom path as the last + option. Files are sorted most-recently-modified first. """ - cwd = os.getcwd() - FW_EXTS = {".bin", ".img", ".fw", ".hex", ".zip", ".tar", ".tgz", ".gz"} + fw_dir = os.path.normpath( + os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "firmware") + ) + FW_EXTS = {".bin", ".img", ".fw", ".fwc", ".hex", ".zip", ".tar", ".tgz", ".gz"} try: candidates = sorted( - [f for f in os.listdir(cwd) + [f for f in os.listdir(fw_dir) if not f.startswith(".") - and os.path.isfile(os.path.join(cwd, f)) + and os.path.isfile(os.path.join(fw_dir, f)) and os.path.splitext(f)[1].lower() in FW_EXTS], - key=lambda f: os.path.getmtime(os.path.join(cwd, f)), + key=lambda f: os.path.getmtime(os.path.join(fw_dir, f)), reverse=True, ) except OSError: @@ -46,9 +48,9 @@ def _prompt_fw_file(label: str) -> str: print() if candidates: - info(f"Firmware files found in {cwd}:") + info(f"Firmware files found in {fw_dir}:") for i, fname in enumerate(candidates, 1): - sz = os.path.getsize(os.path.join(cwd, fname)) + sz = os.path.getsize(os.path.join(fw_dir, fname)) print(f" {_c(C.BOLD, str(i))} {fname} {_c(C.DIM, f'({sz // 1024} KB)')}") custom_idx = len(candidates) + 1 print(f" {_c(C.BOLD, str(custom_idx))} Enter a custom file path") @@ -59,7 +61,7 @@ def _prompt_fw_file(label: str) -> str: if choice.isdigit(): idx = int(choice) if 1 <= idx <= len(candidates): - path = os.path.join(cwd, candidates[idx - 1]) + path = os.path.join(fw_dir, candidates[idx - 1]) sz = os.path.getsize(path) ok(f"Selected: {candidates[idx - 1]} ({sz // 1024} KB)") return path @@ -67,7 +69,7 @@ def _prompt_fw_file(label: str) -> str: break warn(f"Please enter a number between 1 and {custom_idx}.") else: - info(f"No firmware files found in {cwd}.") + info(f"No firmware files found in {fw_dir}.") # Manual path entry while True: