From 77aba730964e3b9f1ad1b6ddf184fdca93cdb9d8 Mon Sep 17 00:00:00 2001 From: rouggy Date: Sun, 30 Aug 2026 01:36:37 +0200 Subject: [PATCH] fix(icom): a disconnected radio says so, not 'use the USB sound card' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TX-audio entry points type-assert the transport; a nil port failed the assertion and produced the sound-card message, sending an operator whose radio was simply off — or on a new DHCP address — hunting through audio devices. --- internal/cat/icomserial.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/cat/icomserial.go b/internal/cat/icomserial.go index 379a3ee..9c6bbc6 100644 --- a/internal/cat/icomserial.go +++ b/internal/cat/icomserial.go @@ -2072,6 +2072,12 @@ func (b *IcomSerial) PlayTXAudio(pcm []byte, rate, ch, bits int, stop <-chan str // from (IcomDo); at worst a reconnect leaves this one connection stale, and // a stale transport fails fast on its closed done channel. port := b.port + // A nil port fails the assertions below too — and used to fail them with + // the sound-card message, sending an operator whose radio was simply OFF + // hunting through their audio devices. + if port == nil { + return fmt.Errorf("not connected to the radio — check the CAT link") + } type txPlayer interface { PlayTXAudio(pcm []byte, rate, ch, bits int, stop <-chan struct{}) error } @@ -2085,6 +2091,9 @@ func (b *IcomSerial) PlayTXAudio(pcm []byte, rate, ch, bits int, stop <-chan str // rig is reached over one. func (b *IcomSerial) TXAudioSender() (func([]byte) error, error) { port := b.port + if port == nil { + return nil, fmt.Errorf("not connected to the radio — check the CAT link") + } type sender interface { TXAudioSender() (func([]byte) error, error) }