From d44a971acf782dd60edffd82f217eb3a9f19c25c Mon Sep 17 00:00:00 2001 From: Gregory Salaun Date: Thu, 13 Aug 2026 15:48:05 +0200 Subject: [PATCH] chore(rigctld): trace the client exchange MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only PTT transitions were recorded. So when JTDX aborted a transmission 0.86 seconds into a 13.8-second frame, the log showed the abort and the Fake It frequency restore around it — and not the command that preceded them, which is the one thing needed to tell whether OpsLog answered something the client could not accept. Behind the existing CAT wire-trace switch rather than a new one: this is a line per poll and would drown an ordinary log, and an operator chasing a rig-control fault turns that trace on already. --- changelog.json | 6 ++++-- internal/rigctld/rigctld.go | 14 +++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/changelog.json b/changelog.json index 3911ada..c6601fd 100644 --- a/changelog.json +++ b/changelog.json @@ -3,10 +3,12 @@ "version": "0.25.1", "date": "", "en": [ - "Amplifiers: tick the ones sharing a combiner and ON, OFF and OPERATE act on all of them at once. Each keeps its own meters." + "Amplifiers: tick the ones sharing a combiner and ON, OFF and OPERATE act on all of them at once. Each keeps its own meters.", + "Shared CAT: with the wire trace on, every command a client sends and the answer given are logged." ], "fr": [ - "Amplificateurs : coche ceux qui partagent un combiner et ON, OFF et OPERATE agissent sur tous à la fois. Chacun garde ses mesures." + "Amplificateurs : coche ceux qui partagent un combiner et ON, OFF et OPERATE agissent sur tous à la fois. Chacun garde ses mesures.", + "CAT partagé : avec la trace activée, chaque commande envoyée par un client et la réponse donnée sont journalisées." ] }, { diff --git a/internal/rigctld/rigctld.go b/internal/rigctld/rigctld.go index 6bb2261..1f00835 100644 --- a/internal/rigctld/rigctld.go +++ b/internal/rigctld/rigctld.go @@ -32,6 +32,7 @@ package rigctld import ( "bufio" "fmt" + "hamlog/internal/cat" "net" "strconv" "strings" @@ -244,7 +245,18 @@ func (s *Server) serve(c net.Conn) { s.log("rigctld: client %s disconnected", c.RemoteAddr()) return } - resp, quit := s.handle(strings.TrimSpace(line)) + req := strings.TrimSpace(line) + resp, quit := s.handle(req) + // The whole exchange, when tracing is on. + // + // Only PTT transitions were ever recorded, so when JTDX aborted a + // transmission mid-frame the log showed the abort and not the command + // that preceded it — the one thing needed to tell whether OpsLog answered + // something the client could not accept. Behind the same switch as the CAT + // wire trace: this is one line per poll and would drown an ordinary log. + if req != "" && cat.CIVTraceEnabled() { + s.log("rigctld: %s → %q ⇒ %q", c.RemoteAddr(), req, strings.TrimRight(resp, "\r\n")) + } if resp != "" { if _, err := w.WriteString(resp); err != nil { return