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
@@ -12,9 +12,5 @@ control a radio, with rigctld started when the radio is plugged in.
|
|||||||
|
|
||||||
- [ ] Run `TEST.md` against real radios, and mark the `radios.conf` values
|
- [ ] Run `TEST.md` against real radios, and mark the `radios.conf` values
|
||||||
they confirm `# verified`. Fix or remove the ones they don't
|
they confirm `# verified`. Fix or remove the ones they don't
|
||||||
- [ ] Use PTT through a CM108 sound card in `radio configure` for an
|
|
||||||
interface whose radio has no CAT (a Digirig or AIOC on a handheld):
|
|
||||||
Dire Wolf's `PTT CM108`, Graywolf's cm108 method. HamPack's udev rule
|
|
||||||
already lets you open the card's `hidraw` device
|
|
||||||
- [ ] Later: run `radio configure` when a known radio is plugged in (a udev
|
- [ ] Later: run `radio configure` when a known radio is plugged in (a udev
|
||||||
rule starting a systemd user unit)
|
rule starting a systemd user unit)
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ It also gives WSJT-X, JS8Call, fldigi, Dire Wolf, not1mm's voice keyer and POTAC
|
|||||||
|
|
||||||
`radio configure` only fills in rig and sound settings you haven't set (a sound device of "default" or "pipewire" counts as not set). `radio configure --force` replaces them, and every file it changes is backed up first. With more than one radio plugged in, give the number `radio` lists for it: `radio configure 2`. For a radio it can't tell apart from others, give its Hamlib model number: `radio configure --model 2045`.
|
`radio configure` only fills in rig and sound settings you haven't set (a sound device of "default" or "pipewire" counts as not set). `radio configure --force` replaces them, and every file it changes is backed up first. With more than one radio plugged in, give the number `radio` lists for it: `radio configure 2`. For a radio it can't tell apart from others, give its Hamlib model number: `radio configure --model 2045`.
|
||||||
|
|
||||||
|
A radio with no CAT can be set up too, on an interface that keys it: rigctld then runs Hamlib's Dummy radio, which only keys the radio, and the programs reach it as before. A sound card with no serial port (an AIOC, a CM108 cable, a SignaLink) is numbered after the radios in `radio`'s list: `radio configure 2` keys the radio through its CM108 PTT pin if it has one, or leaves it to the radio's VOX. For an interface with a serial port, such as a Digirig on a handheld, say how it keys the radio: `radio configure --no-cat --ptt rts` (or `dtr`, `cm108` or `vox`).
|
||||||
|
|
||||||
flrig can't reach a radio through rigctld, and the two can't share its port, so `radio configure` leaves flrig alone. If you'd rather flrig controlled the radio, run `radio configure --flrig`: flrig gets the radio, and rigctld passes the other programs through it, using Hamlib's FLRig support. flrig then starts when you log in (unless you have it starting already), so it's there before the other programs; leave it running. `radio configure` without --flrig gives the radio back to rigctld, and stops flrig starting at login. `radio configure` also says which sound card is the radio's.
|
flrig can't reach a radio through rigctld, and the two can't share its port, so `radio configure` leaves flrig alone. If you'd rather flrig controlled the radio, run `radio configure --flrig`: flrig gets the radio, and rigctld passes the other programs through it, using Hamlib's FLRig support. flrig then starts when you log in (unless you have it starting already), so it's there before the other programs; leave it running. `radio configure` without --flrig gives the radio back to rigctld, and stops flrig starting at login. `radio configure` also says which sound card is the radio's.
|
||||||
|
|
||||||
The radios it knows are in `radios.conf`. If your radio isn't recognised, or answers with something `radio` doesn't know, please open an issue with what `radio detect --probe` printed.
|
The radios it knows are in `radios.conf`. If your radio isn't recognised, or answers with something `radio` doesn't know, please open an issue with what `radio detect --probe` printed.
|
||||||
|
|||||||
@@ -156,6 +156,14 @@ With a Digirig, an AIOC or another CM108-family interface plugged in, after
|
|||||||
CM108 on /dev/hidrawN". A SignaLink USB is listed there with "PTT by
|
CM108 on /dev/hidrawN". A SignaLink USB is listed there with "PTT by
|
||||||
VOX", and a webcam isn't listed at all.
|
VOX", and a webcam isn't listed at all.
|
||||||
|
|
||||||
|
6. With a handheld (or any radio, on a dummy load) on an AIOC or CM108
|
||||||
|
cable, `radio configure N` (N from `radio`'s list) says "with no CAT:
|
||||||
|
PTT through its sound card's CM108 pin". WSJT-X's "Test PTT" keys the
|
||||||
|
radio, through rigctld, and so does a beacon from Dire Wolf.
|
||||||
|
7. On a Digirig, `radio configure --no-cat --ptt rts` (or cm108, whichever
|
||||||
|
your Digirig keys with): "Test PTT" keys the radio. Unplug the Digirig:
|
||||||
|
rigctld stops; plug it in: rigctld starts.
|
||||||
|
|
||||||
| Date | Commit | Interface | ACL | Keys the radio | Notes |
|
| Date | Commit | Interface | ACL | Keys the radio | Notes |
|
||||||
|------|--------|-----------|-----|----------------|-------|
|
|------|--------|-----------|-----|----------------|-------|
|
||||||
| | | | | | |
|
| | | | | | |
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#
|
#
|
||||||
# Usage : radio [detect] [--probe]
|
# Usage : radio [detect] [--probe]
|
||||||
# radio probe PORT
|
# radio probe PORT
|
||||||
# radio configure [--force] [--model N] [--flrig] [NUMBER]
|
# radio configure [--force] [--model N] [--flrig] [--no-cat --ptt HOW] [NUMBER]
|
||||||
# radio help
|
# radio help
|
||||||
|
|
||||||
SELF="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
SELF="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
@@ -71,6 +71,14 @@ Usage: radio [detect] [--probe]
|
|||||||
--flrig Put flrig in charge of the radio, with rigctld passing the
|
--flrig Put flrig in charge of the radio, with rigctld passing the
|
||||||
other programs through it. flrig then has to be running
|
other programs through it. flrig then has to be running
|
||||||
for them to reach the radio
|
for them to reach the radio
|
||||||
|
--no-cat For a radio with no CAT on an interface with a serial port
|
||||||
|
(a handheld on a Digirig): rigctld only keys it, so give
|
||||||
|
--ptt too. Sound cards with no serial port (an AIOC, a
|
||||||
|
SignaLink) are set up like this anyway
|
||||||
|
--ptt HOW How the interface keys the radio: cm108 (its sound card's
|
||||||
|
PTT pin), rts or dtr (its serial port's lines), or vox
|
||||||
|
(the radio keys itself on the audio). A sound card is
|
||||||
|
cm108 if it can be, and vox otherwise
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +145,28 @@ cm108_ptt() {
|
|||||||
echo "its GPIO pin, though its hidraw device is missing"
|
echo "its GPIO pin, though its hidraw device is missing"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Print the stable name of the hidraw device on a CM108 sound card's USB
|
||||||
|
# device: its link in /dev/input/by-id, unless another device has the same
|
||||||
|
# id (two cards of a kind, with no serial number), then its link in
|
||||||
|
# /dev/input/by-path, or else its /dev name. hidraw_path USB_DEVICE
|
||||||
|
hidraw_path() {
|
||||||
|
local h="" other link same=0
|
||||||
|
for other in $(printf '%s\n' "${!HIDRAW_USB[@]}" | sort -V); do
|
||||||
|
[ "${HIDRAW_USB[$other]}" = "$1" ] && { h="$other"; break; }
|
||||||
|
done
|
||||||
|
[ -n "$h" ] || return 1
|
||||||
|
for other in "${!HIDRAW_USB[@]}"; do
|
||||||
|
[ "$other" != "$h" ] || continue
|
||||||
|
[ "${HIDRAW_USB[$other]}" != "$1" ] || continue
|
||||||
|
[ "$(attr "${HIDRAW_USB[$other]}" idVendor):$(attr "${HIDRAW_USB[$other]}" idProduct):$(attr "${HIDRAW_USB[$other]}" serial)" = \
|
||||||
|
"$(attr "$1" idVendor):$(attr "$1" idProduct):$(attr "$1" serial)" ] && same=1
|
||||||
|
done
|
||||||
|
for link in $( ((same)) || echo "$DEVDIR"/input/by-id/*-hidraw) "$DEVDIR"/input/by-path/*-hidraw; do
|
||||||
|
[ -L "$link" ] && [ "$(basename "$(readlink -f "$link")")" = "$h" ] && { echo "/dev/${link#"$DEVDIR"/}"; return 0; }
|
||||||
|
done
|
||||||
|
echo "/dev/$h"
|
||||||
|
}
|
||||||
|
|
||||||
# Whether a sound card can both play and record, as an interface to a radio
|
# Whether a sound card can both play and record, as an interface to a radio
|
||||||
# must: not a webcam's microphone, say
|
# must: not a webcam's microphone, say
|
||||||
plays_and_records() {
|
plays_and_records() {
|
||||||
@@ -539,7 +569,7 @@ detect() {
|
|||||||
while read -r card dev; do
|
while read -r card dev; do
|
||||||
id="$(attr "$SYSFS/class/sound/$card" id)"
|
id="$(attr "$SYSFS/class/sound/$card" id)"
|
||||||
ptt="$(cm108_ptt "$dev")" && ptt="PTT through CM108 on $ptt" || ptt="PTT by VOX, or a line of its own"
|
ptt="$(cm108_ptt "$dev")" && ptt="PTT through CM108 on $ptt" || ptt="PTT by VOX, or a line of its own"
|
||||||
echo " hw:CARD=$id ($card): $(attr "$dev" manufacturer) $(attr "$dev" product), $(attr "$dev" idVendor):$(attr "$dev" idProduct). $ptt"
|
echo "$((++n)). hw:CARD=$id ($card): $(attr "$dev" manufacturer) $(attr "$dev" product), $(attr "$dev" idVendor):$(attr "$dev" idProduct). $ptt"
|
||||||
done <<< "$sound_only"
|
done <<< "$sound_only"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1542,12 +1572,18 @@ hamlib_name() {
|
|||||||
|
|
||||||
# radio configure: set up rigctld for a radio and point the programs at it
|
# radio configure: set up rigctld for a radio and point the programs at it
|
||||||
configure() {
|
configure() {
|
||||||
local number="" model="" radio was_running=0 name port baud card flrig_name="" flrig_port=12345
|
local number="" model="" radio="" sound_card="" sound_dev="" was_running=0 name port="" baud="" card card_sys
|
||||||
|
local flrig_name="" flrig_port=12345 no_cat=0 ptt="" ptt_type="" ptt_device="" ptt_text="" sound_only total
|
||||||
FORCE=0 BACKUPS=() USE_FLRIG=0
|
FORCE=0 BACKUPS=() USE_FLRIG=0
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--force) FORCE=1 ;;
|
--force) FORCE=1 ;;
|
||||||
--flrig) USE_FLRIG=1 ;;
|
--flrig) USE_FLRIG=1 ;;
|
||||||
|
--no-cat) no_cat=1 ;;
|
||||||
|
--ptt)
|
||||||
|
[[ "${2:-}" =~ ^(cm108|rts|dtr|vox)$ ]] || { usage >&2; return 2; }
|
||||||
|
ptt="$2"
|
||||||
|
shift ;;
|
||||||
--model)
|
--model)
|
||||||
[[ "${2:-}" =~ ^[0-9]+$ ]] || { usage >&2; return 2; }
|
[[ "${2:-}" =~ ^[0-9]+$ ]] || { usage >&2; return 2; }
|
||||||
model="$2"
|
model="$2"
|
||||||
@@ -1560,22 +1596,54 @@ configure() {
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! find_radios; then
|
# Radios with a serial port, then sound cards with none, numbered as `radio` lists them
|
||||||
echo "No USB serial ports found: is the radio plugged in and switched on?"
|
find_radios
|
||||||
|
sound_only="$(sound_only_cards)"
|
||||||
|
local sound_cards=()
|
||||||
|
[ -z "$sound_only" ] || mapfile -t sound_cards <<< "$sound_only"
|
||||||
|
total=$(( ${#RADIOS[@]} + ${#sound_cards[@]} ))
|
||||||
|
if (( total == 0 )); then
|
||||||
|
echo "No USB serial ports or sound cards found: is the radio plugged in and switched on?"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ -z "$number" ]; then
|
if [ -z "$number" ]; then
|
||||||
if [ ${#RADIOS[@]} -gt 1 ]; then
|
if (( total > 1 )); then
|
||||||
echo "There are ${#RADIOS[@]} radios or interfaces plugged in. Give the number \`radio\` lists for the one to set up, as in \`radio configure 2\`"
|
echo "There are $total radios or interfaces plugged in. Give the number \`radio\` lists for the one to set up, as in \`radio configure 2\`"
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
number=1
|
number=1
|
||||||
fi
|
fi
|
||||||
if (( number > ${#RADIOS[@]} )); then
|
if (( number > total )); then
|
||||||
echo "There's no radio $number: \`radio\` lists ${#RADIOS[@]}"
|
echo "There's no radio $number: \`radio\` lists $total"
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
if (( number <= ${#RADIOS[@]} )); then
|
||||||
radio="${RADIOS[number - 1]}"
|
radio="${RADIOS[number - 1]}"
|
||||||
|
else
|
||||||
|
read -r sound_card sound_dev <<< "${sound_cards[number - ${#RADIOS[@]} - 1]}"
|
||||||
|
no_cat=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( no_cat && USE_FLRIG )); then
|
||||||
|
echo "flrig needs a radio with CAT to control, so --flrig can't set up a radio with none."
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
if (( no_cat )) && [ -n "$model" ]; then
|
||||||
|
echo "With no CAT, rigctld doesn't talk to the radio, so --model doesn't apply."
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
if [ -n "$ptt" ] && (( ! no_cat )); then
|
||||||
|
echo "--ptt is for a radio with no CAT: with CAT, the radio is keyed through it. Add --no-cat if this radio has none."
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
if [ -n "$sound_card" ] && [[ "$ptt" =~ ^(rts|dtr)$ ]]; then
|
||||||
|
echo "This sound card has no serial port for --ptt $ptt: use cm108 or vox."
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
if [ -n "$radio" ] && (( no_cat )) && [ -z "$ptt" ]; then
|
||||||
|
echo "Give the way the interface keys the radio: --ptt rts or --ptt dtr (its serial port's lines; a Digirig Mobile uses rts), --ptt cm108 (its sound card's PTT pin) or --ptt vox."
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
if (( USE_FLRIG )); then
|
if (( USE_FLRIG )); then
|
||||||
if ! command -v flrig > /dev/null; then
|
if ! command -v flrig > /dev/null; then
|
||||||
echo "flrig isn't installed."
|
echo "flrig isn't installed."
|
||||||
@@ -1592,11 +1660,46 @@ configure() {
|
|||||||
systemctl --user stop hampack-rigctld
|
systemctl --user stop hampack-rigctld
|
||||||
was_running=1
|
was_running=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if (( no_cat )); then
|
||||||
|
# rigctld's Dummy radio (Hamlib model 1) only keys the radio, its own way
|
||||||
|
model=1
|
||||||
|
if [ -n "$radio" ]; then
|
||||||
|
read -ra ID_PORTS <<< "${RADIO_PORTS[$radio]}"
|
||||||
|
port="$(port_path "${ID_PORTS[0]}")"
|
||||||
|
card_sys="$(card_of "$radio")"
|
||||||
|
name="radio on the $(attr "${PORT_USB[${ID_PORTS[0]}]}" product)"
|
||||||
|
else
|
||||||
|
card_sys="$sound_card"
|
||||||
|
name="radio on the $(attr "$sound_dev" manufacturer) $(attr "$sound_dev" product)"
|
||||||
|
name="${name// / }"
|
||||||
|
if [ -z "$ptt" ]; then
|
||||||
|
cm108_compatible "$sound_dev" && ptt=cm108 || ptt=vox
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
case "$ptt" in
|
||||||
|
cm108)
|
||||||
|
local cm108_dev="${CARD_USB[$card_sys]:-}"
|
||||||
|
if [ -z "$cm108_dev" ] || ! cm108_compatible "$cm108_dev" || ! ptt_device="$(hidraw_path "$cm108_dev")"; then
|
||||||
|
echo "The radio's sound card has no CM108 PTT pin radio can find: give another --ptt."
|
||||||
|
(( ! was_running )) || systemctl --user start hampack-rigctld
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
ptt_type=CM108
|
||||||
|
ptt_text="PTT through its sound card's CM108 pin, $ptt_device" ;;
|
||||||
|
rts | dtr)
|
||||||
|
ptt_device="$port"
|
||||||
|
ptt_type="${ptt^^}"
|
||||||
|
ptt_text="PTT by ${ptt^^} on $port" ;;
|
||||||
|
vox)
|
||||||
|
ptt_text="PTT by VOX: the radio keys itself on the audio" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
identify "$radio" always
|
identify "$radio" always
|
||||||
if [ -z "$ID_CAT_PORT" ]; then
|
if [ -z "$ID_CAT_PORT" ]; then
|
||||||
echo "Couldn't set it up: nothing answered on ${ID_PORTS[*]}."
|
echo "Couldn't set it up: nothing answered on ${ID_PORTS[*]}."
|
||||||
[ ${#ID_NOTES[@]} -eq 0 ] || printf ' %s\n' "${ID_NOTES[@]}"
|
[ ${#ID_NOTES[@]} -eq 0 ] || printf ' %s\n' "${ID_NOTES[@]}"
|
||||||
(( ! ID_ASKED )) || echo "Check it's switched on and its CAT rate is one of ${BAUDS[*]} baud."
|
(( ! ID_ASKED )) || echo "Check it's switched on and its CAT rate is one of ${BAUDS[*]} baud. If the radio has no CAT, \`radio configure --no-cat --ptt HOW\` sets it up to be keyed."
|
||||||
(( ! was_running )) || systemctl --user start hampack-rigctld
|
(( ! was_running )) || systemctl --user start hampack-rigctld
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -1629,23 +1732,34 @@ configure() {
|
|||||||
fi
|
fi
|
||||||
port="$(port_path "$ID_CAT_PORT")"
|
port="$(port_path "$ID_CAT_PORT")"
|
||||||
baud="$ID_BAUD"
|
baud="$ID_BAUD"
|
||||||
card="$(card_name "$radio")"
|
card_sys="$(card_of "$radio")"
|
||||||
local card_number="" pipewire=0
|
fi
|
||||||
card_number="$(card_of "$radio")"
|
card=""
|
||||||
card_number="${card_number#card}"
|
[ -z "$card_sys" ] || card="hw:CARD=$(attr "$SYSFS/class/sound/$card_sys" id)"
|
||||||
|
local card_number="${card_sys#card}" pipewire=0
|
||||||
find_pipewire_nodes "$card_number" && pipewire=1
|
find_pipewire_nodes "$card_number" && pipewire=1
|
||||||
PORTAUDIO_DEVICES="$(portaudio_devices)" || PORTAUDIO_DEVICES=""
|
PORTAUDIO_DEVICES="$(portaudio_devices)" || PORTAUDIO_DEVICES=""
|
||||||
|
|
||||||
|
if (( no_cat )); then
|
||||||
|
echo "Setting up the $name, with no CAT: $ptt_text"
|
||||||
|
else
|
||||||
echo "Setting up the $name (Hamlib model $model), on $port at $baud baud$( (( USE_FLRIG )) && echo ", through flrig")"
|
echo "Setting up the $name (Hamlib model $model), on $port at $baud baud$( (( USE_FLRIG )) && echo ", through flrig")"
|
||||||
|
fi
|
||||||
echo
|
echo
|
||||||
local rigctld=""
|
local rigctld=""
|
||||||
if (( USE_FLRIG )); then
|
if (( USE_FLRIG )); then
|
||||||
rigctld="$(write_rigctld "flrig, which controls the $name" "" -m 4 -r "127.0.0.1:$flrig_port")"
|
rigctld="$(write_rigctld "flrig, which controls the $name" "" -m 4 -r "127.0.0.1:$flrig_port")"
|
||||||
|
elif (( no_cat )); then
|
||||||
|
rigctld="$(write_rigctld "the $name, which only keys it" "$port" -m 1 ${ptt_type:+-p "$ptt_device" -P "$ptt_type"})"
|
||||||
else
|
else
|
||||||
rigctld="$(write_rigctld "the $name" "$port" -m "$model" -r "$port" -s "$baud")"
|
rigctld="$(write_rigctld "the $name" "$port" -m "$model" -r "$port" -s "$baud")"
|
||||||
fi
|
fi
|
||||||
if [ "$rigctld" = started ] && (( USE_FLRIG )); then
|
if [ "$rigctld" = started ] && (( USE_FLRIG )); then
|
||||||
report rigctld "runs as the hampack-rigctld user service, on $RIGCTLD_ADDR, and passes everything to flrig"
|
report rigctld "runs as the hampack-rigctld user service, on $RIGCTLD_ADDR, and passes everything to flrig"
|
||||||
|
elif [ "$rigctld" = started ] && (( no_cat )) && [ -z "$port" ]; then
|
||||||
|
report rigctld "runs as the hampack-rigctld user service, on $RIGCTLD_ADDR, and keys the radio when the programs transmit"
|
||||||
|
elif [ "$rigctld" = started ] && (( no_cat )); then
|
||||||
|
report rigctld "runs as the hampack-rigctld user service, on $RIGCTLD_ADDR, whenever the interface is plugged in, and keys the radio when the programs transmit"
|
||||||
elif [ "$rigctld" = started ]; then
|
elif [ "$rigctld" = started ]; then
|
||||||
report rigctld "runs as the hampack-rigctld user service, on $RIGCTLD_ADDR, whenever the radio is plugged in and on"
|
report rigctld "runs as the hampack-rigctld user service, on $RIGCTLD_ADDR, whenever the radio is plugged in and on"
|
||||||
elif [ "$rigctld" = waiting ]; then
|
elif [ "$rigctld" = waiting ]; then
|
||||||
@@ -1653,7 +1767,7 @@ configure() {
|
|||||||
else
|
else
|
||||||
report rigctld "couldn't start: see \`systemctl --user status hampack-rigctld\`"
|
report rigctld "couldn't start: see \`systemctl --user status hampack-rigctld\`"
|
||||||
fi
|
fi
|
||||||
[[ "$port" == /dev/serial/by-id/* ]] ||
|
[ -z "$port" ] || [[ "$port" == /dev/serial/by-id/* ]] ||
|
||||||
report "" "$port has no stable name, so it may be a different port after a reboot. Run \`radio configure\` again if so"
|
report "" "$port has no stable name, so it may be a different port after a reboot. Run \`radio configure\` again if so"
|
||||||
|
|
||||||
if flatpak info "$WSJTX_FLATPAK" > /dev/null 2>&1; then
|
if flatpak info "$WSJTX_FLATPAK" > /dev/null 2>&1; then
|
||||||
@@ -1676,8 +1790,8 @@ configure() {
|
|||||||
configure_graywolf "$card" "$name"
|
configure_graywolf "$card" "$name"
|
||||||
|
|
||||||
mkdir -p "$HAMPACK_STATE" &&
|
mkdir -p "$HAMPACK_STATE" &&
|
||||||
printf 'name=%s\nhamlib=%s\nport=%s\nbaud=%s\ncard=%s\ncontroller=%s\n' "$name" "$model" "$port" "$baud" "$card" \
|
printf 'name=%s\nhamlib=%s\nport=%s\nbaud=%s\ncard=%s\ncontroller=%s\nptt=%s\n' "$name" "$model" "$port" "$baud" "$card" \
|
||||||
"$( (( USE_FLRIG )) && echo flrig || echo rigctld)" > "$HAMPACK_STATE/radio"
|
"$( (( USE_FLRIG )) && echo flrig || echo rigctld)" "${ptt:-cat}" > "$HAMPACK_STATE/radio"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
if [ -z "$card" ]; then
|
if [ -z "$card" ]; then
|
||||||
@@ -1685,7 +1799,7 @@ configure() {
|
|||||||
elif (( pipewire )); then
|
elif (( pipewire )); then
|
||||||
echo "The radio's sound card is \"$PW_OUT_DESC\" ($card)."
|
echo "The radio's sound card is \"$PW_OUT_DESC\" ($card)."
|
||||||
else
|
else
|
||||||
echo "PipeWire didn't list the radio's sound card, $card (\"$(attr "${CARD_USB[$(card_of "$radio")]}" product)\"), so choose it yourself in WSJT-X, JS8Call and POTACAT."
|
echo "PipeWire didn't list the radio's sound card, $card (\"$(attr "${CARD_USB[$card_sys]}" product)\"), so choose it yourself in WSJT-X, JS8Call and POTACAT."
|
||||||
fi
|
fi
|
||||||
[ ${#BACKUPS[@]} -eq 0 ] || { echo "The settings were backed up first, to:"; printf ' %s\n' "${BACKUPS[@]}"; }
|
[ ${#BACKUPS[@]} -eq 0 ] || { echo "The settings were backed up first, to:"; printf ' %s\n' "${BACKUPS[@]}"; }
|
||||||
}
|
}
|
||||||
|
|||||||
+129
-6
@@ -59,14 +59,19 @@ pcm() {
|
|||||||
for dir; do mkdir -p "$RADIO_SYSFS/class/sound/pcmC${n}D0$dir"; done
|
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":
|
# A hidraw device on a USB device, which you can open unless "locked", with
|
||||||
# hidraw USBPATH HIDRAW [locked]
|
# udev's links in /dev/input if BY_ID is given: hidraw USBPATH HIDRAW [locked|open] [BY_ID]
|
||||||
hidraw() {
|
hidraw() {
|
||||||
local iface="$ROOT_HUB/$1/${1##*/}:1.3"
|
local iface="$ROOT_HUB/$1/${1##*/}:1.3"
|
||||||
mkdir -p "$iface/hidraw/$2" "$RADIO_SYSFS/class/hidraw/$2"
|
mkdir -p "$iface/hidraw/$2" "$RADIO_SYSFS/class/hidraw/$2"
|
||||||
ln -s "$iface" "$RADIO_SYSFS/class/hidraw/$2/device"
|
ln -s "$iface" "$RADIO_SYSFS/class/hidraw/$2/device"
|
||||||
touch "$RADIO_DEV/$2"
|
touch "$RADIO_DEV/$2"
|
||||||
[ "${3:-}" != locked ] || chmod 000 "$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
|
# 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 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "${lines[0]}" = "1. Icom IC-7300 (Hamlib model 3073), recognised by its USB serial number" ]
|
[ "${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[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[5]}" = "2. 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[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 ]
|
[ ${#lines[@]} -eq 7 ]
|
||||||
# The radio sound card isn't listed again
|
# The radio sound card isn't listed again
|
||||||
[[ "$output" != *"(card1):"* ]]
|
[[ "$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:" ]
|
[ "${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"* ]]
|
[[ "$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
|
run bash "$REPO/radio" configure
|
||||||
[ "$status" -eq 1 ]
|
[ "$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" {
|
@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
|
pcm card1 p c
|
||||||
hidraw 1-4 hidraw0
|
hidraw 1-4 hidraw0
|
||||||
run bash "$REPO/radio"
|
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" {
|
@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 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = "Elecraft KX3 (Hamlib model 2045), at 38400 baud" ]
|
[ "$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