Skip to content

RB23xx: firmware upload over Wi-Fi Soft-AP - #7

Merged
keskad merged 3 commits into
mainfrom
feat/rb23xx-firmware
Sep 12, 2026
Merged

keskad merged 3 commits into
mainfrom
feat/rb23xx-firmware

Conversation

@keskad

@keskad keskad commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

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 .bin file the same way the existing rb CLI 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_supplicant and 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 --all
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo test --workspace --locked
  • Manual: F28 on decoder, scan, update-firmware --driver rb23xx --file firmware.bin on a real RB23xx

keskad and others added 2 commits September 11, 2026 21:45
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>
@keskad keskad self-assigned this Sep 12, 2026
…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>
@keskad keskad changed the title Add RB23xx Soft-AP firmware upload RB23xx: wgrywanie firmware przez Wi-Fi Soft-AP Sep 12, 2026
@keskad
keskad merged commit f43c812 into main Sep 12, 2026
4 checks passed
@keskad
keskad deleted the feat/rb23xx-firmware branch September 12, 2026 11:40
@keskad keskad changed the title RB23xx: wgrywanie firmware przez Wi-Fi Soft-AP RB23xx: firmware upload over Wi-Fi Soft-AP Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant