[openthread_border_router] Match OTBR flow control and startup RTS/DTR state in settings migration script
This PR switches our migration script from pyserial to serialx, allowing for the startup pin state to be configured to match OTBR. This ensures the migration script uses the same startup and reset sequence as OTBR.
Fixes #4261 Fixes #4222 Fixes #4210
Summary by CodeRabbit
Release Notes v2.15.3
-
Bug Fixes
- Fixed inconsistent startup on adapters with remapped hardware flow control pins during firmware flashing.
-
Chores
- Updated dependencies to improve adapter compatibility and stability.
- Version bump to 2.15.3.
βοΈ Tip: You can customize this high-level summary in your review settings.
π Walkthrough
Walkthrough
Propagates UART flow-control from the s6 startup script into the OTBR settings migration utility, adds flow-control-aware serial open and a protocol reset in the migration script, and updates build args and dependencies plus the addon version/changelog.
Changes
| Cohort / File(s) | Change Summary |
|---|---|
Version & changelog openthread_border_router/config.yaml, openthread_border_router/CHANGELOG.md |
Bumped version to 2.15.3 and added changelog entry describing a startup inconsistency fix for adapters that remap hardware flow-control pins during flashing. |
Container build args & deps openthread_border_router/Dockerfile, openthread_border_router/build.yaml |
Replaced UNIVERSAL_SILABS_FLASHER with UNIVERSAL_SILABS_FLASHER_VERSION (0.1.2) and added SERIALX_VERSION (0.5.0); Dockerfile now installs universal-silabs-flasher by version and installs serialx. |
Startup script: propagate flow-control openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run |
Added migrate_flow_control variable derived from flow_control and passed --flow-control "${migrate_flow_control}" to migrate_otbr_settings.py in both pre-start migration and startup command lines. |
Migration utility: flow-control + reset openthread_border_router/rootfs/usr/local/bin/migrate_otbr_settings.py |
Added --flow-control CLI option (default "none"); extended get_adapter_hardware_addr signature to accept flow_control; set rtsdtr_on_open based on flow-control (hardware => HIGH); added PinState and ResetReason imports, call protocol.reset(ResetReason.STACK) after connection, and added AFTER_DISCONNECT_DELAY = 1 delay after writing settings. |
Sequence Diagram(s)
mermaid sequenceDiagram autonumber actor s6 as s6-run (container init) participant Migrate as migrate_otbr_settings.py participant Serial as serialx (serial driver) participant Flasher as universal_silabs_flasher (Spinel protocol) participant OTBR as otbr-agent
s6->>Migrate: invoke migrate with --flow-control (hardware|none)
Migrate->>Serial: open port (rtsdtr_on_open set per flow-control)
Serial-->>Migrate: serial port established
Migrate->>Flasher: send Spinel PROP_VALUE_GET / setup
Flasher-->>Migrate: adapter response (or timeout)
alt success
Migrate->>Flasher: reset protocol (ResetReason.STACK)
Migrate->>Serial: close (await AFTER_DISCONNECT_DELAY)
Migrate-->>s6: migration complete
s6->>OTBR: start otbr-agent (passes same flow-control)
else timeout / no response
Migrate-->>s6: skip migration (non-fatal)
s6->>OTBR: start otbr-agent (passes same flow-control)
end
Estimated code review effort
π― 3 (Moderate) | β±οΈ ~25 minutes
- Inspect migrate_otbr_settings.py for correct propagation of
flow_controlthrough the new CLI arg and function signature, correct use ofPinStatevalues, and proper async handling around protocol.reset and AFTER_DISCONNECT_DELAY. - Verify s6 startup script correctly derives
migrate_flow_controland passes it in both invocation points. - Confirm Dockerfile/build.yaml changes install the intended package versions and that imports (serialx, ResetReason) match those versions' APIs.
Pre-merge checks and finishing touches
β Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | β οΈ Warning | Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
β Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The title accurately summarizes the main change: updating the migration script to match OTBR's RTS/DTR state and flow control behavior during settings migration. |
| Linked Issues check | β Passed | Changes address all three linked issues: flow control settings support [#4261], graceful timeout handling [#4222, #4210], and RTS/DTR pin state alignment during startup with serialx usage. |
| Out of Scope Changes check | β Passed | All changes are directly aligned with the linked issues: Dockerfile/build.yaml updates install serialx/universal-silabs-flasher versions, config.yaml updates version number, and migration script implements flow control and graceful error handling. |
β¨ Finishing touches
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
π Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
π₯ Commits
Reviewing files that changed from the base of the PR and between 15d25f518fa6ea424524cde3b48390fe9b6b181a and 1ab8c6aadec474028209ef480c55064b85f828ea.
π Files selected for processing (2)
openthread_border_router/Dockerfile(2 hunks)openthread_border_router/build.yaml(1 hunks)
π§ Files skipped from review as they are similar to previous changes (1)
- openthread_border_router/Dockerfile
π§° Additional context used
π Path-based instructions (1)
*/**(html|markdown|md)
βοΈ CodeRabbit configuration file
*/**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.
- Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
- In step-by-step instructions, front the location phrase in the instructional sentence.
- In step-by-step instructions, front the 'goal' in the instructional sentence.
- In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
- do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'
*/**(html|markdown|md): - Use bold to mark UI strings.
If "" are used to mark UI strings, replace them by bold.
Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"
Use sentence-style capitalization also in headings.
do not comment on HTML used for icons
Avoid flagging inline HTML for embedding videos in future reviews for this repository.
Files:
openthread_border_router/build.yaml
β° Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build aarch64 openthread_border_router add-on
- GitHub Check: Build amd64 openthread_border_router add-on
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.