This flag can be used by back ends that need to take special action
while the rig is transmitting e.g. the FT-747GX and similar that do
not process CAT commands while transmitting.
The flag is also used as a default answer to rig_get_ptt if nothing
better is available.
Deal with inaccurate CAT query for Rx/Tx on the Yaesu FT-847
This rig doesn't set the Rx/Tx status flag when PTT is asserted via
the PTT pin on the rear PACKET socket so we need to override which we
can do if we known we have asserted PTT via rig_set_ptt().
Adjust style and fix set PTT defects
Fix a warning from a declaration of a deleted function definition
When the PTT serial port is not the control port the intention is to
free the port when PTT is reset so that other applications can share
it. This logic was faulty with attempts to call port functions on an
unopened port when repeatedly calling the rig_set_ptt API.
Thanks to Christoph van Wullen, DL1YCF, for finding and analyzing this
defect.
When using separate serial port for PTT via RTS pr DTR it is
convienent to close the port when the PTT line is not asserted. This
allows other applications to share the PTT serial port.
This has been achieved by ensuring that file descriptor for the port
is set to -1 when the port is closed, this then allows the invalid FD
to be used as a PTT surrogate for the rig_get_ptt API when the port is
only being used for PTT.
This patch changes rig_list_foreach such that the called function may
call rig_unregister without having to access freed memory. This avoids
a valgrind MemCheck and makes it possible to clean up teh rig_list
database.
This change allows the set_mode functions to leave the rig passband
unchanged if required. For the few rigs that do not have explcit
passband width control either current state is read and rewritten or a
"normal" width is chosen e.g. select a normal width when there is a
choice like CW and CW-NARROW.
CAT protocols that don't allow direct addressing of VFOs require that
the "other" VFO be queried or set via a select then get/set then
select back to original or swap then get/set then swap again. When
both frequncy and mode need to be set the sequences can be optimized
if a single funciton is avaiable.
This enhancement adds those single functions rig_set_split_freq_mode()
and rig_get_split_freq_mode() with a default impelementation that
calls the individual rig_{get,set}_split_{freq,mode}() functions. Back
ends can choose to implement an optimized version which is used
instead of the default if present.
Using these functions when an optimized implementation is available
allows the TX VFO's frequency and mode to be set in a single operation
with only one VFO exchange or selection either side of the
operation. Many CAT protocols are very efficient when getting or
setting both frequency and mode and some even combine the two in a
single command.
The letters 'K' and 'k' are used for the rigctl short command name for
these functions.
Some distributions--Debian and Alpine tested--put libusb.h under the
libusb-1.0 directory. Test for its presence and if found define
HAVE_LIBUSB_1_0_LIBUSB_H. Also test for HAVE_LIBUSB or
HAVE_LIBUSB_1_0_LIBUSB_H and conditionally include the correct header
file in the sources.
As Hamlib now restores the rig auto information state (AI) on exit
there is now a need to disable that functionality so that rigctl can
be used to set/reset AI mode on the rig explicitly.
A new public API function 'rig_no_restore_ai()' is also added that
allows any client to disable this auto AI restore functionality if
required. Most clients should do nothing as restoring AI state is a
good thing.
This means that rigctl & rigctld now work with default arguments on a
modern Windows machine with dual stack and localhost being [::1] as
the first interface returned by getaddrinfo().
Try all the interfaces return by DNS lookups to establish a connection
or listening port. Handle Windows network errors correctly so that
meaningful messages are printed.
The rigctl program now accepts IPv6 numeric addresses in the portname
field like [<addr>}:<port> for example the IPv6 loopback on port 4531
would be [::1]:4531.
The previous commit introduced a regression that masks any error
return from opening the serial port used for PTT when that port is
different from the CAT serial port.
Before this change only the line used for PTT was being lowered on
open. It is necessary for platforms other than Windows to avoid
issues with other uses of the line not used for PTT such as interfaces
that wire-or RTS and DTR together or use it for CW or FSK keying. This
is because platforms other than Windows raise both DTR and RTS on
serial port opening.
Also changed code that opens CAT port to lower RTS or DTR if it is
used for PTT. In this case there is no need to lower the other line of
DTR or RTS as there is already a config parameter to control it
(dtr_state or rts_state). This change is necessary to maintain current
functionality.
The serial port line control functions take a boolean argument not a
ptt_t argument. Changed usage in rig_open() to use a explicit zero
instead of RIG_PTT_OFF value which only coincidentally happens to be
zero.
Buffer size is now an input parameter only as the return data length
is implicit since a null terminated C string is returned. Better
precondition checks are impelmented.
Many APIs emulate direct VFO addressing by using caps->set_vfo() or
caps->vfo_op(..., RIG_OP_TOGGLE) to simulate direct addressing of a
non-current VFO. The mirrored function call to revert back to the
original current VFO was not checking for errors. This is not
unreasonable but it turns out that some rigs can arbitarily fail doing
VFO changes or swaps (e.g. Yaesu FT-450).
I have added checks to these calls but only fail with the error if the
API call being wrapped does not fail itself. This allows the mirroring
VFO operation to be completed, if possible, even if the wrapped
function could not be completed, hence as before, making every effort
not to change the rig state unnecessarily.
The read_string() function was changed to return a -RIG_ETIMEOUT error
when timing out after having read some characters. This caused a back
end to fail because it was using a read_string() with an invalid stop
character and relying on the timed out read_string() to fetch the
data. This patch reverts to the prior behavior of returning a null
terminated buffer and read bytes count if at least one byte has been
read.
Fix bytes read count accumulation in Windows serial I/O.
read_string from communications port doesn't handle timeout on
anything but the first character read.
Honour VMIN tty parameter correctly.
When a serial control line (DTR or RTS) is used for PTT control the
rig_open() function clears the PTT control line after opening the
port. This is necessary on Linux because opening the port sets them
both as part of the normal RS-232 protocol. The lines were not being
cleared when the PTT port was the same port as the CAT control port.
I have a problem with the CM119A GPIO. The PTT line of the DMK
Engineering URI was not activated by the hamlib when using fldigi or
rigctl.
I fiddled with the source code and managed to edit the code in cm108.c
to get the PTT-line activate on my URI-box.
A successful rigctl command is:
rigctl -p /dev/hidraw0 -C ptt_pathname=/dev/hidraw0,ptt_type=CM108,ptt_bitnum=2
Attached is the modified source code file and a patch in 'git diff'
format.
The version of origin is 1.2.15.3.
73 de Veijo OH3NFC
Signed-off-by: Nate Bargmann <n0nb@n0nb.us>
The Icom IC-7100 back end added this enum instead of using the extant
RIG_PTT_RIG enum. Also the rig_get_ptt() implementation didn't handle
it and errored out.
Note: RIG_PTT_SERIAL_CAT was added in commit
e9ee671149 - N0NB