Set up older Yaesus with radio configure --model, without asking them
The FT-817, FT-818, FT-857 and FT-897 have no ID command, and take every five bytes they're sent as a command, so radio doesn't probe them: --model sets one up on its only serial port, at the CAT rate it comes with (baud= in radios.conf), or --baud's. Where nothing answered, radio says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4794c186ee
commit
d910982ea7
@@ -6,7 +6,7 @@
|
||||
#
|
||||
# Usage : radio [detect] [--probe]
|
||||
# radio probe PORT
|
||||
# radio configure [--force] [--model N] [--flrig] [--no-cat --ptt HOW] [NUMBER]
|
||||
# radio configure [--force] [--model N [--baud RATE]] [--flrig] [--no-cat --ptt HOW] [NUMBER]
|
||||
# radio configure --auto
|
||||
# radio unconfigure
|
||||
# radio help
|
||||
@@ -25,6 +25,8 @@ LOCKDIR="${RADIO_LOCKDIR:-/run/lock}"
|
||||
# plugged in, in seconds
|
||||
AUTO_WAIT="${RADIO_AUTO_WAIT:-10}"
|
||||
AUTO=0
|
||||
# What to say where nothing answered, for the radios that can't be asked
|
||||
UNASKABLE_HINT="An FT-817, FT-818, FT-857 or FT-897 can't be asked what it is: give its Hamlib model, as in \`radio configure --model 1020\` for an FT-817 (\`rigctl -l\` lists them)."
|
||||
# CAT baud rates to try, most likely first
|
||||
BAUDS=(38400 115200 19200 9600 4800)
|
||||
|
||||
@@ -76,7 +78,10 @@ Usage: radio [detect] [--probe]
|
||||
Quit those programs first
|
||||
--force Replace rig settings you've set yourself
|
||||
--model N Use Hamlib model N (\`rigctl -l\`), for a radio that radio
|
||||
can't tell apart from others, or doesn't know
|
||||
can't tell apart from others, or doesn't know. Radios it
|
||||
can't ask (an FT-817, FT-818, FT-857 or FT-897) are set up
|
||||
without asking them, at the CAT rate they come with
|
||||
--baud RATE The CAT rate of a radio radio can't ask, if you've changed it
|
||||
--flrig Put flrig in charge of the radio, with rigctld passing the
|
||||
other programs through it. flrig then has to be running
|
||||
for them to reach the radio
|
||||
@@ -578,6 +583,7 @@ detect() {
|
||||
echo " Run \`radio detect --probe\` to ask it what it is"
|
||||
elif (( ID_ASKED )); then
|
||||
echo " Nothing answered. If it's a radio, check it's switched on and its CAT rate is one of ${BAUDS[*]} baud. Interfaces like the Digirig answer only for a radio behind them"
|
||||
echo " $UNASKABLE_HINT"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -608,6 +614,7 @@ probe() {
|
||||
return 1
|
||||
else
|
||||
echo "Nothing answered on $port at ${BAUDS[*]} baud"
|
||||
echo "$UNASKABLE_HINT"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -1610,6 +1617,7 @@ hamlib_name() {
|
||||
configure() {
|
||||
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
|
||||
local want_baud="" unaskable=""
|
||||
FORCE=0 BACKUPS=() USE_FLRIG=0
|
||||
if [ "${1:-}" = --auto ]; then
|
||||
[ $# -eq 1 ] || { usage >&2; return 2; }
|
||||
@@ -1629,6 +1637,10 @@ configure() {
|
||||
[[ "${2:-}" =~ ^[0-9]+$ ]] || { usage >&2; return 2; }
|
||||
model="$2"
|
||||
shift ;;
|
||||
--baud)
|
||||
[[ "${2:-}" =~ ^[0-9]+$ ]] || { usage >&2; return 2; }
|
||||
want_baud="$2"
|
||||
shift ;;
|
||||
[1-9]*)
|
||||
[[ "$1" =~ ^[0-9]+$ ]] || { usage >&2; return 2; }
|
||||
number="$1" ;;
|
||||
@@ -1673,6 +1685,22 @@ configure() {
|
||||
echo "With no CAT, rigctld doesn't talk to the radio, so --model doesn't apply."
|
||||
return 2
|
||||
fi
|
||||
# A radio radio can't ask what it is, nor at what rate it answers
|
||||
if [ -n "$model" ] && (( ! no_cat )); then
|
||||
unaskable="$(hamlib_name "$model")"
|
||||
[ -n "$unaskable" ] && [ -n "$(conf_field "$unaskable" baud)" ] || unaskable=""
|
||||
fi
|
||||
if [ -n "$want_baud" ] && [ -z "$unaskable" ]; then
|
||||
echo "--baud is for a radio radio can't ask, such as an FT-817 (\`radio configure --model 1020 --baud 9600\`): it finds other radios' rate by asking them."
|
||||
return 2
|
||||
fi
|
||||
if [ -n "$unaskable" ] && [ -n "$radio" ]; then
|
||||
read -ra ID_PORTS <<< "${RADIO_PORTS[$radio]}"
|
||||
if [ ${#ID_PORTS[@]} -ne 1 ]; then
|
||||
echo "The $unaskable can't be asked which of ${ID_PORTS[*]} it's on, and radio won't guess. Set it up in each program yourself."
|
||||
return 2
|
||||
fi
|
||||
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
|
||||
@@ -1735,12 +1763,23 @@ configure() {
|
||||
vox)
|
||||
ptt_text="PTT by VOX: the radio keys itself on the audio" ;;
|
||||
esac
|
||||
elif [ -n "$unaskable" ]; then
|
||||
# Its only port, at the rate it comes with: it can't be asked either
|
||||
name="$unaskable"
|
||||
port="$(port_path "${ID_PORTS[0]}")"
|
||||
baud="${want_baud:-$(conf_field "$name" baud)}"
|
||||
card_sys="$(card_of "$radio")"
|
||||
if (( USE_FLRIG )); then
|
||||
flrig_name="$(conf_field "$name" flrig)"
|
||||
flrig_port="$(fltk_get "$FLRIG_DIR/$flrig_name.prefs" xmlport)"
|
||||
flrig_port="${flrig_port:-12345}"
|
||||
fi
|
||||
else
|
||||
identify "$radio" always
|
||||
if [ -z "$ID_CAT_PORT" ]; then
|
||||
echo "Couldn't set it up: nothing answered on ${ID_PORTS[*]}."
|
||||
[ ${#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. If the radio has no CAT, \`radio configure --no-cat --ptt HOW\` sets it up to be keyed."
|
||||
(( ! 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. $UNASKABLE_HINT"
|
||||
(( ! was_running )) || systemctl --user start hampack-rigctld
|
||||
return 1
|
||||
fi
|
||||
@@ -1785,6 +1824,7 @@ configure() {
|
||||
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")"
|
||||
[ -z "$unaskable" ] || echo "It can't be asked what it is, so check it's a $name, and that its CAT RATE menu says $baud (or give --baud)."
|
||||
fi
|
||||
echo
|
||||
local rigctld=""
|
||||
|
||||
Reference in New Issue
Block a user