Set POTACAT's sound card in radio configure
POTACAT keeps Chromium's device ids, which only it can see, with each device's name beside it, and when a saved id matches no device it takes the one device of that name when it starts (lib/audio-device-heal.js). So HamPack's rig gets PipeWire's names for the radio's card as those names, which is how Chromium names PipeWire's devices, and placeholder ids that match nothing. Only HamPack's rig gets a sound card; one you chose on it is left alone unless --force, which now keeps the rig's other settings. Every program that uses the radio's sound card now gets it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8020cdc061
commit
b2ffaf9592
+46
-2
@@ -791,7 +791,7 @@ DIREWOLF_CONF() { echo "$HAMPACK_STATE/conf.d/direwolf.conf"; }
|
||||
configurable
|
||||
echo '{"rigs": [{"id": "rig_1", "name": "FT710", "catTarget": {"type": "serial", "path": "/dev/ttyUSB3"}}], "activeRigId": "rig_1", "catTarget": {"type": "serial", "path": "/dev/ttyUSB3"}}' > "$(POTACAT_JSON)"
|
||||
run bash "$REPO/radio" configure
|
||||
[[ "$output" == *"POTACAT: left alone: it has a radio set up already"* ]]
|
||||
[[ "$output" == *"POTACAT: Left its own radio alone: \`radio configure --force\` replaces it"* ]]
|
||||
[ "$(jq -r .activeRigId "$(POTACAT_JSON)")" = rig_1 ]
|
||||
|
||||
FAKE_RUNNING=potacat run bash "$REPO/radio" configure --force
|
||||
@@ -857,7 +857,7 @@ con = sqlite3.connect(sys.argv[1]); con.execute("INSERT INTO ptt_configs (channe
|
||||
[[ "$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 POTACAT, which names it in a way radio can't: it's \"USB Audio CODEC Analog Stereo\" (hw:CARD=CODEC)."* ]]
|
||||
[[ "$output" == *"The radio's sound card is \"USB Audio CODEC Analog Stereo\" (hw:CARD=CODEC)."* ]]
|
||||
|
||||
run bash "$REPO/radio" configure
|
||||
[[ "$output" == *"WSJT-X: already set up"* ]]
|
||||
@@ -1027,3 +1027,47 @@ con = sqlite3.connect(sys.argv[1]); con.execute("INSERT INTO ptt_configs (channe
|
||||
[ "$status" -eq 0 ] || [ "$status" -eq 1 ]
|
||||
[[ -z "$output" ]] || [[ "$(head -1 <<< "$output")" == *$'\t'*$'\t'*$'\t'* ]]
|
||||
}
|
||||
|
||||
@test "configure gives POTACAT's rig the sound card by name, for POTACAT to find when it starts" {
|
||||
configurable
|
||||
pipewire_card 1
|
||||
run bash "$REPO/radio" configure
|
||||
[[ "$output" == *"POTACAT: rig \"Icom IC-7300 (HamPack's rigctld)\" is rigctld, and active, sound card \"USB Audio CODEC Analog Stereo\", which POTACAT finds by name when it starts"* ]]
|
||||
[ "$(jq -c '.rigs[0] | [.remoteAudioInput, .remoteAudioInputLabel, .remoteAudioOutput, .remoteAudioOutputLabel]' "$(POTACAT_JSON)")" = '["hampack:alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.mono-fallback","USB Audio CODEC Mono","hampack:alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo","USB Audio CODEC Analog Stereo"]' ]
|
||||
|
||||
run bash "$REPO/radio" configure
|
||||
[[ "$output" == *"POTACAT: already set up"* ]]
|
||||
|
||||
# POTACAT found the devices and stored their ids: still set up
|
||||
jq '.rigs[0].remoteAudioInput = "4f3a9c" | .rigs[0].remoteAudioOutput = "9b21e0"' "$(POTACAT_JSON)" > "$BATS_TEST_TMPDIR/p.json" && mv "$BATS_TEST_TMPDIR/p.json" "$(POTACAT_JSON)"
|
||||
run bash "$REPO/radio" configure
|
||||
[[ "$output" == *"POTACAT: already set up"* ]]
|
||||
[ "$(jq -r '.rigs[0].remoteAudioInput' "$(POTACAT_JSON)")" = 4f3a9c ]
|
||||
}
|
||||
|
||||
@test "configure leaves a sound card you chose on POTACAT's rig, unless --force" {
|
||||
configurable
|
||||
pipewire_card 1
|
||||
bash "$REPO/radio" configure > /dev/null
|
||||
jq '.rigs[0] += {remoteAudioInput: "77aa", remoteAudioInputLabel: "Other Mono", remoteAudioOutput: "88bb", remoteAudioOutputLabel: "Other Analog Stereo"}' "$(POTACAT_JSON)" > "$BATS_TEST_TMPDIR/p.json" && mv "$BATS_TEST_TMPDIR/p.json" "$(POTACAT_JSON)"
|
||||
run bash "$REPO/radio" configure
|
||||
[[ "$output" == *"POTACAT: Left its sound card alone"* ]]
|
||||
[ "$(jq -r '.rigs[0].remoteAudioInput' "$(POTACAT_JSON)")" = 77aa ]
|
||||
|
||||
run bash "$REPO/radio" configure --force
|
||||
[ "$(jq -r '.rigs[0].remoteAudioInputLabel' "$(POTACAT_JSON)")" = "USB Audio CODEC Mono" ]
|
||||
[ "$(jq -r '.rigs[0].name' "$(POTACAT_JSON)")" = "Icom IC-7300 (HamPack's rigctld)" ]
|
||||
}
|
||||
|
||||
@test "configure gives POTACAT no sound card for your own rig, or without PipeWire" {
|
||||
configurable
|
||||
pipewire_card 1
|
||||
echo '{"rigs": [{"id": "rig_1", "name": "FT710", "catTarget": {"type": "serial", "path": "/dev/ttyUSB3"}}], "activeRigId": "rig_1", "catTarget": {"type": "serial", "path": "/dev/ttyUSB3"}}' > "$(POTACAT_JSON)"
|
||||
run bash "$REPO/radio" configure
|
||||
[[ "$output" == *"POTACAT: Left its own radio alone"* ]]
|
||||
[ "$(jq -c '.rigs[0] | has("remoteAudioInput")' "$(POTACAT_JSON)")" = false ]
|
||||
|
||||
rm "$FAKE_RADIOS"/pw-*
|
||||
run bash "$REPO/radio" configure --force
|
||||
[ "$(jq -c '.rigs[1] | [.id, has("remoteAudioInput")]' "$(POTACAT_JSON)")" = '["rig_hampack",false]' ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user