From 1e353191bcb9f5eb7c8b33aa2c168ffb17f8aa41 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Thu, 26 Jan 2023 08:35:45 -0600 Subject: [PATCH] Make Kenwood rigs wake up serial port on PS command Failing get_powerstat will now return RIG_OK https://github.com/Hamlib/Hamlib/issues/1226 --- rigs/kenwood/kenwood.c | 5 ++++- rigs/kenwood/kenwood.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/rigs/kenwood/kenwood.c b/rigs/kenwood/kenwood.c index cac9d1417..c3baa04cd 100644 --- a/rigs/kenwood/kenwood.c +++ b/rigs/kenwood/kenwood.c @@ -320,6 +320,9 @@ transaction_write: /* flush anything in the read buffer before command is sent */ rig_flush(&rs->rigport); + // PS command may need to wake up serial port + if (strncmp(cmd, "PS", 2) == 0) { write_block(&rs->rigport, (unsigned char *) ";;;;", 4); } + retval = write_block(&rs->rigport, (unsigned char *) cmd, len); free(cmd); @@ -4847,7 +4850,7 @@ int kenwood_set_powerstat(RIG *rig, powerstat_t status) rig->state.rigport.retry = 0; retval = kenwood_transaction(rig, - (status == RIG_POWER_ON) ? ";;;;PS1;" : "PS0", + (status == RIG_POWER_ON) ? "PS1;" : "PS0;", NULL, 0); if (status == RIG_POWER_ON) // wait for wakeup only diff --git a/rigs/kenwood/kenwood.h b/rigs/kenwood/kenwood.h index 9d268e07d..a193a69dd 100644 --- a/rigs/kenwood/kenwood.h +++ b/rigs/kenwood/kenwood.h @@ -29,7 +29,7 @@ #include "misc.h" #include "idx_builtin.h" -#define BACKEND_VER "20230225" +#define BACKEND_VER "20230226" #define EOM_KEN ';' #define EOM_TH '\r'