kopia lustrzana https://github.com/Hamlib/Hamlib
Un-break hamlib on TM-D710/TM-V71/etc
Commit d1e0e3f
introduced a `remove_nonprint` method that breaks hamlib on
all TM-D710/TM-V71A devices by erroneously removing the command termination
character (`\r`).
This commit adopts a solution proposed by @GeoBaltz that only runs
`remove_nonprint` if the command termination character itself is printable.
Resolves: #1767 #1698
pull/1768/head
rodzic
aca0b2d1c6
commit
85c9e15eac
|
@ -231,6 +231,12 @@ struct confparams kenwood_cfg_params[] =
|
||||||
{ RIG_CONF_END, NULL, }
|
{ RIG_CONF_END, NULL, }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// This function removes non-printable characters from a buffer. This was
|
||||||
|
// implemented to work around a problem reported with the uSDX transceiver
|
||||||
|
// [1], which emulates the Kenwood TS-480 but apparently generates garbage
|
||||||
|
// on the serial port in some situations.
|
||||||
|
//
|
||||||
|
// [1]: https://github.com/Hamlib/Hamlib/issues/1652
|
||||||
static int remove_nonprint(char *s)
|
static int remove_nonprint(char *s)
|
||||||
{
|
{
|
||||||
int i, j = 0;
|
int i, j = 0;
|
||||||
|
@ -443,9 +449,14 @@ transaction_read:
|
||||||
rig_debug(RIG_DEBUG_TRACE, "%s: read_string len=%d '%s'\n", __func__,
|
rig_debug(RIG_DEBUG_TRACE, "%s: read_string len=%d '%s'\n", __func__,
|
||||||
(int)strlen(buffer), buffer);
|
(int)strlen(buffer), buffer);
|
||||||
|
|
||||||
// this fixes the case when some corrupt data is returned
|
// This fixes the case when some corrupt data is returned; it lets us be a
|
||||||
// let's us be a little more robust about funky serial data
|
// little more robust about funky serial data. If the terminator is
|
||||||
|
// printable(usually ';'), then there should be no nonprintables in the
|
||||||
|
// message; if it isn't (usually '\r') then don't touch the message.
|
||||||
|
if (isprint(caps->cmdtrm))
|
||||||
|
{
|
||||||
remove_nonprint(buffer);
|
remove_nonprint(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue