Set up radios with no CAT in radio configure, keyed by CM108, RTS, DTR or VOX
rigctld runs Hamlib's Dummy radio (model 1) with a PTT device, so the programs reach the radio through rigctld as before and rigctld keys it. Sound cards with no serial port are numbered in `radio`'s list and can be chosen with `radio configure N`; serial interfaces take --no-cat --ptt HOW. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
81c6e0b73f
commit
1cccdcd1cc
+129
-6
@@ -59,14 +59,19 @@ pcm() {
|
||||
for dir; do mkdir -p "$RADIO_SYSFS/class/sound/pcmC${n}D0$dir"; done
|
||||
}
|
||||
|
||||
# A hidraw device on a USB device, which you can open unless "locked":
|
||||
# hidraw USBPATH HIDRAW [locked]
|
||||
# A hidraw device on a USB device, which you can open unless "locked", with
|
||||
# udev's links in /dev/input if BY_ID is given: hidraw USBPATH HIDRAW [locked|open] [BY_ID]
|
||||
hidraw() {
|
||||
local iface="$ROOT_HUB/$1/${1##*/}:1.3"
|
||||
mkdir -p "$iface/hidraw/$2" "$RADIO_SYSFS/class/hidraw/$2"
|
||||
ln -s "$iface" "$RADIO_SYSFS/class/hidraw/$2/device"
|
||||
touch "$RADIO_DEV/$2"
|
||||
[ "${3:-}" != locked ] || chmod 000 "$RADIO_DEV/$2"
|
||||
if [ -n "${4:-}" ]; then
|
||||
mkdir -p "$RADIO_DEV/input/by-id" "$RADIO_DEV/input/by-path"
|
||||
ln -sfn "../../$2" "$RADIO_DEV/input/by-id/$4-hidraw"
|
||||
ln -s "../../$2" "$RADIO_DEV/input/by-path/pci-0000:00:14.0-usb-0:${1##*/}:1.3-hidraw"
|
||||
fi
|
||||
}
|
||||
|
||||
# A computer's own sound card, not on USB
|
||||
@@ -1272,8 +1277,8 @@ FLRIG_AUTOSTART() { echo "$HOME/.config/autostart/hampack-flrig.desktop"; }
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${lines[0]}" = "1. Icom IC-7300 (Hamlib model 3073), recognised by its USB serial number" ]
|
||||
[ "${lines[4]}" = "USB sound cards with no serial port, for a radio keyed by VOX or a PTT line:" ]
|
||||
[ "${lines[5]}" = " hw:CARD=AIOC (card2): AIOC All-In-One-Cable, 1209:7388. PTT through CM108 on /dev/hidraw2" ]
|
||||
[ "${lines[6]}" = " hw:CARD=CODEC_1 (card3): Burr-Brown from TI USB Audio CODEC, 08bb:2904. PTT by VOX, or a line of its own" ]
|
||||
[ "${lines[5]}" = "2. hw:CARD=AIOC (card2): AIOC All-In-One-Cable, 1209:7388. PTT through CM108 on /dev/hidraw2" ]
|
||||
[ "${lines[6]}" = "3. hw:CARD=CODEC_1 (card3): Burr-Brown from TI USB Audio CODEC, 08bb:2904. PTT by VOX, or a line of its own" ]
|
||||
[ ${#lines[@]} -eq 7 ]
|
||||
# The radio sound card isn't listed again
|
||||
[[ "$output" != *"(card1):"* ]]
|
||||
@@ -1288,9 +1293,16 @@ FLRIG_AUTOSTART() { echo "$HOME/.config/autostart/hampack-flrig.desktop"; }
|
||||
[ "${lines[0]}" = "USB sound cards with no serial port, for a radio keyed by VOX or a PTT line:" ]
|
||||
[[ "$output" != *"No USB serial ports found"* ]]
|
||||
|
||||
# It can be set up: rigctld keys nothing, and the radio keys itself on the audio
|
||||
run bash "$REPO/radio" configure
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${lines[0]}" = "Setting up the radio on the Burr-Brown from TI USB Audio CODEC, with no CAT: PTT by VOX: the radio keys itself on the audio" ]
|
||||
grep -qx "ExecStart=/usr/bin/rigctld -m 1 -T 127.0.0.1 -t 4532" "$HOME/.config/systemd/user/hampack-rigctld.service"
|
||||
|
||||
rm -r "$RADIO_SYSFS/class/sound/card1"
|
||||
run bash "$REPO/radio" configure
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"No USB serial ports found"* ]]
|
||||
[[ "$output" == *"No USB serial ports or sound cards found"* ]]
|
||||
}
|
||||
|
||||
@test "shows a radio's CM108 PTT, and says when you can't open it" {
|
||||
@@ -1318,7 +1330,7 @@ FLRIG_AUTOSTART() { echo "$HOME/.config/autostart/hampack-flrig.desktop"; }
|
||||
pcm card1 p c
|
||||
hidraw 1-4 hidraw0
|
||||
run bash "$REPO/radio"
|
||||
[ "${lines[1]}" = " hw:CARD=Device (card1): C-Media Electronics Inc. USB Audio Device, 0d8c:0014. PTT by VOX, or a line of its own" ]
|
||||
[ "${lines[1]}" = "1. hw:CARD=Device (card1): C-Media Electronics Inc. USB Audio Device, 0d8c:0014. PTT by VOX, or a line of its own" ]
|
||||
}
|
||||
|
||||
@test "radio's CM108 list is the udev rule's" {
|
||||
@@ -1372,3 +1384,114 @@ FLRIG_AUTOSTART() { echo "$HOME/.config/autostart/hampack-flrig.desktop"; }
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "Elecraft KX3 (Hamlib model 2045), at 38400 baud" ]
|
||||
}
|
||||
|
||||
# --- radios with no CAT ---
|
||||
|
||||
# An AIOC: a CM108-compatible sound card, with no serial port
|
||||
aioc() {
|
||||
usb 1-3 1209:7388 "AIOC" "All-In-One-Cable"
|
||||
card 1-3 card2 AIOC
|
||||
pcm card2 p c
|
||||
hidraw 1-3 hidraw2 open usb-AIOC_All-In-One-Cable-if03
|
||||
}
|
||||
|
||||
# A Digirig: a CP2102 and a CM108B behind its own hub, with a handheld that
|
||||
# answers nothing on it
|
||||
digirig() {
|
||||
usb 1-6 1a40:0101
|
||||
usb 1-6/1-6.1 10c4:ea60 "Silicon Labs" "CP2102 USB to UART Bridge Controller" 0001
|
||||
port 1-6/1-6.1 ttyUSB0 usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0
|
||||
usb 1-6/1-6.2 0d8c:0012 "C-Media Electronics Inc." "USB Audio Device"
|
||||
card 1-6/1-6.2 card1 Device
|
||||
pcm card1 p c
|
||||
hidraw 1-6/1-6.2 hidraw0 open usb-C-Media_Electronics_Inc._USB_Audio_Device-if03
|
||||
}
|
||||
|
||||
@test "configure sets up a sound card with a CM108 pin, with rigctld keying the radio through it" {
|
||||
configurable
|
||||
rm -r "$RADIO_SYSFS/class/tty/ttyUSB0" "$RADIO_SYSFS/class/sound/card1"
|
||||
aioc
|
||||
pipewire_card 2
|
||||
run bash "$REPO/radio" configure
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${lines[0]}" = "Setting up the radio on the AIOC All-In-One-Cable, with no CAT: PTT through its sound card's CM108 pin, /dev/input/by-id/usb-AIOC_All-In-One-Cable-if03-hidraw" ]
|
||||
[[ "$output" == *"rigctld: runs as the hampack-rigctld user service, on 127.0.0.1:4532, and keys the radio when the programs transmit"* ]]
|
||||
local unit="$HOME/.config/systemd/user/hampack-rigctld.service"
|
||||
grep -qx "ExecStart=/usr/bin/rigctld -m 1 -p /dev/input/by-id/usb-AIOC_All-In-One-Cable-if03-hidraw -P CM108 -T 127.0.0.1 -t 4532" "$unit"
|
||||
grep -qx "WantedBy=default.target" "$unit"
|
||||
# The programs key it "by CAT", through rigctld, as for any radio
|
||||
grep -qx "Rig=Hamlib NET rigctl" "$(WSJTX_INI)"
|
||||
grep -qxF "$PTT_CAT" "$(WSJTX_INI)"
|
||||
grep -qx "SoundInName=alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.mono-fallback" "$(WSJTX_INI)"
|
||||
grep -qx "PTT RIG 2 127.0.0.1:4532" "$(DIREWOLF_CONF)"
|
||||
grep -qx "ADEVICE plughw:CARD=AIOC,DEV=0" "$(DIREWOLF_CONF)"
|
||||
grep -qx "ptt=cm108" "$HAMPACK_STATE/radio"
|
||||
grep -qx "hamlib=1" "$HAMPACK_STATE/radio"
|
||||
}
|
||||
|
||||
@test "configure finds a CM108 pin by its path when two cards of a kind share an id" {
|
||||
configurable
|
||||
rm -r "$RADIO_SYSFS/class/tty/ttyUSB0" "$RADIO_SYSFS/class/sound/card1"
|
||||
aioc
|
||||
usb 1-4 1209:7388 "AIOC" "All-In-One-Cable"
|
||||
card 1-4 card3 AIOC_1
|
||||
pcm card3 p c
|
||||
hidraw 1-4 hidraw3 open usb-AIOC_All-In-One-Cable-if03
|
||||
run bash "$REPO/radio" configure 1
|
||||
[ "$status" -eq 0 ]
|
||||
grep -q -- "-p /dev/input/by-path/pci-0000:00:14.0-usb-0:1-3:1.3-hidraw -P CM108" "$HOME/.config/systemd/user/hampack-rigctld.service"
|
||||
}
|
||||
|
||||
@test "configure sets up a handheld on a Digirig with --no-cat and --ptt" {
|
||||
configurable
|
||||
rm -r "$RADIO_SYSFS/class/tty/ttyUSB0" "$RADIO_SYSFS/class/sound/card1" "$RADIO_DEV/serial/by-id/"* "$FAKE_RADIOS/ttyUSB0"
|
||||
digirig
|
||||
run bash "$REPO/radio" configure
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"If the radio has no CAT, \`radio configure --no-cat --ptt HOW\` sets it up to be keyed."* ]]
|
||||
|
||||
run bash "$REPO/radio" configure --no-cat
|
||||
[ "$status" -eq 2 ]
|
||||
[[ "$output" == *"Give the way the interface keys the radio: --ptt rts or --ptt dtr"* ]]
|
||||
|
||||
local port=/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 unit="$HOME/.config/systemd/user/hampack-rigctld.service"
|
||||
run bash "$REPO/radio" configure --no-cat --ptt rts
|
||||
[ "$status" -eq 0 ]
|
||||
[ "${lines[0]}" = "Setting up the radio on the CP2102 USB to UART Bridge Controller, with no CAT: PTT by RTS on $port" ]
|
||||
grep -qx "ExecStart=/usr/bin/rigctld -m 1 -p $port -P RTS -T 127.0.0.1 -t 4532" "$unit"
|
||||
grep -qxF "BindsTo=$(systemd-escape --path --suffix=device "$port")" "$unit"
|
||||
|
||||
run bash "$REPO/radio" configure --no-cat --ptt cm108
|
||||
grep -q -- "-p /dev/input/by-id/usb-C-Media_Electronics_Inc._USB_Audio_Device-if03-hidraw -P CM108" "$unit"
|
||||
}
|
||||
|
||||
@test "configure turns down options that don't fit a radio with no CAT" {
|
||||
configurable
|
||||
run bash "$REPO/radio" configure --ptt rts
|
||||
[ "$status" -eq 2 ]
|
||||
[[ "$output" == *"--ptt is for a radio with no CAT"* ]]
|
||||
run bash "$REPO/radio" configure --no-cat --ptt rts --flrig
|
||||
[ "$status" -eq 2 ]
|
||||
[[ "$output" == *"flrig needs a radio with CAT"* ]]
|
||||
run bash "$REPO/radio" configure --no-cat --ptt rts --model 3073
|
||||
[ "$status" -eq 2 ]
|
||||
[[ "$output" == *"--model doesn't apply"* ]]
|
||||
run bash "$REPO/radio" configure --ptt sideways
|
||||
[ "$status" -eq 2 ]
|
||||
|
||||
rm -r "$RADIO_SYSFS/class/tty/ttyUSB0" "$RADIO_SYSFS/class/sound/card1"
|
||||
aioc
|
||||
run bash "$REPO/radio" configure --ptt rts
|
||||
[ "$status" -eq 2 ]
|
||||
[[ "$output" == *"This sound card has no serial port for --ptt rts: use cm108 or vox."* ]]
|
||||
[ ! -e "$HOME/.config/systemd/user/hampack-rigctld.service" ]
|
||||
|
||||
# A VOX card can't be keyed through a CM108 pin it hasn't got
|
||||
rm -r "$RADIO_SYSFS/class/sound/card2"
|
||||
usb 1-4 08bb:2904 "Burr-Brown from TI" "USB Audio CODEC"
|
||||
card 1-4 card3 CODEC
|
||||
pcm card3 p c
|
||||
run bash "$REPO/radio" configure --ptt cm108
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"no CM108 PTT pin"* ]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user