RB23xx: firmware upload over Wi-Fi Soft-AP - #7
Merged
Merged
Conversation
RailBOX reboots after POST /upload, so treat RST-after-write as success and join the decoder AP with WPA2-PSK instead of open association. Co-authored-by: Cursor <cursoragent@cursor.com>
Shared job code no longer matches on driver id; each driver advertises max bytes, allowed reach modes, ESP image policy, and RST-after-write via capabilities.firmware and hello exposes the same fields. Co-authored-by: Cursor <cursoragent@cursor.com>
…lback Move softap_psk into DriverCapabilities (public factory default, not a secret) and remove the per-driver softap_psk() method. Add update_firmware(transport, image, filename, progress) to the DeviceDriver trait so the registry dispatches uniformly instead of matching per-driver signatures; WiFred/Fred return a not-supported error from their trait impls, removing the unreachable registry arms. Replace FirmwareReach with ReachMode directly in FirmwareModes::allows (Z21 -> false). Implement wpa_supplicant fallback in Nl80211Radio::associate: when nl80211 CONNECT with a PMK does not produce carrier (brcmfmac on Pi 5 does not offload the 4-way handshake), spawn wpa_supplicant on the programming interface with a minimal config for the duration of the job and kill it on release. The supplicant runs in the foreground so its lifetime is tied to the radio handle. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
RB23xx is a family of RailBOX sound decoders (RB2300 / RB2310 / RB2302) used in model railroading. To upload firmware, you enable function F28 on the decoder — it then brings up its own Wi-Fi hotspot (Soft-AP) with a factory password and a simple file server. This PR teaches wireless-programmer how to find that hotspot, connect to it, and upload a
.binfile the same way the existingrbCLI does.After a scan, the daemon joins the decoder's AP (WPA2-PSK; on Pi 5 with brcmfmac, if nl80211 alone cannot complete the handshake, it temporarily starts
wpa_supplicantand kills it when the job finishes). It then POSTs the firmware image to the decoder. A dropped connection after the full write counts as success — the decoder reboots. Limit 5 MiB, 2-minute timeout, Soft-AP mode only.Test plan
cargo fmt --allcargo clippy --workspace --all-targets --locked -- -D warningscargo test --workspace --lockedupdate-firmware --driver rb23xx --file firmware.binon a real RB23xx