kopia lustrzana https://github.com/Hamlib/Hamlib
Get firmware revision level from K3/KX3.
Signed-off-by: Nate Bargmann <n0nb@n0nb.us>Hamlib-1.2.14
rodzic
cd5950c2ac
commit
65d201455d
|
@ -58,7 +58,7 @@ const struct confparams elecraft_ext_levels[] = {
|
|||
/* Private function declarations */
|
||||
int verify_kenwood_id(RIG *rig, char *id);
|
||||
int elecraft_get_extension_level(RIG *rig, const char *cmd, int *ext_level);
|
||||
|
||||
int elecraft_get_firmware_revision_level(RIG *rig, const char *cmd, char *fw_rev);
|
||||
|
||||
/* Shared backend function definitions */
|
||||
|
||||
|
@ -118,6 +118,11 @@ int elecraft_open(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: K3 level is %d, %s\n", __func__,
|
||||
priv->k3_ext_lvl, elec_ext_id_str_lst[priv->k3_ext_lvl].id);
|
||||
|
||||
err = elecraft_get_firmware_revision_level(rig, "RVM", priv->k3_fw_rev);
|
||||
if (err != RIG_OK)
|
||||
return err;
|
||||
|
||||
break;
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: unrecognized rig model %d\n",
|
||||
|
@ -200,11 +205,47 @@ int elecraft_get_extension_level(RIG *rig, const char *cmd, int *ext_level)
|
|||
|
||||
if (strcmp(elec_ext_id_str_lst[i].id, bufptr) == 0) {
|
||||
*ext_level = elec_ext_id_str_lst[i].level;
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: Extension level is %d, %s\n",
|
||||
__func__, *ext_level, elec_ext_id_str_lst[i].id);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: %s extension level is %d, %s\n",
|
||||
__func__, cmd, *ext_level, elec_ext_id_str_lst[i].id);
|
||||
}
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
/* Determine firmware revision level */
|
||||
|
||||
int elecraft_get_firmware_revision_level(RIG *rig, const char *cmd, char *fw_rev)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
if (!rig || !fw_rev)
|
||||
return -RIG_EINVAL;
|
||||
|
||||
int err;
|
||||
char *bufptr;
|
||||
char buf[KENWOOD_MAX_BUF_LEN];
|
||||
size_t size = KENWOOD_MAX_BUF_LEN;
|
||||
|
||||
err = kenwood_transaction(rig, cmd, sizeof(cmd), buf, &size);
|
||||
if (err != RIG_OK) {
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Cannot get firmeware revision level\n", __func__);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Get the actual firmware revision number. */
|
||||
bufptr = &buf[0];
|
||||
|
||||
/* Skip the command string */
|
||||
bufptr += sizeof(cmd);
|
||||
|
||||
/* Ignore leading zero's */
|
||||
while (bufptr && *bufptr == '0') { bufptr++; }
|
||||
|
||||
/* Copy out */
|
||||
strncpy(fw_rev, bufptr, sizeof(bufptr));
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: Elecraft firmware revision is %s\n", __func__, fw_rev);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ struct kenwood_priv_data {
|
|||
int k2_ext_lvl; /* Initial K2 extension level */
|
||||
int k3_ext_lvl; /* Initial K3 extension level */
|
||||
int k2_md_rtty; /* K2 RTTY mode available flag, 1 = RTTY, 0 = N/A */
|
||||
char k3_fw_rev[KENWOOD_MAX_BUF_LEN]; /* K3 firmware revision level */
|
||||
};
|
||||
|
||||
#define kenwood_caps(rig) ((struct kenwood_priv_caps *)(rig)->caps->priv)
|
||||
|
|
Ładowanie…
Reference in New Issue