The Dummy backend retained caller-owned string pointers in its parameter
array, leaving BANDSELECT and KEYERTYPE dangling after the caller returned.
Deep-copy string parameters, release replacements during cleanup, and add
set/get ownership regressions for both string-valued parameters.
On the FTX-1, WFM is a bit special: Inside the 76-108 MHz WFM band the
radio is set to WFM by sending the normal FM mode code (MD...4), and
when read back the MD reply carries P2='0', which newcat_get_mode cannot
map and so returns -RIG_EPROTO. Override get_mode/set_mode with ftx1
wrappers:
- ftx1_get_mode: on -RIG_EPROTO with mode '0', verify the current VFO
frequency falls in a WFM rx range (rx_range_list), and if so report
RIG_MODE_WFM instead of the protocol error.
- ftx1_set_mode: when asked for RIG_MODE_WFM, reject it (-RIG_EINVAL)
outside the WFM range, and inside the range translate it to
RIG_MODE_FM with RIG_PASSBAND_NOCHANGE (let the radio apply its WFM
bandwidth).
- ftx1_check_freq_wfm(): helper scanning rx_range_list for a WFM-typed
entry covering the given frequency.
This commit includes WFM (Wide Frequency Modulation) in the frequency
table for the Yaesu FTX-1 rig. The frequency ranges are updated to
reflect the correct modes for each range, ensuring that WFM is properly
recognized and handled by the rig's capabilities. This change also
adds filter bandwidth information for WFM.
ftx1_set_rptr_offs() converted the requested offset into the EX menu's
step count with a truncating integer division, so any offset that was
not an exact multiple of the step was silently programmed as a smaller
one, with nothing returned to tell the caller it had been changed.
Round to the nearest step instead.
Also reject a negative offset up front. The offset is a magnitude --
direction comes from set_rptr_shift -- and truncation towards zero
meant a small negative value was accepted as "no offset" rather than
rejected, while a larger one failed later in the menu range check.
Verified on an FTX-1 (Optima) on 144 MHz, with #2110 applied so the
step is the correct 50 kHz:
set_rptr_offs 625000 -> 650000 (exactly half a step, rounds up)
set_rptr_offs 630000 -> 650000
set_rptr_offs 620000 -> 600000
set_rptr_offs 624999 -> 600000
set_rptr_offs 600000 -> 600000 (exact, unchanged)
set_rptr_offs -600000 -> -RIG_EINVAL, menu value left untouched
The truncation is present independently of #2110 -- that PR only makes
it easier to hit by correcting the 144/430 MHz step to 50 kHz.
Require the response command, VFO selector, numeric payload, and terminator to match the requested S-meter frame. Reject malformed or mismatched replies without changing the output value.
Correct several issues in the FTX-1 CTCSS/DCS implementation:
* Add DCS code table (ftx1_dcs_codes[]) and index<->code conversion
helpers (ftx1_code_to_dcs_num/ftx1_dcs_num_to_code). Previously
set_dcs_code/get_dcs_code passed the raw DCS code value (e.g. 023)
directly to the CN command, which expects a 0-based table index
(000-103). The code value is now converted to/from the index on
set/get respectively.
* Fix CN command parameter documentation. P1 is the VFO selector
(0=Main/1=Sub), not a TX/RX selector as previously stated.
* Simplify set/get_ctcss_sql to delegate to set/get_ctcss_tone, and
set/get_dcs_sql to delegate to set/get_dcs_code. The FTX-1 does not
support separate TX/RX tones or DCS codes, so the previous
CN10/CN11 (Sub VFO) usage was incorrect.
* Add RIG_FUNC_CSQL support in set_func/get_func and rig caps,
mapping it to the CT3 (DCS) mode via FTX1_CTCSS_MODE_DCS.
PMR-171 and Q900 can return the private filter width when a mode query
falls back to cached state. Initialize it to RIG_PASSBAND_NORMAL during
backend setup.
Require exact clarifier and extended-menu response structure, validate numeric conversions and terminators, and reject signed or out-of-range meter values.
Stop Icom tuning-step lookup at each table sentinel and bound Gemini status fields without letting truncated scans cancel valid matches. Parse GS100 newline-delimited response lines until its exact non-terminated prompt while enforcing response and line-count limits.
The raw value of frequency offset for 144 MHz and 430 MHz band is in
50 kHz unit, and the available range is from 0 to 100 MHz.
Tested on real hardware.
Fixes: 2c0ba29d53 ("FTX-1: Fix capability gaps - DCD, CWPITCH, RPTR_OFFS, BAND_UP/DOWN")
Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
Malformed K3/K3S SW and K4 TM replies could leave parsed meter
fields uninitialized. The K4 SWR path also discarded helper failures.
Reject incomplete conversions with RIG_EPROTO and return K4 transaction
and parse errors to callers.
dummy_get_level() copied a full value_t into result pointers even when
rig_get_strength() passed an int-sized buffer, overflowing the caller.
Copy only the integer or float member selected by the level while
retaining memcpy() for targets with weaker alignment.
Fixes: 5805de6e1e ("dummy/dummy.c: Fix unaligned access in dummy_get_level()")
NET rigctl and Quisk reused an old loop index while parsing
peer-provided AGC levels, which could write past the fixed array.
Use a shared bounded parser that truncates the list to the array
capacity and ignores malformed fields without failing the connection.
Fixes: 652e12a446 ("Fix cppcheck style")
Hardware-verified on an FTX-1 + ATAS-120A: with an ATAS selected, the general
AC000 stop is rejected ('?'), and because newcat does not read the AC reply
that '?' leaked into the next command. Route RIG_FUNC_TUNER off by the active
antenna's tuner type — AC120 for ATAS, AC000 otherwise — matching rad-con.
ftx1_set/get_tuner claimed "AC is status-only", gated everything behind
SPA-1, wrote 0/1 into EX030104 (the general select, not an on/off), and
returned ENIMPL for tune. Replace with the hardware-tested AC model:
- get_tuner: read AC and report P3 != '0' (tune active), like rad-con
Power.isTuning(); no SPA-1 gate.
- set_tuner: mode 0 -> AC000 (stop/bypass); mode 1 -> no-op (the FTX-1 has no
persistent tuner-on toggle; select type via ext-parms, tune via RIG_OP_TUNE).
- Add ftx1_atas_ctrl() (AC120 stop / AC121 up / AC122 down / AC123 start),
mirroring rad-con's AtasTunerProvider, exposed as the write-only ATAS_CTRL
ext-parm (synthetic non-menu token, dispatched directly).
The driver conflated GENERAL TUNER SELECT (EX030104, 0=Option/1=ATAS) with
the per-antenna tuner type (EX030701/2, 0=INT/1=INT_FAST/2=EXT/3=ATAS) and
gated EXT/ATAS selection + HF antenna select behind SPA-1. On a field head
(or any head with an ATAS/EXT antenna) that wrongly blocked tuner setup.
- GEN_TUNER_SELECT: range 0-3 -> 0-1 (Option/ATAS), in both the menu table
(set-time validation) and the ext-parm descriptor (caps.extparms).
- OPT_TUNER_ANT1/ANT2 + OPT_HF_ANT_SEL: drop FTX1_MENU_FLAG_SPA1 — EXT/ATAS
tuning and antenna select work on any head; only INT/INT_FAST need SPA-1,
which the radio enforces itself. Power-limit items (EX030705-11) stay gated.
- Fix the ftx1_ext.c guardrail (EX030104 no longer SPA-1-gated; the OPTION
gate now applies only to power items >= 5) and the header/tuner_select docs.
Menu model hardware-verified on an FTX-1 + ATAS-120A: EX030704=ANT1,
EX030701=ATAS matched the physical setup.
RIG_OP_TUNE sent AC110, which the radio rejects with '?;' (P3=0 is
off/stop, not a tune start) — so `vfo_op TUNE` never tuned. Verified on an
FTX-1 + ATAS-120A: AC110 -> '?;' while AC123 starts an ATAS auto-tune.
Send the tune form for the tuner type selected on the active antenna:
AC123 (P2=2 ATAS, P3=3 start) for ATAS, AC103 (external-port start) for
INT/INT_FAST/EXT, defaulting to AC103 on read failure. Drop the SPA-1 gate
here: EXT/ATAS tune on any head type; only INT/INT(FAST) need SPA-1, which
the radio enforces itself.
Add ftx1_get_effective_tuner_type() (active antenna EX030704 -> per-antenna
type EX030701/2), mirroring the hardware-tested rad-con model.
Misplaced close-paren in if statement caused "IF" command to be cached,
even if rig settings were changed. Note that the last if-clause would
never be evaluated as true due to the strlen() in the first clause.
Add runtime-selectable dual-mode operation to the AnyTone AT-D578UVIII
backend via a -C commode= config flag on the existing model 37001.
Default mode (commode=0) uses the direct serial mic protocol for PTT
with no handshake and no radio display lockout. COM mode (commode=1)
uses the BT-01 ADATA protocol for PTT, get/set frequency, get/set VFO,
and set clock — the radio displays "EXTERNAL CABLE MODE" while connected.
The keepalive thread checks transaction_active before sending so that
raw commands via rigctld's w interface pass through without collision,
enabling third-party software to use undocumented ADATA commands through
the driver's managed session.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Note that variables x1cx03_possibly and x1ax03_supported are declared
and defined for several rigs, but those variables are not currently
referenced or tested in the code.