install: fix two CV6xx bugs blocking OpenIPC flash on hi3516cv608#112
Merged
Conversation
…i3516cv608
Both fixes were needed to get ``defib install -c hi3516cv608 -p
rfc2217://… --power-cycle`` to complete end-to-end via Vectis + lab
TFTP. Verified live by flashing OpenIPC's ``openipc.hi3516cv6xx-nor-lite.tgz``
onto a real hi3516cv608 — install reached ``Welcome to OpenIPC``
login prompt.
## firmware.py — register hi3516cv608 / hi3516cv610 as available
``has_firmware(chip)`` was returning False for the CV6xx family because
neither chip was in ``AVAILABLE_FIRMWARE``. The pre-install gate at
``_install_async`` (``cli/app.py:2297``) then bails out with "No
OpenIPC U-Boot for 'hi3516cv608'" before even opening the transport.
Add ``hi3516cv608`` and ``hi3516cv610`` to the set. OpenIPC's main
firmware repo doesn't ship ``u-boot-hi3516cv608-universal.bin`` yet —
the U-Boot blob lives in the ``OpenIPC/u-boot-hi3516cv6xx`` /
``dimerr/u-boot-hi3516cv6xx`` fork as ``boot-hi3516cv608-nor.bin``.
Until that gets published to the main releases manifest, users supply
the U-Boot blob via the cache (``~/.cache/defib/firmware/u-boot-{chip}-universal.bin``).
With this entry, ``get_cached_path`` finds it and the install
proceeds. If the cache is missing the URL-based ``download_firmware``
will 404 — that's the user's signal to seed the cache.
## cli/app.py — attach Rfc2217Transport to VectisController on install
The install path's Vectis transport-attach check only matched
``SocketTransport``:
if isinstance(power_controller, VectisController) and isinstance(
transport, SocketTransport
):
power_controller.attach_transport(transport)
But Vectis exposes itself as ``rfc2217://…`` (the binary-safe path that
``defib burn`` already uses), so on install the controller never
received the live transport. It fell back to the standalone path which
opens a SECOND TCP connection — and Vectis only allows one client at
a time, so the new connection evicted the recovery session's, killing
its reader thread mid-flow with ``SerialException: connection failed
(reader thread died)``.
Burn already does the right thing (``cli/app.py:196``: matches
``(Rfc2217Transport, SocketTransport)``). Install now mirrors that —
plus a comment explaining the one-client constraint so the next
person who looks here understands why both transports must be
recognised.
Verified end-to-end: full install on live hi3516cv608 with U-Boot,
kernel, and rootfs all flash-CRC verified, camera booted to OpenIPC
login prompt. 60/60 ``test_recovery_session`` + ``test_handshake_resilience``
+ ``test_agent_protocol`` tests still pass. Ruff and mypy clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two bugs that together stopped
defib install -c hi3516cv608 -p rfc2217://… --power-cyclefrom running on a Vectis-bridged CV6xx camera. Both were verified end-to-end by flashing OpenIPC'sopenipc.hi3516cv6xx-nor-lite.tgzonto a live hi3516cv608 — install now reachesWelcome to OpenIPC/openipc-hi3516cv6xx login:.1.
firmware.py: registerhi3516cv608/hi3516cv610as availablehas_firmware(chip)returnedFalsebecause neither chip was inAVAILABLE_FIRMWARE. The pre-install gate atcli/app.py:2297then bails withNo OpenIPC U-Boot for 'hi3516cv608'before opening the transport. Add both chips to the set; users seed the U-Boot blob in~/.cache/defib/firmware/u-boot-{chip}-universal.bin(the dimerr /OpenIPC/u-boot-hi3516cv6xxfork ships it asboot-hi3516cv608-nor.bin; the mainOpenIPC/firmwarereleases manifest doesn't carry it yet).2.
cli/app.py: attachRfc2217TransporttoVectisControlleron installThe install path's Vectis attach check only matched
SocketTransport:But Vectis exposes itself as
rfc2217://…(binary-safe path thatdefib burnalready uses), so on install the controller never received the live transport — it fell back to the standalone path which opens a second TCP connection. Vectis only allows one client at a time, so the new connection evicted the recovery session's, killing its reader thread mid-flow with:Burn already does the right thing (
cli/app.py:196: matches(Rfc2217Transport, SocketTransport)). Install now mirrors that, with a comment explaining the one-client constraint.Test plan
uv run pytest tests/test_recovery_session.py tests/test_handshake_resilience.py tests/test_agent_protocol.py -x -v— 60/60 passuv run ruff check src/defib/cli/app.py src/defib/firmware.pycleanuv run mypy src/defib/cli/app.py src/defib/firmware.py --ignore-missing-importscleanrfc2217://127.0.0.1:35240):sf writefor U-Boot @ 0x000000, kernel @ 0x050000, rootfs @ 0x350000 — all flash-CRC verifiedLinux 5.10.221 … #1 SMP Thu Jun 4 00:17:45 UTC 2026/Welcome to OpenIPC/openipc-hi3516cv6xx login:Out of scope (filed upstream)
defib install'ssetenv bootcmd ${bootcmdnor}works for cv500/ev-class but on dimerr's CV6xx U-Bootbootcmdnoris undefined, leavingbootcmdempty. Also the defaultosmem=32Mis too tight for OpenIPC's CV6xx kernel (silent hang). Both are U-Boot-side env defaults — filed against the upstream U-Boot port at OpenIPC/u-boot-hi3516cv6xx#1. Doesn't block this PR; users currently need to setbootcmd/bootargsby hand after install on CV6xx.