From ad82c21dbc76bc3e9ebe022f850dabdace305a5a Mon Sep 17 00:00:00 2001 From: rouggy Date: Sat, 29 Aug 2026 15:12:12 +0200 Subject: [PATCH] debug(icom): log the raw packets seen during a control handshake MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A rig that answers something unrecognised (a newer model, another firmware) and a rig that answers nothing are different faults; a silent timeout hides which. Capped at a dozen packets so a working handshake cannot flood the log. Prompted by the first IC-7760 network attempt — which turned out to be aimed at the console's IP, where nothing listens; the remote server lives on the RF deck. --- internal/cat/icomnet.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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]) +}