I was seeing the symptoms reported in #1698. I spent some time debugging the code, and the problem is that by the time we reach this block of code:
|
if (strchr(cmdtrm_str, buffer[strlen(buffer) - 1]) == NULL) |
|
{ |
|
rig_debug(RIG_DEBUG_ERR, "%s: Command is not correctly terminated '%s'\n", |
|
__func__, buffer); |
|
|
|
if (retry_read++ < rp->retry) |
|
{ |
|
goto transaction_write; |
|
} |
|
|
|
retval = -RIG_EPROTO; |
|
goto transaction_quit; |
|
} |
We have already called remove_nonprint(buffer) at line 448:
|
// this fixes the case when some corrupt data is returned |
|
// let's us be a little more robust about funky serial data |
|
remove_nonprint(buffer); |
This strips the command termination character (\r), causing the "Check that command termination is correct" to always fail, effectively breaking hamlib for all TM-D710/TM-V71 type devices.
We can confirm this behavior by inspecting the value of buffer before and after the call to remove_nonprint:
Breakpoint 3, kenwood_transaction (rig=rig@entry=0x435d60, cmdstr=cmdstr@entry=0x7ffff740176e "ID", data=data@entry=0x7fffffffc300 "",
datasize=datasize@entry=128) at kenwood.c:443
443 rig_debug(RIG_DEBUG_TRACE, "%s: read_string len=%d '%s'\n", __func__,
(gdb) p buffer
$1 = "ID TM-V71\r", '\000' <repeats 117 times>
This is the rig_debug call just before the call to remove_nonprint; we can see that the buffer has the \r command termination character. After calling remove_nonprint...
(gdb) until 450
kenwood_transaction (rig=rig@entry=0x435d60, cmdstr=cmdstr@entry=0x7ffff740176e "ID", data=data@entry=0x7fffffffc300 "", datasize=datasize@entry=128)
at kenwood.c:450
450 if (retval < 0)
(gdb) p buffer
$2 = "ID TM-V71", '\000' <repeats 118 times>
...we see that the termination character has been dropped.
I was seeing the symptoms reported in #1698. I spent some time debugging the code, and the problem is that by the time we reach this block of code:
Hamlib/rigs/kenwood/kenwood.c
Lines 483 to 495 in aca0b2d
We have already called
remove_nonprint(buffer)at line 448:Hamlib/rigs/kenwood/kenwood.c
Lines 446 to 448 in aca0b2d
This strips the command termination character (
\r), causing the "Check that command termination is correct" to always fail, effectively breaking hamlib for all TM-D710/TM-V71 type devices.We can confirm this behavior by inspecting the value of
bufferbefore and after the call toremove_nonprint:This is the
rig_debugcall just before the call toremove_nonprint; we can see that the buffer has the\rcommand termination character. After callingremove_nonprint......we see that the termination character has been dropped.