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:
@@ -79,22 +79,35 @@ public class VRioDeviceTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CheckRequest_reports_every_board_ok()
|
||||
public void CheckRequest_enters_test_mode_reports_boards_then_exits()
|
||||
{
|
||||
var device = new VRioDevice();
|
||||
var wire = new Wire(device);
|
||||
|
||||
Send(device, PacketBuilder.Build(RioCommand.CheckRequest));
|
||||
|
||||
Assert.Equal(RioAddressSpace.Boards.Count, wire.Packets.Count);
|
||||
Assert.All(wire.Packets, p =>
|
||||
// The init handshake: TestModeChange ENTER, one CheckReply per board,
|
||||
// TestModeChange EXIT. The game waits on both test-mode packets and
|
||||
// stays mute forever if the EXIT never arrives.
|
||||
Assert.Equal(RioAddressSpace.Boards.Count + 2, wire.Packets.Count);
|
||||
|
||||
RioPacket enter = wire.Packets[0];
|
||||
Assert.Equal(RioCommand.TestModeChange, enter.Command);
|
||||
Assert.Equal(new byte[] { 1 }, enter.Payload);
|
||||
|
||||
RioPacket exit = wire.Packets[wire.Packets.Count - 1];
|
||||
Assert.Equal(RioCommand.TestModeChange, exit.Command);
|
||||
Assert.Equal(new byte[] { 0 }, exit.Payload);
|
||||
|
||||
var checks = wire.Packets.GetRange(1, RioAddressSpace.Boards.Count);
|
||||
Assert.All(checks, p =>
|
||||
{
|
||||
Assert.Equal(RioCommand.CheckReply, p.Command);
|
||||
Assert.Equal((byte)RioStatusType.BoardOk, p.Payload[0]);
|
||||
});
|
||||
Assert.Equal(
|
||||
RioAddressSpace.Boards.Select(b => b.Number),
|
||||
wire.Packets.Select(p => p.Payload[1]));
|
||||
checks.Select(p => p.Payload[1]));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user