CheckRequest: send the real board's test-mode handshake

The host waits up to 5s after CheckRequest for TestModeChange ENTER
(8C 01 0D) before anything else, and sends no requests until the
matching EXIT (8C 00 0C) arrives; vRIO jumped straight to the
CheckReply dump, so hosts logged "RIO never came back from check
request" and skipped the version exchange. Bracket the per-board
BoardOk replies with enter/exit, byte-for-byte what the real v4.2
board sends on the wire tap.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-06 13:13:06 -05:00
co-authored by Claude Fable 5
parent 44dc8e48e7
commit 1eded793af
3 changed files with 33 additions and 11 deletions
+9 -2
View File
@@ -13,7 +13,9 @@ namespace VRio.Core.Device;
/// <para>Wire behavior (mirroring what RIOJoy expects from the real board):</para>
/// <list type="bullet">
/// <item>ACKs every well-formed inbound packet, NAKs one with a bad checksum.</item>
/// <item>CheckRequest → a BoardOk CheckReply per known board.</item>
/// <item>CheckRequest → TestModeChange ENTER, a BoardOk CheckReply per known
/// board (the self-test stream), then TestModeChange EXIT — the init
/// handshake the real board performs and the game waits (≤5s per step) on.</item>
/// <item>VersionRequest → VersionReply with the configured firmware version
/// (default 4.2, matching the real board's dumped EPROM).</item>
/// <item>AnalogRequest → AnalogReply with the current five axis values.</item>
@@ -239,9 +241,14 @@ public sealed class VRioDevice
switch (packet.Command)
{
case RioCommand.CheckRequest:
Logged?.Invoke("RX CheckRequest → all boards OK");
// Init handshake (verified against a real v4.2 board tap): the
// host waits ≤5s for TestModeChange ENTER before anything else,
// and sends no requests at all until the matching EXIT arrives.
Logged?.Invoke("RX CheckRequest → test mode enter, all boards OK, exit");
Send(PacketBuilder.TestModeChange(1));
foreach ((byte number, string _) in RioAddressSpace.Boards)
Send(PacketBuilder.CheckReply(RioStatusType.BoardOk, number));
Send(PacketBuilder.TestModeChange(0));
break;
case RioCommand.VersionRequest: