diff --git a/internal/cat/icomnet.go b/internal/cat/icomnet.go index ed7d368..48901eb 100644 --- a/internal/cat/icomnet.go +++ b/internal/cat/icomnet.go @@ -712,6 +712,11 @@ func icnHandshake(c *net.UDPConn, myID uint32, cancel <-chan struct{}) (uint32, } typ := icnLE.Uint16(p[4:]) sentid := icnLE.Uint32(p[8:]) + // Every packet the rig sends during the handshake, verbatim. A radio that + // answers SOMETHING unrecognised (a newer model, a different firmware) and + // a radio that answers nothing are different faults, and a silent timeout + // hides which one this is. + icnHandshakeProbe(p) switch typ { case 0x04: // iAmHere remoteID = sentid @@ -903,3 +908,19 @@ func icnPasscode(s string) []byte { } return out } + +// icnHandshakeProbe logs the first packets seen during a control handshake — +// capped hard, because a working handshake would log for ever. +var icnProbeCount int + +func icnHandshakeProbe(p []byte) { + if icnProbeCount >= 12 { + return + } + icnProbeCount++ + n := len(p) + if n > 32 { + n = 32 + } + debugLog.Printf("icom net: handshake rx %d bytes: % X", len(p), p[:n]) +}