Set the radio's sound card in radio configure
WSJT-X and JS8Call get the radio's sound card as PipeWire names it: radio
asks pactl for the input and output nodes on the radio's ALSA card.
WSJT-X (Qt 5, through Qt's PulseAudio plugin) keeps the node names in
SoundInName and SoundOutName; JS8Call (Qt 6) keeps them in SoundInId and
SoundOutId, with PipeWire's descriptions, quoted as Qt writes them, in
SoundInName and SoundOutName. A setting that's empty or a default
("default", "pipewire") is replaced; a device you chose is left alone
unless --force.
If Graywolf has no channels, it gets input and output devices on
plughw:CARD=...,DEV=0 and a channel named after the radio, with its
defaults (1200 baud AFSK, APRS) and PTT through rigctld, in the same
stop and start as the PTT change.
fldigi, not1mm and POTACAT name sound cards in ways radio can't write,
so the closing message names them and says which card to choose.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
04d973039a
commit
4053664d77
@@ -18,11 +18,12 @@ control a radio.
|
|||||||
- [ ] `radio configure`, the rest. It writes the rigctld user service and
|
- [ ] `radio configure`, the rest. It writes the rigctld user service and
|
||||||
points WSJT-X, JS8Call, Pat, fldigi, Dire Wolf, not1mm, QLog, POTACAT
|
points WSJT-X, JS8Call, Pat, fldigi, Dire Wolf, not1mm, QLog, POTACAT
|
||||||
and Graywolf at it. Still to do:
|
and Graywolf at it. Still to do:
|
||||||
- [ ] Sound cards. Each program saves its sound device under a name from
|
- [ ] Sound cards for fldigi, not1mm and POTACAT. fldigi (PortAudio) and
|
||||||
its audio backend (WSJT-X saved "pipewire" here), so find what each
|
not1mm (sounddevice) name a card with its number, as in
|
||||||
saves for a USB codec on a real machine before writing it. Dire Wolf
|
"USB Audio CODEC: - (hw:1,0)", which can change between boots; a
|
||||||
is done: it takes ALSA names. Graywolf takes cpal device names, and
|
sounddevice name can match part of a name, so not1mm might take
|
||||||
needs a channel with an audio device; POTACAT keeps audio per rig
|
"USB Audio CODEC". POTACAT keeps browser device ids, which only it
|
||||||
|
can see. WSJT-X, JS8Call, Dire Wolf and Graywolf are done
|
||||||
- [ ] flrig can't use rigctld, so it can't run alongside it. Say so, or
|
- [ ] flrig can't use rigctld, so it can't run alongside it. Say so, or
|
||||||
offer flrig as the controller instead
|
offer flrig as the controller instead
|
||||||
- [ ] More than one radio at once: a rigctld for each, on its own port
|
- [ ] More than one radio at once: a rigctld for each, on its own port
|
||||||
|
|||||||
@@ -65,9 +65,11 @@ Controlling a radio means opening its serial port, and on Arch only members of t
|
|||||||
|
|
||||||
Probing opens the port, which raises its DTR and RTS lines for a moment before `radio` drops them. Interfaces that key the transmitter with DTR or RTS may key it briefly, so probe with the radio on a dummy load or an antenna.
|
Probing opens the port, which raises its DTR and RTS lines for a moment before `radio` drops them. Interfaces that key the transmitter with DTR or RTS may key it briefly, so probe with the radio on a dummy load or an antenna.
|
||||||
|
|
||||||
`radio configure` sets up the radio for HamPack's programs. It asks the radio what it is and at what baud rate it answers. Then it runs Hamlib's rigctld for it, as the `hampack-rigctld` systemd user service on 127.0.0.1:4532, and points WSJT-X, JS8Call, Pat, fldigi, Dire Wolf, not1mm, QLog, POTACAT and Graywolf at rigctld, with PTT through it. QLog gets a rig profile named HamPack in its log, which is backed up first. Graywolf's channels that transmit get PTT through rigctld; it's stopped for that with sudo, and started again. Dire Wolf also gets the radio's sound card. They then share the radio through rigctld, without fighting over its serial port. Quit them first, since they save their settings when they quit.
|
`radio configure` sets up the radio for HamPack's programs. It asks the radio what it is and at what baud rate it answers. Then it runs Hamlib's rigctld for it, as the `hampack-rigctld` systemd user service on 127.0.0.1:4532, and points WSJT-X, JS8Call, Pat, fldigi, Dire Wolf, not1mm, QLog, POTACAT and Graywolf at rigctld, with PTT through it. QLog gets a rig profile named HamPack in its log, which is backed up first. Graywolf's channels that transmit get PTT through rigctld; it's stopped for that with sudo, and started again. They then share the radio through rigctld, without fighting over its serial port. Quit them first, since they save their settings when they quit.
|
||||||
|
|
||||||
`radio configure` only fills in rig settings you haven't 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`. Choose the radio's sound card in the other programs yourself; `radio configure` says which it is.
|
It also gives WSJT-X, JS8Call and Dire Wolf the radio's sound card. WSJT-X and JS8Call get it as PipeWire names it, so PipeWire must be running. If Graywolf has no channels yet, it gets one on the radio's sound card, for 1200 baud APRS.
|
||||||
|
|
||||||
|
`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`. Choose the radio's sound card yourself in fldigi, not1mm and POTACAT; `radio configure` says which it is.
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
|||||||
@@ -55,8 +55,12 @@ Dire Wolf, not1mm, QLog and POTACAT quit:
|
|||||||
3. Open WSJT-X. Settings > Radio shows "Hamlib NET rigctl", 127.0.0.1:4532
|
3. Open WSJT-X. Settings > Radio shows "Hamlib NET rigctl", 127.0.0.1:4532
|
||||||
and PTT by CAT. "Test CAT" turns green, and "Test PTT" keys the radio.
|
and PTT by CAT. "Test CAT" turns green, and "Test PTT" keys the radio.
|
||||||
Note whether WSJT-X kept the PTT setting, which `radio configure` writes in
|
Note whether WSJT-X kept the PTT setting, which `radio configure` writes in
|
||||||
Qt's own format; if it shows VOX, that format is wrong.
|
Qt's own format; if it shows VOX, that format is wrong. Settings > Audio
|
||||||
4. The same in JS8Call.
|
shows the radio's sound card for input and output (the PipeWire names
|
||||||
|
`radio configure` printed), and the waterfall shows the band.
|
||||||
|
4. The same in JS8Call. Its sound card is matched by PipeWire's node name,
|
||||||
|
which is what Qt 6.12 calls the device's id; if it shows another card,
|
||||||
|
note what JS8Call.ini's SoundInId says after you pick the right one.
|
||||||
5. In Pat, `pat connect ardop:///...` (or the web UI) changes the radio's
|
5. In Pat, `pat connect ardop:///...` (or the web UI) changes the radio's
|
||||||
frequency through rigctld.
|
frequency through rigctld.
|
||||||
6. Open fldigi (after running it once, so it has settings). Configure >
|
6. Open fldigi (after running it once, so it has settings). Configure >
|
||||||
@@ -80,10 +84,13 @@ Dire Wolf, not1mm, QLog and POTACAT quit:
|
|||||||
rigctld)" as a rigctld Network rig at 127.0.0.1:4532, it's the active rig,
|
rigctld)" as a rigctld Network rig at 127.0.0.1:4532, it's the active rig,
|
||||||
and the frequency follows the radio. If you have an operator profile, check
|
and the frequency follows the radio. If you have an operator profile, check
|
||||||
POTACAT doesn't say the connection belongs to another rig.
|
POTACAT doesn't say the connection belongs to another rig.
|
||||||
11. In Graywolf's web UI, add a channel with the radio's sound card, then run
|
11. With no channels in Graywolf, run `radio configure` (it asks for sudo to
|
||||||
`radio configure` (it asks for sudo to stop Graywolf). The channel's PTT
|
stop Graywolf). Graywolf's web UI shows a channel named after the radio,
|
||||||
is rigctld, 127.0.0.1:4532, Graywolf is running again, and "Test rigctld"
|
on plughw:CARD=...,DEV=0 for input and output, 1200 baud APRS, with PTT
|
||||||
in its PTT page passes. Send a beacon and check it keys the radio.
|
rigctld, 127.0.0.1:4532. Graywolf is running again, its audio meter moves
|
||||||
|
with the band, and "Test rigctld" in its PTT page passes. Send a beacon
|
||||||
|
and check it keys the radio. Graywolf warns that plughw: fails on some
|
||||||
|
cheap USB chips where only hw: works; note if this is one.
|
||||||
12. Run `radio configure` again: each program is "already set up", and
|
12. Run `radio configure` again: each program is "already set up", and
|
||||||
rigctld restarts.
|
rigctld restarts.
|
||||||
13. With a rig set by hand in WSJT-X, `radio configure` leaves it alone, and
|
13. With a rig set by hand in WSJT-X, `radio configure` leaves it alone, and
|
||||||
|
|||||||
@@ -489,32 +489,106 @@ running() {
|
|||||||
pgrep -x "$1" > /dev/null 2>&1
|
pgrep -x "$1" > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Print a string as Qt writes it to an INI file: quoted if it has characters
|
||||||
|
# Qt would read otherwise (a comma makes a list), with \ and " escaped
|
||||||
|
qt_ini_string() {
|
||||||
|
local v="${1//\\/\\\\}"
|
||||||
|
v="${v//\"/\\\"}"
|
||||||
|
if [[ "$1" =~ [,\;=\"\\] ]] || [[ "$1" == " "* ]] || [[ "$1" == *" " ]]; then
|
||||||
|
printf '"%s"\n' "$v"
|
||||||
|
else
|
||||||
|
printf '%s\n' "$1"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Find the radio's sound card in PipeWire, as programs that use it (through
|
||||||
|
# Qt) name it: find_pipewire_nodes CARD_NUMBER sets PW_IN_NAME and
|
||||||
|
# PW_OUT_NAME (node names, such as alsa_input.usb-...) and PW_IN_DESC and
|
||||||
|
# PW_OUT_DESC (as PipeWire describes them)
|
||||||
|
find_pipewire_nodes() {
|
||||||
|
PW_IN_NAME="" PW_IN_DESC="" PW_OUT_NAME="" PW_OUT_DESC=""
|
||||||
|
[ -n "$1" ] && command -v pactl > /dev/null || return 1
|
||||||
|
# shellcheck disable=SC2016 # $n is jq's
|
||||||
|
local query='first(.[] | select(.properties["alsa.card"] == $n and .properties["device.class"] == "sound")) | [.name, .description] | @tsv'
|
||||||
|
IFS=$'\t' read -r PW_IN_NAME PW_IN_DESC < <(pactl -f json list sources 2> /dev/null | jq -r --arg n "$1" "$query" 2> /dev/null)
|
||||||
|
IFS=$'\t' read -r PW_OUT_NAME PW_OUT_DESC < <(pactl -f json list sinks 2> /dev/null | jq -r --arg n "$1" "$query" 2> /dev/null)
|
||||||
|
[ -n "$PW_IN_NAME" ] && [ -n "$PW_OUT_NAME" ] || { PW_IN_NAME="" PW_OUT_NAME=""; return 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
# A sound device setting that names no particular card: unset, or a default
|
||||||
|
is_default_device() {
|
||||||
|
case "$1" in
|
||||||
|
"" | default | pipewire | pulse | sysdefault) return 0 ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# Say what was set, and what was left alone and why: say_changes NAME, from
|
||||||
|
# SAID (what was set) and LEFT (what was left alone)
|
||||||
|
say_changes() {
|
||||||
|
local message="" IFS='|'
|
||||||
|
if [ ${#SAID[@]} -gt 0 ]; then
|
||||||
|
message="${SAID[*]}"
|
||||||
|
message="${message//|/, }"
|
||||||
|
fi
|
||||||
|
if [ ${#LEFT[@]} -gt 0 ]; then
|
||||||
|
local left="${LEFT[*]}"
|
||||||
|
message="${message:+$message. }Left ${left//|/ and } alone: \`radio configure --force\` replaces $( [ ${#LEFT[@]} -eq 1 ] && echo it || echo them)"
|
||||||
|
fi
|
||||||
|
report "$1" "${message:-already set up}"
|
||||||
|
}
|
||||||
|
|
||||||
# WSJT-X and JS8Call share their settings: point one at rigctld, with PTT by
|
# WSJT-X and JS8Call share their settings: point one at rigctld, with PTT by
|
||||||
# CAT. configure_qt_app NAME FILE PROCESS
|
# CAT, and at the radio's sound card in PipeWire. WSJT-X keeps the device's
|
||||||
|
# name in SoundInName; JS8Call keeps it in SoundInId, and its description in
|
||||||
|
# SoundInName. configure_qt_app NAME FILE PROCESS wsjtx|js8call
|
||||||
configure_qt_app() {
|
configure_qt_app() {
|
||||||
local name="$1" file="$2" rig net
|
local name="$1" file="$2" kind="$4" rig net in_key=SoundInName out_key=SoundOutName current_in current_out i
|
||||||
|
local keys=() values=()
|
||||||
|
SAID=() LEFT=()
|
||||||
if running "$3"; then
|
if running "$3"; then
|
||||||
report "$name" "skipped, because it's running and would overwrite its settings when it quits. Quit it and run \`radio configure\` again"
|
report "$name" "skipped, because it's running and would overwrite its settings when it quits. Quit it and run \`radio configure\` again"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rig="$(ini_get "$file" Configuration Rig)"
|
rig="$(ini_get "$file" Configuration Rig)"
|
||||||
net="$(ini_get "$file" Configuration CATNetworkPort)"
|
net="$(ini_get "$file" Configuration CATNetworkPort)"
|
||||||
if [ "$rig" = "Hamlib NET rigctl" ] && [ "$net" = "$RIGCTLD_ADDR" ]; then
|
if [ "$rig" = "Hamlib NET rigctl" ] && [ "$net" = "$RIGCTLD_ADDR" ]; then
|
||||||
report "$name" "already set up"
|
:
|
||||||
return
|
elif [ -z "$rig" ] || [ "$rig" = None ] || (( FORCE )); then
|
||||||
|
keys+=(Rig CATNetworkPort PTTMethod)
|
||||||
|
values+=("Hamlib NET rigctl" "$RIGCTLD_ADDR" "$PTT_CAT")
|
||||||
|
SAID+=("rig control through rigctld, PTT by CAT")
|
||||||
|
else
|
||||||
|
LEFT+=("its rig ($rig)")
|
||||||
fi
|
fi
|
||||||
if [ -n "$rig" ] && [ "$rig" != None ] && (( ! FORCE )); then
|
|
||||||
report "$name" "left alone: it's set up for $rig. \`radio configure --force\` replaces that"
|
if [ -n "$PW_IN_NAME" ]; then
|
||||||
return
|
[ "$kind" = wsjtx ] || { in_key=SoundInId out_key=SoundOutId; }
|
||||||
|
current_in="$(ini_get "$file" Configuration "$in_key")"
|
||||||
|
current_out="$(ini_get "$file" Configuration "$out_key")"
|
||||||
|
if [ "$current_in" = "$PW_IN_NAME" ] && [ "$current_out" = "$PW_OUT_NAME" ]; then
|
||||||
|
:
|
||||||
|
elif { is_default_device "$current_in" && is_default_device "$current_out"; } || (( FORCE )); then
|
||||||
|
keys+=("$in_key" "$out_key")
|
||||||
|
values+=("$PW_IN_NAME" "$PW_OUT_NAME")
|
||||||
|
if [ "$kind" = js8call ]; then
|
||||||
|
keys+=(SoundInName SoundOutName)
|
||||||
|
values+=("$(qt_ini_string "$PW_IN_DESC")" "$(qt_ini_string "$PW_OUT_DESC")")
|
||||||
|
fi
|
||||||
|
SAID+=("sound card \"$PW_OUT_DESC\"")
|
||||||
|
else
|
||||||
|
LEFT+=("its sound card (${current_in:-$current_out})")
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
back_up "$file"
|
|
||||||
if ! { ini_set "$file" Configuration Rig "Hamlib NET rigctl" &&
|
if [ ${#keys[@]} -gt 0 ]; then
|
||||||
ini_set "$file" Configuration CATNetworkPort "$RIGCTLD_ADDR" &&
|
back_up "$file"
|
||||||
ini_set "$file" Configuration PTTMethod "$PTT_CAT"; }; then
|
for i in "${!keys[@]}"; do
|
||||||
report "$name" "couldn't change $file"
|
ini_set "$file" Configuration "${keys[i]}" "${values[i]}" || { report "$name" "couldn't change $file"; return 1; }
|
||||||
return 1
|
done
|
||||||
fi
|
fi
|
||||||
report "$name" "rig control through rigctld, PTT by CAT"
|
say_changes "$name"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Pat: add rigctld to its rigs as "hampack", and use it for ARDOP and VARA
|
# Pat: add rigctld to its rigs as "hampack", and use it for ARDOP and VARA
|
||||||
@@ -899,39 +973,56 @@ configure_potacat() {
|
|||||||
report POTACAT "rig \"$1 (HamPack's rigctld)\" is rigctld, and active"
|
report POTACAT "rig \"$1 (HamPack's rigctld)\" is rigctld, and active"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Graywolf keeps its settings in graywolf.db, with PTT set per channel. Set
|
# Graywolf keeps its settings in graywolf.db. If it has no channels yet and
|
||||||
# PTT to rigctld on each channel that can transmit and has none (or, with
|
# the radio has a sound card, add input and output devices for the card and a
|
||||||
# --force, any other). graywolf_ptt check|BACKUP prints the number of
|
# channel using them, with Graywolf's defaults (1200 baud AFSK, APRS). Then
|
||||||
# channels to change (or changed), then the number left alone, or "none"
|
# set PTT to rigctld on each channel that can transmit and has none (or, with
|
||||||
# with no channel that transmits, or the error. With BACKUP, it makes the
|
# --force, any other). graywolf_setup check|BACKUP DEVICE CHANNEL_NAME prints
|
||||||
# changes, backing up the database through SQLite first, which includes
|
# "ADDED CHANGED KEPT": whether a channel is (or was) added, the number of
|
||||||
# what's still in graywolf.db-wal.
|
# channels whose PTT is (or was) changed, and the number left alone. Or it
|
||||||
graywolf_ptt() {
|
# prints "none" with no channel that transmits, or the error. With BACKUP it
|
||||||
|
# makes the changes, backing up the database through SQLite first, which
|
||||||
|
# includes what's still in graywolf.db-wal.
|
||||||
|
graywolf_setup() {
|
||||||
python3 -I -c '
|
python3 -I -c '
|
||||||
import datetime, sqlite3, sys
|
import datetime, sqlite3, sys
|
||||||
db, backup, addr, force = sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4] == "1"
|
db, backup, addr, force, device, channel_name = sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4] == "1", sys.argv[5], sys.argv[6]
|
||||||
try:
|
try:
|
||||||
con = sqlite3.connect(db)
|
con = sqlite3.connect(db)
|
||||||
|
add_channel = bool(device) and not con.execute("SELECT 1 FROM channels").fetchone()
|
||||||
channels = [row[0] for row in con.execute("SELECT id FROM channels WHERE output_device_id != 0 ORDER BY id")]
|
channels = [row[0] for row in con.execute("SELECT id FROM channels WHERE output_device_id != 0 ORDER BY id")]
|
||||||
if not channels:
|
if not channels and not add_channel:
|
||||||
print("none")
|
print("none")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
ptt = {row[0]: (row[1], row[2]) for row in con.execute("SELECT channel_id, method, device FROM ptt_configs")}
|
ptt = {row[0]: (row[1], row[2]) for row in con.execute("SELECT channel_id, method, device FROM ptt_configs")}
|
||||||
change, kept = [], 0
|
change, kept = [], 0
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
method, device = ptt.get(channel, ("none", ""))
|
method, ptt_device = ptt.get(channel, ("none", ""))
|
||||||
if (method, device) == ("rigctld", addr):
|
if (method, ptt_device) == ("rigctld", addr):
|
||||||
continue
|
continue
|
||||||
if method in ("none", "") or force:
|
if method in ("none", "") or force:
|
||||||
change.append(channel)
|
change.append(channel)
|
||||||
else:
|
else:
|
||||||
kept += 1
|
kept += 1
|
||||||
if change and backup != "check":
|
if backup != "check" and (change or add_channel):
|
||||||
copy = sqlite3.connect(backup)
|
copy = sqlite3.connect(backup)
|
||||||
con.backup(copy)
|
con.backup(copy)
|
||||||
copy.close()
|
copy.close()
|
||||||
now = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d %H:%M:%S.%f+00:00")
|
now = datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d %H:%M:%S.%f+00:00")
|
||||||
with con:
|
with con:
|
||||||
|
if add_channel:
|
||||||
|
ids = {}
|
||||||
|
for direction in ("input", "output"):
|
||||||
|
row = con.execute("SELECT id FROM audio_devices WHERE direction = ? AND source_type = ? AND source_path = ?",
|
||||||
|
(direction, "soundcard", device)).fetchone()
|
||||||
|
if row is None:
|
||||||
|
row = (con.execute("INSERT INTO audio_devices (name, direction, source_type, source_path, sample_rate, "
|
||||||
|
"channels, format, gain_db, created_at, updated_at) VALUES (?, ?, ?, ?, 48000, 1, ?, 0, ?, ?)",
|
||||||
|
(channel_name + " " + direction, direction, "soundcard", device, "s16le", now, now)).lastrowid,)
|
||||||
|
ids[direction] = row[0]
|
||||||
|
channel = con.execute("INSERT INTO channels (name, input_device_id, output_device_id, created_at, updated_at) "
|
||||||
|
"VALUES (?, ?, ?, ?, ?)", (channel_name, ids["input"], ids["output"], now, now)).lastrowid
|
||||||
|
change.append(channel)
|
||||||
for channel in change:
|
for channel in change:
|
||||||
if channel in ptt:
|
if channel in ptt:
|
||||||
con.execute("UPDATE ptt_configs SET method = ?, device = ?, updated_at = ? WHERE channel_id = ?",
|
con.execute("UPDATE ptt_configs SET method = ?, device = ?, updated_at = ? WHERE channel_id = ?",
|
||||||
@@ -940,15 +1031,19 @@ try:
|
|||||||
con.execute("INSERT INTO ptt_configs (channel_id, method, device, gpio_pin, ptt_method, gpio_line, "
|
con.execute("INSERT INTO ptt_configs (channel_id, method, device, gpio_pin, ptt_method, gpio_line, "
|
||||||
"invert, slot_time_ms, persist, dwait_ms, created_at, updated_at) "
|
"invert, slot_time_ms, persist, dwait_ms, created_at, updated_at) "
|
||||||
"VALUES (?, ?, ?, 0, 0, 0, 0, 10, 63, 0, ?, ?)", (channel, "rigctld", addr, now, now))
|
"VALUES (?, ?, ?, 0, 0, 0, 0, 10, 63, 0, ?, ?)", (channel, "rigctld", addr, now, now))
|
||||||
print(len(change), kept)
|
change = [c for c in change if c in channels]
|
||||||
|
print(int(add_channel), len(change), kept)
|
||||||
except (sqlite3.Error, OSError) as e:
|
except (sqlite3.Error, OSError) as e:
|
||||||
print(e)
|
print(e)
|
||||||
' "$GRAYWOLF_DB" "$1" "$RIGCTLD_ADDR" "$FORCE"
|
' "$GRAYWOLF_DB" "$1" "$RIGCTLD_ADDR" "$FORCE" "$2" "$3"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# configure_graywolf CARD NAME, where CARD is ALSA's name for the radio's
|
||||||
|
# sound card (hw:CARD=CODEC), or nothing
|
||||||
configure_graywolf() {
|
configure_graywolf() {
|
||||||
local result changed kept backup was_active=0 web="http://localhost:8080"
|
local result added changed kept backup was_active=0 web="http://localhost:8080" device=""
|
||||||
local manual="in its web UI ($web), set each channel's PTT to rigctld, $RIGCTLD_ADDR"
|
local manual="in its web UI ($web), set each channel's PTT to rigctld, $RIGCTLD_ADDR"
|
||||||
|
[ -z "$1" ] || device="plug$1,DEV=0"
|
||||||
if [ ! -x "$HOME/.local/bin/graywolf" ]; then
|
if [ ! -x "$HOME/.local/bin/graywolf" ]; then
|
||||||
report Graywolf "not installed"
|
report Graywolf "not installed"
|
||||||
return
|
return
|
||||||
@@ -957,9 +1052,9 @@ configure_graywolf() {
|
|||||||
report Graywolf "skipped: it has no settings yet. Open its web UI ($web) once, then \`radio configure\` again"
|
report Graywolf "skipped: it has no settings yet. Open its web UI ($web) once, then \`radio configure\` again"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
result="$(graywolf_ptt check)"
|
result="$(graywolf_setup check "$device" "$2")"
|
||||||
read -r changed kept <<< "$result"
|
read -r added changed kept <<< "$result"
|
||||||
if [[ "$changed" =~ ^[1-9][0-9]*$ ]]; then
|
if [ "$added" = 1 ] || [[ "$changed" =~ ^[1-9][0-9]*$ ]]; then
|
||||||
# It runs as a system service, and reads its settings when it starts
|
# It runs as a system service, and reads its settings when it starts
|
||||||
if systemctl is-active --quiet graywolf 2> /dev/null; then
|
if systemctl is-active --quiet graywolf 2> /dev/null; then
|
||||||
if ! sudo systemctl stop graywolf; then
|
if ! sudo systemctl stop graywolf; then
|
||||||
@@ -969,25 +1064,23 @@ configure_graywolf() {
|
|||||||
was_active=1
|
was_active=1
|
||||||
fi
|
fi
|
||||||
backup="$GRAYWOLF_DB.bak-$(date +%Y%m%d-%H%M%S)"
|
backup="$GRAYWOLF_DB.bak-$(date +%Y%m%d-%H%M%S)"
|
||||||
result="$(graywolf_ptt "$backup")"
|
result="$(graywolf_setup "$backup" "$device" "$2")"
|
||||||
(( ! was_active )) || sudo systemctl start graywolf
|
(( ! was_active )) || sudo systemctl start graywolf
|
||||||
read -r changed kept <<< "$result"
|
read -r added changed kept <<< "$result"
|
||||||
fi
|
fi
|
||||||
if [ "$changed" = none ]; then
|
if [ "$added" = none ]; then
|
||||||
report Graywolf "skipped: it has no channel that transmits yet. Add one in its web UI ($web) with PTT rigctld, $RIGCTLD_ADDR"
|
report Graywolf "skipped: it has no channel that transmits yet. Add one in its web UI ($web) with PTT rigctld, $RIGCTLD_ADDR"
|
||||||
elif ! [[ "$changed" =~ ^[0-9]+$ ]]; then
|
return
|
||||||
|
elif ! [[ "$added" =~ ^[01]$ ]]; then
|
||||||
report Graywolf "couldn't change $GRAYWOLF_DB: $result"
|
report Graywolf "couldn't change $GRAYWOLF_DB: $result"
|
||||||
return 1
|
return 1
|
||||||
elif (( changed == 0 && kept == 0 )); then
|
|
||||||
report Graywolf "already set up"
|
|
||||||
else
|
|
||||||
(( changed == 0 )) || BACKUPS+=("$backup")
|
|
||||||
local message=""
|
|
||||||
(( changed == 0 )) || message="PTT through rigctld on $changed channel$( ((changed == 1)) || echo s)"
|
|
||||||
(( kept == 0 )) ||
|
|
||||||
message="${message:+$message. }Left $kept channel$( ((kept == 1)) || echo s) with PTT of its own alone: \`radio configure --force\` replaces it"
|
|
||||||
report Graywolf "$message"
|
|
||||||
fi
|
fi
|
||||||
|
(( added == 0 && changed == 0 )) || BACKUPS+=("$backup")
|
||||||
|
SAID=() LEFT=()
|
||||||
|
(( added == 0 )) || SAID+=("a channel on the radio's sound card ($device), 1200 baud APRS, PTT through rigctld")
|
||||||
|
(( changed == 0 )) || SAID+=("PTT through rigctld on $changed$( (( added )) && echo " other") channel$( ((changed == 1)) || echo s)")
|
||||||
|
(( kept == 0 )) || LEFT+=("$kept channel$( ((kept == 1)) || echo s) with PTT of its own")
|
||||||
|
say_changes Graywolf
|
||||||
}
|
}
|
||||||
|
|
||||||
# Write and (re)start rigctld's user service: write_rigctld NAME HAMLIB PORT BAUD
|
# Write and (re)start rigctld's user service: write_rigctld NAME HAMLIB PORT BAUD
|
||||||
@@ -1084,6 +1177,10 @@ configure() {
|
|||||||
port="$(port_path "$ID_CAT_PORT")"
|
port="$(port_path "$ID_CAT_PORT")"
|
||||||
baud="$ID_BAUD"
|
baud="$ID_BAUD"
|
||||||
card="$(card_name "$radio")"
|
card="$(card_name "$radio")"
|
||||||
|
local card_number="" pipewire=0
|
||||||
|
card_number="$(card_of "$radio")"
|
||||||
|
card_number="${card_number#card}"
|
||||||
|
find_pipewire_nodes "$card_number" && pipewire=1
|
||||||
|
|
||||||
echo "Setting up the $name (Hamlib model $model), on $port at $baud baud"
|
echo "Setting up the $name (Hamlib model $model), on $port at $baud baud"
|
||||||
echo
|
echo
|
||||||
@@ -1096,12 +1193,12 @@ configure() {
|
|||||||
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
|
||||||
configure_qt_app WSJT-X "$WSJTX_CONF" wsjtx
|
configure_qt_app WSJT-X "$WSJTX_CONF" wsjtx wsjtx
|
||||||
else
|
else
|
||||||
report WSJT-X "not installed"
|
report WSJT-X "not installed"
|
||||||
fi
|
fi
|
||||||
if [ -x "$HOME/.local/bin/JS8Call" ]; then
|
if [ -x "$HOME/.local/bin/JS8Call" ]; then
|
||||||
configure_qt_app JS8Call "$JS8CALL_CONF" JS8Call
|
configure_qt_app JS8Call "$JS8CALL_CONF" JS8Call js8call
|
||||||
else
|
else
|
||||||
report JS8Call "not installed"
|
report JS8Call "not installed"
|
||||||
fi
|
fi
|
||||||
@@ -1111,16 +1208,18 @@ configure() {
|
|||||||
configure_not1mm
|
configure_not1mm
|
||||||
configure_qlog
|
configure_qlog
|
||||||
configure_potacat "$name"
|
configure_potacat "$name"
|
||||||
configure_graywolf
|
configure_graywolf "$card" "$name"
|
||||||
|
|
||||||
mkdir -p "$HAMPACK_STATE" &&
|
mkdir -p "$HAMPACK_STATE" &&
|
||||||
printf 'name=%s\nhamlib=%s\nport=%s\nbaud=%s\ncard=%s\n' "$name" "$model" "$port" "$baud" "$card" > "$HAMPACK_STATE/radio"
|
printf 'name=%s\nhamlib=%s\nport=%s\nbaud=%s\ncard=%s\n' "$name" "$model" "$port" "$baud" "$card" > "$HAMPACK_STATE/radio"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
if [ -n "$card" ]; then
|
if [ -z "$card" ]; then
|
||||||
echo "Choose the radio's sound card in the other programs yourself: $card, \"$(attr "${CARD_USB[$(card_of "$radio")]}" product)\"."
|
|
||||||
else
|
|
||||||
echo "No sound card was found with the radio: choose the one it's connected to in each program yourself."
|
echo "No sound card was found with the radio: choose the one it's connected to in each program yourself."
|
||||||
|
elif (( pipewire )); then
|
||||||
|
echo "Choose the radio's sound card yourself in fldigi, not1mm and POTACAT, which name it in ways radio can't: it's \"$PW_OUT_DESC\" ($card)."
|
||||||
|
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, fldigi, not1mm 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[@]}"; }
|
||||||
}
|
}
|
||||||
|
|||||||
+112
-3
@@ -15,6 +15,9 @@ setup() {
|
|||||||
ROOT_HUB="$RADIO_SYSFS/devices/pci0000:00/0000:00:14.0/usb1"
|
ROOT_HUB="$RADIO_SYSFS/devices/pci0000:00/0000:00:14.0/usb1"
|
||||||
REAL_PYTHON3="$(command -v python3)"
|
REAL_PYTHON3="$(command -v python3)"
|
||||||
export REAL_PYTHON3
|
export REAL_PYTHON3
|
||||||
|
# PipeWire's sources and sinks, as `pactl -f json list` prints them: none
|
||||||
|
# unless a test calls pipewire_card
|
||||||
|
stub pactl '[ -f "$FAKE_RADIOS/pw-$4" ] && cat "$FAKE_RADIOS/pw-$4" || echo "[]"'
|
||||||
mkdir -p "$ROOT_HUB" "$RADIO_SYSFS/class/tty" "$RADIO_SYSFS/class/sound" \
|
mkdir -p "$ROOT_HUB" "$RADIO_SYSFS/class/tty" "$RADIO_SYSFS/class/sound" \
|
||||||
"$RADIO_DEV/serial/by-id" "$RADIO_PROC" "$RADIO_LOCKDIR" "$FAKE_RADIOS"
|
"$RADIO_DEV/serial/by-id" "$RADIO_PROC" "$RADIO_LOCKDIR" "$FAKE_RADIOS"
|
||||||
}
|
}
|
||||||
@@ -73,6 +76,22 @@ yaesu() {
|
|||||||
card "$1/$1.2" "${5:-card1}" "${6:-CODEC}"
|
card "$1/$1.2" "${5:-card1}" "${6:-CODEC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# PipeWire lists ALSA card NUMBER as a USB codec, with a monitor source
|
||||||
|
# first, as PipeWire lists them: pipewire_card NUMBER [DESCRIPTION]
|
||||||
|
pipewire_card() {
|
||||||
|
local desc="${2:-USB Audio CODEC}"
|
||||||
|
jq -n --arg n "$1" --arg desc "$desc" '[
|
||||||
|
{name: "alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo.monitor", description: ("Monitor of " + $desc + " Analog Stereo"),
|
||||||
|
properties: {"alsa.card": $n, "device.class": "monitor"}},
|
||||||
|
{name: "alsa_input.pci-0000_00_1f.3.analog-stereo", description: "Built-in Audio Analog Stereo",
|
||||||
|
properties: {"alsa.card": "0", "device.class": "sound"}},
|
||||||
|
{name: "alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.mono-fallback", description: ($desc + " Mono"),
|
||||||
|
properties: {"alsa.card": $n, "device.class": "sound"}}]' > "$FAKE_RADIOS/pw-sources"
|
||||||
|
jq -n --arg n "$1" --arg desc "$desc" '[
|
||||||
|
{name: "alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo", description: ($desc + " Analog Stereo"),
|
||||||
|
properties: {"alsa.card": $n, "device.class": "sound"}}]' > "$FAKE_RADIOS/pw-sinks"
|
||||||
|
}
|
||||||
|
|
||||||
# The radio on a port answers the probe with ANSWER ("38400 cat_id 0670")
|
# The radio on a port answers the probe with ANSWER ("38400 cat_id 0670")
|
||||||
answers() {
|
answers() {
|
||||||
echo "$2" > "$FAKE_RADIOS/$1"
|
echo "$2" > "$FAKE_RADIOS/$1"
|
||||||
@@ -401,8 +420,13 @@ graywolf_db() {
|
|||||||
import sqlite3, sys
|
import sqlite3, sys
|
||||||
con = sqlite3.connect(sys.argv[1])
|
con = sqlite3.connect(sys.argv[1])
|
||||||
con.execute("PRAGMA journal_mode = WAL")
|
con.execute("PRAGMA journal_mode = WAL")
|
||||||
|
con.execute("CREATE TABLE audio_devices (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, direction TEXT NOT NULL DEFAULT 'input', "
|
||||||
|
"source_type TEXT NOT NULL, source_path TEXT, sample_rate INTEGER NOT NULL DEFAULT 48000, channels INTEGER NOT NULL DEFAULT 1, "
|
||||||
|
"format TEXT NOT NULL DEFAULT 's16le', gain_db REAL NOT NULL DEFAULT 0, created_at DATETIME, updated_at DATETIME)")
|
||||||
con.execute("CREATE TABLE channels (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, input_device_id INTEGER, "
|
con.execute("CREATE TABLE channels (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, input_device_id INTEGER, "
|
||||||
"input_channel INTEGER NOT NULL DEFAULT 0, output_device_id INTEGER NOT NULL DEFAULT 0, enabled NUMERIC NOT NULL DEFAULT true)")
|
"input_channel INTEGER NOT NULL DEFAULT 0, output_device_id INTEGER NOT NULL DEFAULT 0, output_channel INTEGER NOT NULL DEFAULT 0, "
|
||||||
|
"modem_type TEXT NOT NULL DEFAULT 'afsk', bit_rate INTEGER NOT NULL DEFAULT 1200, mode TEXT NOT NULL DEFAULT 'aprs', "
|
||||||
|
"created_at DATETIME, updated_at DATETIME, enabled NUMERIC NOT NULL DEFAULT true)")
|
||||||
con.execute("CREATE TABLE ptt_configs (id INTEGER PRIMARY KEY AUTOINCREMENT, channel_id INTEGER NOT NULL UNIQUE, "
|
con.execute("CREATE TABLE ptt_configs (id INTEGER PRIMARY KEY AUTOINCREMENT, channel_id INTEGER NOT NULL UNIQUE, "
|
||||||
"method TEXT NOT NULL DEFAULT 'none', device TEXT, gpio_pin INTEGER, ptt_method INTEGER NOT NULL DEFAULT 0, "
|
"method TEXT NOT NULL DEFAULT 'none', device TEXT, gpio_pin INTEGER, ptt_method INTEGER NOT NULL DEFAULT 0, "
|
||||||
"gpio_line INTEGER NOT NULL DEFAULT 0, invert NUMERIC NOT NULL DEFAULT false, slot_time_ms INTEGER NOT NULL DEFAULT 10, "
|
"gpio_line INTEGER NOT NULL DEFAULT 0, invert NUMERIC NOT NULL DEFAULT false, slot_time_ms INTEGER NOT NULL DEFAULT 10, "
|
||||||
@@ -430,7 +454,7 @@ DIREWOLF_CONF() { echo "$HAMPACK_STATE/conf.d/direwolf.conf"; }
|
|||||||
grep -qx "ExecStart=/usr/bin/rigctld -m 3073 -r /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_IC-7300_03001234-if00-port0 -s 38400 -T 127.0.0.1 -t 4532" "$unit"
|
grep -qx "ExecStart=/usr/bin/rigctld -m 3073 -r /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_IC-7300_03001234-if00-port0 -s 38400 -T 127.0.0.1 -t 4532" "$unit"
|
||||||
grep -qx "systemctl --user enable hampack-rigctld" "$STUB_LOG"
|
grep -qx "systemctl --user enable hampack-rigctld" "$STUB_LOG"
|
||||||
grep -qx "systemctl --user restart hampack-rigctld" "$STUB_LOG"
|
grep -qx "systemctl --user restart hampack-rigctld" "$STUB_LOG"
|
||||||
[[ "$output" == *"Choose the radio's sound card in the other programs yourself: hw:CARD=CODEC, \"USB Audio CODEC\""* ]]
|
[[ "$output" == *"PipeWire didn't list the radio's sound card, hw:CARD=CODEC (\"USB Audio CODEC\"), so choose it yourself in WSJT-X, JS8Call, fldigi, not1mm and POTACAT."* ]]
|
||||||
grep -qx "hamlib=3073" "$HAMPACK_STATE/radio"
|
grep -qx "hamlib=3073" "$HAMPACK_STATE/radio"
|
||||||
grep -qx "card=hw:CARD=CODEC" "$HAMPACK_STATE/radio"
|
grep -qx "card=hw:CARD=CODEC" "$HAMPACK_STATE/radio"
|
||||||
}
|
}
|
||||||
@@ -483,7 +507,7 @@ DIREWOLF_CONF() { echo "$HAMPACK_STATE/conf.d/direwolf.conf"; }
|
|||||||
printf '[Configuration]\nRig=Yaesu FT-991\nCATSerialPort=/dev/ttyUSB3\n' > "$(mkdir -p "$(dirname "$(WSJTX_INI)")"; WSJTX_INI)"
|
printf '[Configuration]\nRig=Yaesu FT-991\nCATSerialPort=/dev/ttyUSB3\n' > "$(mkdir -p "$(dirname "$(WSJTX_INI)")"; WSJTX_INI)"
|
||||||
run bash "$REPO/radio" configure
|
run bash "$REPO/radio" configure
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[[ "$output" == *"WSJT-X: left alone: it's set up for Yaesu FT-991. \`radio configure --force\` replaces that"* ]]
|
[[ "$output" == *"WSJT-X: Left its rig (Yaesu FT-991) alone: \`radio configure --force\` replaces it"* ]]
|
||||||
grep -qx "Rig=Yaesu FT-991" "$(WSJTX_INI)"
|
grep -qx "Rig=Yaesu FT-991" "$(WSJTX_INI)"
|
||||||
|
|
||||||
run bash "$REPO/radio" configure --force
|
run bash "$REPO/radio" configure --force
|
||||||
@@ -803,3 +827,88 @@ con = sqlite3.connect(sys.argv[1]); con.execute("INSERT INTO ptt_configs (channe
|
|||||||
[[ "$output" == *"Graywolf: skipped: couldn't stop it to change its settings. Instead, in its web UI (http://localhost:8080), set each channel's PTT to rigctld, 127.0.0.1:4532"* ]]
|
[[ "$output" == *"Graywolf: skipped: couldn't stop it to change its settings. Instead, in its web UI (http://localhost:8080), set each channel's PTT to rigctld, 127.0.0.1:4532"* ]]
|
||||||
[ "$(qlog_query "SELECT COUNT(*) FROM ptt_configs" "$(GRAYWOLF_DB)")" = 0 ]
|
[ "$(qlog_query "SELECT COUNT(*) FROM ptt_configs" "$(GRAYWOLF_DB)")" = 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# --- sound cards ---
|
||||||
|
|
||||||
|
@test "configure gives WSJT-X the radio's sound card as PipeWire names it" {
|
||||||
|
configurable
|
||||||
|
pipewire_card 1
|
||||||
|
run bash "$REPO/radio" configure
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "$output" == *"WSJT-X: rig control through rigctld, PTT by CAT, sound card \"USB Audio CODEC Analog Stereo\""* ]]
|
||||||
|
grep -qx "SoundInName=alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.mono-fallback" "$(WSJTX_INI)"
|
||||||
|
grep -qx "SoundOutName=alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo" "$(WSJTX_INI)"
|
||||||
|
[[ "$output" == *"Choose the radio's sound card yourself in fldigi, not1mm and POTACAT, which name it in ways radio can't: it's \"USB Audio CODEC Analog Stereo\" (hw:CARD=CODEC)."* ]]
|
||||||
|
|
||||||
|
run bash "$REPO/radio" configure
|
||||||
|
[[ "$output" == *"WSJT-X: already set up"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "configure gives JS8Call the sound card's PipeWire name and description, quoted as Qt would" {
|
||||||
|
configurable
|
||||||
|
pipewire_card 1 "Radio, USB"
|
||||||
|
run bash "$REPO/radio" configure
|
||||||
|
grep -qx "SoundInId=alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.mono-fallback" "$HOME/.config/JS8Call.ini"
|
||||||
|
grep -qx "SoundOutId=alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo" "$HOME/.config/JS8Call.ini"
|
||||||
|
grep -qx 'SoundInName="Radio, USB Mono"' "$HOME/.config/JS8Call.ini"
|
||||||
|
grep -qx 'SoundOutName="Radio, USB Analog Stereo"' "$HOME/.config/JS8Call.ini"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "configure replaces a default sound device, but not one you chose, unless --force" {
|
||||||
|
configurable
|
||||||
|
pipewire_card 1
|
||||||
|
mkdir -p "$(dirname "$(WSJTX_INI)")"
|
||||||
|
printf '[Configuration]\nSoundInName=pipewire\nSoundOutName=pipewire\n' > "$(WSJTX_INI)"
|
||||||
|
run bash "$REPO/radio" configure
|
||||||
|
grep -qx "SoundInName=alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.mono-fallback" "$(WSJTX_INI)"
|
||||||
|
|
||||||
|
printf '[Configuration]\nRig=Hamlib NET rigctl\nCATNetworkPort=127.0.0.1:4532\nSoundInName=alsa_input.usb-Other\nSoundOutName=alsa_output.usb-Other\n' > "$(WSJTX_INI)"
|
||||||
|
run bash "$REPO/radio" configure
|
||||||
|
[[ "$output" == *"WSJT-X: Left its sound card (alsa_input.usb-Other) alone: \`radio configure --force\` replaces it"* ]]
|
||||||
|
grep -qx "SoundInName=alsa_input.usb-Other" "$(WSJTX_INI)"
|
||||||
|
|
||||||
|
run bash "$REPO/radio" configure --force
|
||||||
|
grep -qx "SoundOutName=alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo" "$(WSJTX_INI)"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "configure leaves sound devices alone when PipeWire doesn't list the radio's card" {
|
||||||
|
configurable
|
||||||
|
pipewire_card 7
|
||||||
|
run bash "$REPO/radio" configure
|
||||||
|
[[ "$output" == *"WSJT-X: rig control through rigctld, PTT by CAT"$'\n'* ]]
|
||||||
|
! grep -q "^SoundInName=" "$(WSJTX_INI)"
|
||||||
|
[[ "$output" == *"PipeWire didn't list the radio's sound card"* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "configure adds a Graywolf channel on the radio's sound card when it has none" {
|
||||||
|
configurable
|
||||||
|
rm "$(GRAYWOLF_DB)"*
|
||||||
|
graywolf_db
|
||||||
|
run bash "$REPO/radio" configure
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "$output" == *"Graywolf: a channel on the radio's sound card (plughw:CARD=CODEC,DEV=0), 1200 baud APRS, PTT through rigctld"* ]]
|
||||||
|
[ "$(qlog_query "SELECT id, direction, source_type, source_path, sample_rate, channels FROM audio_devices ORDER BY id" "$(GRAYWOLF_DB)")" = "$(printf '1|input|soundcard|plughw:CARD=CODEC,DEV=0|48000|1\n2|output|soundcard|plughw:CARD=CODEC,DEV=0|48000|1')" ]
|
||||||
|
[ "$(qlog_query "SELECT name, input_device_id, output_device_id, modem_type, bit_rate, mode FROM channels" "$(GRAYWOLF_DB)")" = "Icom IC-7300|1|2|afsk|1200|aprs" ]
|
||||||
|
[ "$(qlog_query "SELECT channel_id, method, device FROM ptt_configs" "$(GRAYWOLF_DB)")" = "1|rigctld|127.0.0.1:4532" ]
|
||||||
|
grep -qx "systemctl stop graywolf" "$STUB_LOG"
|
||||||
|
|
||||||
|
run bash "$REPO/radio" configure
|
||||||
|
[[ "$output" == *"Graywolf: already set up"* ]]
|
||||||
|
[ "$(qlog_query "SELECT COUNT(*) FROM channels" "$(GRAYWOLF_DB)")" = 1 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "configure doesn't add a Graywolf channel without a sound card, or beside channels you made" {
|
||||||
|
configurable
|
||||||
|
rm "$(GRAYWOLF_DB)"*
|
||||||
|
graywolf_db 1:0
|
||||||
|
run bash "$REPO/radio" configure
|
||||||
|
[[ "$output" == *"Graywolf: skipped: it has no channel that transmits yet"* ]]
|
||||||
|
[ "$(qlog_query "SELECT COUNT(*) FROM channels" "$(GRAYWOLF_DB)")" = 1 ]
|
||||||
|
|
||||||
|
rm "$(GRAYWOLF_DB)"*
|
||||||
|
graywolf_db
|
||||||
|
rm -r "$RADIO_SYSFS/class/sound/card1"
|
||||||
|
run bash "$REPO/radio" configure
|
||||||
|
[[ "$output" == *"Graywolf: skipped: it has no channel that transmits yet"* ]]
|
||||||
|
[ "$(qlog_query "SELECT COUNT(*) FROM channels" "$(GRAYWOLF_DB)")" = 0 ]
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user