Start flrig at login after radio configure --flrig
--flrig adds an autostart entry, ~/.config/autostart/hampack-flrig.desktop, so flrig is running before the programs that reach the radio through rigctld and it. If an autostart entry of yours already runs flrig, none is added: two flrigs would fight over the port. Running it without --flrig removes the entry, since flrig would take the port from rigctld at login, and so does hampackremove. Both remove it only if it carries HamPack's mark (X-HamPack). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
53e748ccb9
commit
357f72583e
+35
-2
@@ -1091,7 +1091,7 @@ IC7300_PORT=/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Control
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "${lines[0]}" == *"at 38400 baud, through flrig" ]]
|
||||
[[ "$output" == *"rigctld: runs as the hampack-rigctld user service, on 127.0.0.1:4532, and passes everything to flrig"* ]]
|
||||
[[ "$output" == *"flrig: controls the IC-7300 on $IC7300_PORT at 38400 baud, PTT by CAT. Start it before the other programs, and leave it running"* ]]
|
||||
[[ "$output" == *"flrig: controls the IC-7300 on $IC7300_PORT at 38400 baud, PTT by CAT. It now starts when you log in; start it yourself this time, and leave it running"* ]]
|
||||
grep -qx "ExecStart=/usr/bin/rigctld -m 4 -r 127.0.0.1:12345 -T 127.0.0.1 -t 4532" "$HOME/.config/systemd/user/hampack-rigctld.service"
|
||||
# As FLTK writes it
|
||||
[ "$(head -5 "$(FLRIG_PREFS)")" = "$(printf '; FLTK preferences file format 1.0\n; vendor: w1hkj.com\n; application: flrig\n\n[.]')" ]
|
||||
@@ -1135,7 +1135,7 @@ IC7300_PORT=/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Control
|
||||
mkdir -p "$HOME/.flrig"
|
||||
printf '; FLTK preferences file format 1.0\n; vendor: w1hkj.com\n; application: flrig\n\n[.]\n\nxcvr_name:FT-991A\n' > "$(FLRIG_PREFS)"
|
||||
run bash "$REPO/radio" configure --flrig
|
||||
[[ "$output" == *"flrig: Left its radio (FT-991A) alone: \`radio configure --force\` replaces it"* ]]
|
||||
[[ "$output" == *"flrig: It now starts when you log in; start it yourself this time. Left its radio (FT-991A) alone: \`radio configure --force\` replaces it"* ]]
|
||||
grep -qx "xcvr_name:FT-991A" "$(FLRIG_PREFS)"
|
||||
|
||||
run bash "$REPO/radio" configure --flrig --force
|
||||
@@ -1156,3 +1156,36 @@ IC7300_PORT=/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Control
|
||||
[ ! -e "$HOME/.config/systemd/user/hampack-rigctld.service" ]
|
||||
|
||||
}
|
||||
|
||||
FLRIG_AUTOSTART() { echo "$HOME/.config/autostart/hampack-flrig.desktop"; }
|
||||
|
||||
@test "configure --flrig starts flrig when you log in, and stops that when rigctld takes the radio back" {
|
||||
configurable
|
||||
run bash "$REPO/radio" configure --flrig
|
||||
grep -qx "Exec=flrig" "$(FLRIG_AUTOSTART)"
|
||||
grep -qx "X-HamPack=radio configure --flrig" "$(FLRIG_AUTOSTART)"
|
||||
|
||||
run bash "$REPO/radio" configure --flrig
|
||||
[[ "$output" == *"flrig: already set up. It starts when you log in, and leave it running"* ]]
|
||||
|
||||
run bash "$REPO/radio" configure
|
||||
[[ "$output" == *"flrig: no longer starts when you log in, since rigctld has the radio's port again"* ]]
|
||||
[ ! -e "$(FLRIG_AUTOSTART)" ]
|
||||
run bash "$REPO/radio" configure
|
||||
[[ "$output" == *"flrig: not set up: it and rigctld can't both use the radio's port"* ]]
|
||||
}
|
||||
|
||||
@test "configure --flrig doesn't add a second autostart for flrig, or remove one that isn't HamPack's" {
|
||||
configurable
|
||||
mkdir -p "$HOME/.config/autostart"
|
||||
printf '[Desktop Entry]\nType=Application\nName=My flrig\nExec=/usr/bin/flrig --debug-level 2\n' > "$HOME/.config/autostart/my-flrig.desktop"
|
||||
run bash "$REPO/radio" configure --flrig
|
||||
[[ "$output" == *"PTT by CAT. It starts when you log in, from my-flrig.desktop, and leave it running"* ]]
|
||||
[ ! -e "$(FLRIG_AUTOSTART)" ]
|
||||
|
||||
# One of yours, under HamPack's name, without HamPack's mark
|
||||
printf '[Desktop Entry]\nType=Application\nExec=flrig\n' > "$(FLRIG_AUTOSTART)"
|
||||
run bash "$REPO/radio" configure
|
||||
[ -e "$(FLRIG_AUTOSTART)" ]
|
||||
[ -e "$HOME/.config/autostart/my-flrig.desktop" ]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user