chore(rigctld): trace the client exchange

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.
This commit is contained in:
2026-08-13 15:48:05 +02:00
parent fabd1becce
commit d44a971acf
2 changed files with 17 additions and 3 deletions
+4 -2
View File
@@ -3,10 +3,12 @@
"version": "0.25.1", "version": "0.25.1",
"date": "", "date": "",
"en": [ "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": [ "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."
] ]
}, },
{ {
+13 -1
View File
@@ -32,6 +32,7 @@ package rigctld
import ( import (
"bufio" "bufio"
"fmt" "fmt"
"hamlog/internal/cat"
"net" "net"
"strconv" "strconv"
"strings" "strings"
@@ -244,7 +245,18 @@ func (s *Server) serve(c net.Conn) {
s.log("rigctld: client %s disconnected", c.RemoteAddr()) s.log("rigctld: client %s disconnected", c.RemoteAddr())
return 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 resp != "" {
if _, err := w.WriteString(resp); err != nil { if _, err := w.WriteString(resp); err != nil {
return return