Skip to content

radio sniff --check, analyze --against, session verdict - #9

Merged
TheAbider merged 2 commits into
masterfrom
sniff-check
Nov 2, 2026
Merged

TheAbider merged 2 commits into
masterfrom
sniff-check

Conversation

@TheAbider

Copy link
Copy Markdown
Owner

Groundwork for reading the XG-100P without RPM: a capture that is right the first time, and a way to see the protocol's framing as soon as one exists.

radio sniff --check [COMPORT]

Once the Bluetooth trace is running, sniff opens the radio's port for a moment and sends nothing. Opening the port makes Windows open an RFCOMM channel to the radio, so the trace should show the channel opening. When it doesn't, sniff says why:

  • the sniffer passed on nothing
  • the trace has data packets but no channel opening (Full Packet Logging is off)
  • the data went to another device's link (a wrong radio address)

It cannot tell whether Full Packet Logging is on, because only large packets need it, and it says so.

Session verdict

sniff, relay and analyze say what a session looks like:

  • a read: the radio sent a personality
  • a write: RPM sent one
  • neither: this also mentions large packets that may have been left out of the trace

The trace report also names links to other devices that it left out.

radio analyze --against FILE

Lines up a .PRS that RPM saved from the same radio with the capture: the radio's answers, plus RPM's requests when a write carries the personality. It shows:

  • how much of the file is there, in order, and in how many pieces
  • the piece sizes
  • the bytes before, between and after the pieces

When the radio sends the personality in packets, each piece is one packet's data and the bytes between two pieces are the framing.

How it lines up:

  • it continues nearby where it can
  • after a missing packet, a byte RPM's copy has differently, or a long stretch of other traffic, it resyncs on a varied run
  • runs of zeros never place anything on their own
  • parts of the file it can't find are listed

On a real 46 KB personality, in packets of 128 to 1000 bytes with zero-heavy headers and random traffic between packets, it finds every byte and every 6-byte gap, in under 20 ms. With two packets dropped it reports exactly what is missing, except with 128-byte packets, where packets of zeros alone cannot be placed.

Fixes

  • analyze --extract FILE wrote over FILE when it existed, and that could be the .PRS RPM saved for the same session. It now takes the next free name, as captures do.
  • replay takes DTR/RTS from the last line event before RPM's first request, not from the first event in the capture. The ports opened by --check, and RPM setting its lines after opening its port, both come before that request.

Tests

  • 5,732 passed, 5 skipped.
  • New tests were checked against 56 deliberately broken versions of the code, and every one is caught. The alignment has a scenario test for each choice it makes:
    • a short run of zeros further on
    • a short repeat further on
    • the longest candidate wins
    • a short run inside other traffic
    • a resync taken back over zeros
    • zeros inside other traffic
    • a second copy of the file
    • never going back in the file

- sniff --check [COMPORT]: once the trace is running, open the radio's
  port for a moment (nothing is sent) and look for its serial channel
  opening in the trace. When it is not there, say why: the sniffer passed
  on nothing, data packets but no channel (Full Packet Logging), or the
  data went to another device. It cannot see Full Packet Logging itself,
  and says so.
- sniff, relay and analyze say whether a session looks like a read (the
  radio sent a personality), a write (RPM sent one) or neither, with the
  Full Packet Logging hint for neither.
- The trace report names links to other devices it left out.
- replay sets DTR/RTS as RPM had them at its first request (the last line
  event before it), not from the first event: a check's port, or RPM
  setting its lines after opening the port, came first.
- analyze --against FILE lines a .PRS that RPM saved up with a capture:
  how much of it is in the radio's answers (and in RPM's requests, where
  a write carries it), in order and in how many pieces, the piece sizes,
  and the bytes between the pieces - the framing, when the radio sends the
  personality in packets. It goes on nearby where it can and resyncs on a
  varied run after a missing packet, a byte RPM's copy has differently or
  a long stretch of other traffic; parts of the file not found are listed.
- analyze --extract wrote over an existing file, which could be the .PRS
  RPM saved; it now takes the next free name, as captures do.
@TheAbider
TheAbider merged commit 45d1c28 into master Nov 2, 2026
4 checks passed
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