Un-break hamlib on TM-D710/TM-V71/etc#1768
Conversation
|
Rather than a complete reversion, would it be possible to not apply the |
Maybe! This revert will at least resolve the problem for people trying to use hamlib with impacted devices. We can certainly choose not to merge it, but now at least I can point people here who run into the same problem. To be clear: at the moment, hamlib is now completely broken on a variety of Kenwood devices. I'm sure it's possible to create a more nuanced solution to #1652, but that will take time and given severe nature of the problem I wanted to make this fix available.
The change was made in the context of Kenwood devices that use |
|
How about checking the expected command terminator(kenwood_priv_caps.cmdtrm) - if it is printable, remove the nonprintables. If it isn't printable, then don't. |
|
George, that's a much more elegant solution than my example in #1767 which only tests for |
|
Something like this - diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c
index 1596c2dfe..88655f2dd 100644
--- a/rigs/kenwood/kenwood.c
+++ b/rigs/kenwood/kenwood.c
@@ -445,7 +445,13 @@ transaction_read:
// 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);
+ // 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);
+ }
if (retval < 0)
{
|
|
Then again, yours might be correct if radios that use |
|
Lars, give George's patch preference over mine as it's likely correct in that radios that use |
|
Since the previous commit works for some devices but breaks others, maybe instead of reverting it entirely, we could keep the old behavior behind a ./configure flag (e.g., --enable-removenonprint or similar). This way, users who rely on the previous behavior can enable it explicitly, while the default remains compatible with the majority of devices. |
|
Hi @brightkill I think George's submission will work for both cases. Having to invoke One question I have for you related to issue #1652 is whether the device firmware was updated by the authors to remove the unprintable characters? |
2dac91d to
7bea004
Compare
|
@GeoBaltz I've updated this PR to adopt your proposed solution. |
7bea004 to
9e3c8a1
Compare
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: Hamlib#1767 Hamlib#1698
9e3c8a1 to
85c9e15
Compare
|
Thanks, Lars and George. This will be in tomorrow's daily snapshot. I will also cherry-pick this over into the Hamlib-4.6.3 branch for a bug fix 4.6.4 release in a few weeks. |
This reverts commit d1e0e3f.
That commit introduced a
remove_nonprintmethod that breaks hamlib on allTM-D710/TM-V71A devices by erroneously removing the command termination
character.
Resolves: #1767 #1698