Skip to content

feat(adr-018): source MAC in CSI frame V2 (magic 0xC5110006)#379

Open
taylorjdawson wants to merge 2 commits intoruvnet:mainfrom
taylorjdawson:feat/adr-018-source-mac
Open

feat(adr-018): source MAC in CSI frame V2 (magic 0xC5110006)#379
taylorjdawson wants to merge 2 commits intoruvnet:mainfrom
taylorjdawson:feat/adr-018-source-mac

Conversation

@taylorjdawson
Copy link
Copy Markdown
Contributor

Summary

  • extend ADR-018 binary frame format with a 6-byte source MAC at offset 20 using V2 magic 0xC5110006 and a 26-byte header
  • preserve backward compatibility by teaching the raw CSI JS and Python tooling to accept both V1 and V2 frames through a shared decoder in scripts/lib/raw-csi.js
  • resolve the protocol collision with ADR-069 feature packets, which keep magic 0xC5110003
  • harden the sensing server parser so malformed packets with zero antennas or zero subcarriers are rejected instead of being treated as empty CSI

Validation

  • node --check on the touched JS scripts
  • python3 -m py_compile on the touched Python scripts
  • synthetic V1 and V2 sanity check for scripts/lib/raw-csi.js
  • cargo test -p wifi-densepose-hardware esp32_parser --no-default-features
  • wifi-densepose-sensing-server still has pre-existing unrelated build failures (ruvector_mincut imports, missing adaptive_classifier::CLASSES, and borrow checker errors in main.rs), so it could not be used as the final backstop

ruvnet added 2 commits April 8, 2026 19:15
Extend the ADR-018 binary frame format with a 6-byte source MAC address,
enabling per-device CSI tracking. Every WiFi client becomes a trackable
signal source (4 nodes x N devices = 4N sensing links).

V2 header (26 bytes): existing 20-byte V1 header + 6-byte source MAC at
offset 20. I/Q data moves to offset 26. All parsers accept both V1 and V2
frames for backward compatibility during mixed-firmware rollout.

Firmware:
- New magic 0xC5110003, CSI_HEADER_SIZE_V2 = 26
- Serialize info->mac (already available from ESP-IDF) into frame buffer
- Debug-level logging for source MAC

Hardware crate (Rust):
- CsiMetadata.source_mac: Option<[u8; 6]> (None for V1, Some for V2)
- parse_frame() branches on magic for V1/V2 header sizes
- parse_stream() resyncs on both magic values
- New UnknownMagic error variant for unrecognized magic numbers
- 4 new tests: V2 parse, V1 backward compat, mixed stream, short buffer

Sensing server (Rust):
- Fix ADR-018 offset bugs: n_subcarriers was u8 (should be u16),
  freq_mhz was u16 (should be u32), sequence/rssi/noise_floor read
  from wrong byte offsets
- Consolidate duplicate Esp32Frame struct and parse_esp32_frame from
  main.rs into types.rs/csi.rs
- Esp32Frame.source_mac: Option<[u8; 6]>
- 4 new parser tests with correct offsets

Recording:
- RecordedFrame gains node_id and source_mac fields
- serde backward compat: #[serde(default)] + skip_serializing_if

Python recorder:
- Complete rewrite of parse_csi_packet() with correct ADR-018 offsets
- V1 and V2 support, source_mac extraction

Integration tests:
- Fix multi_node_test.rs frame builder to use correct byte offsets

Co-Authored-By: claude-flow <ruv@ruv.net>
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.

2 participants