Add client_version for rigctld clients to report their version to rigctld

This should allow for rigctld to report deprecation, compatibility, or alternatives
https://github.com/Hamlib/Hamlib/issues/1153
pull/1215/head
Mike Black W9MDB 2022-12-23 23:39:20 -06:00
rodzic 70f38022b6
commit 4689a2ff11
4 zmienionych plików z 34 dodań i 2 usunięć

5
NEWS
Wyświetl plik

@ -14,6 +14,7 @@ Version 5.x -- future
Version 4.6
* 2023-11-XX -- Planned for Nov 2023
* Add client_version to rigctld so client can report it's version for future use/compatility/alternatives
* Add --set-conf=tuner_control_pathname=hamlib_tuner_control (default)
If file exists then it will be called with 0/1 (Off/On) argument
with 'U TUNER 0' or 'U TUNER 1"
@ -23,11 +24,13 @@ Version 4.6
* Fix FTDX3000 rig split
Version 4.5.2
* 2022-12-23
* Fix PowerSDR ability to do commands while powered off
* Fix TX-500 operations
* Fix FTDX5000 to return to MIC input on closing
* Fix rig.c calling rig_get_mode when backend does not have get_mode
* Fix kenwood_ts890_get_level
* Add Prosistel D elevation CBOX az to fix problem with azimuth control
* 2022-12-XX -- Planned for Dec 2022
* Fix FT736R gpredict usage by adding cached get_freq
* Fix get_powerstat problem with Log4OM/Flex and others
* Fix -R option to not need argument

Wyświetl plik

@ -1321,6 +1321,11 @@ Examples:
send_raw -1 0xFE;0xFE;0x94;0x03;0xFD
send_raw 14 0xFE;0xFE;0x94;0x03;0xFD
.
.TP
.BR client_version " \(aq" \fIString\fP "\(aq
.EX
Client can send it's version to rigctld and get feedback on compatibility, deprecation, and alternatives
.
.SH READLINE
.
If

Wyświetl plik

@ -2589,6 +2589,7 @@ struct rig_state {
int lock_mode; /*<! flag that prevents mode changes if ~= 0 -- see set/get_lock_mode */
powerstat_t powerstat; /*<! power status */
char *tuner_control_pathname; /*<! Path to external tuner control program that get 0/1 (Off/On) argument */
char client_version[32]; /*<! Allow client to report version for compatility checks/capability */
};
//! @cond Doxygen_Suppress

Wyświetl plik

@ -259,6 +259,7 @@ declare_proto_rig(get_separator);
declare_proto_rig(set_lock_mode);
declare_proto_rig(get_lock_mode);
declare_proto_rig(send_raw);
declare_proto_rig(client_version);
/*
@ -372,6 +373,7 @@ static struct test_table test_list[] =
{ 0xa2, "set_lock_mode", ACTION(set_lock_mode), ARG_IN | ARG_NOVFO, "Locked" },
{ 0xa3, "get_lock_mode", ACTION(get_lock_mode), ARG_NOVFO, "Locked" },
{ 0xa4, "send_raw", ACTION(send_raw), ARG_NOVFO | ARG_IN1 | ARG_IN2 | ARG_OUT3, "Terminator", "Command", "Send raw answer" },
{ 0xa5, "client_version", ACTION(client_version), ARG_NOVFO | ARG_IN1, "Version", "Client version" },
{ 0x00, "", NULL },
};
@ -674,6 +676,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
char arg2[MAXARGSZ + 1], *p2 = NULL;
char arg3[MAXARGSZ + 1], *p3 = NULL;
vfo_t vfo = RIG_VFO_CURR;
char client_version[32];
rig_debug(RIG_DEBUG_TRACE, "%s: called, interactive=%d\n", __func__,
interactive);
@ -1753,7 +1756,9 @@ readline_repeat:
&& cmd_entry->cmd != 0x8f // dump_state
&& cmd_entry->cmd != 0xf0 // chk_vfo
&& cmd_entry->cmd != 0x87 // set_powerstat
&& my_rig->caps->rig_model != RIG_MODEL_POWERSDR) // some rigs can do stuff when powered off
&& cmd_entry->cmd != 0xa5 // client_version
&& my_rig->caps->rig_model !=
RIG_MODEL_POWERSDR) // some rigs can do stuff when powered off
{
rig_debug(RIG_DEBUG_WARN,
"%s: command %s not allowed when rig is powered off\n", __func__,
@ -1778,6 +1783,10 @@ readline_repeat:
p2 ? p2 : "",
p3 ? p3 : "");
}
// we need to copy client_version to our thread in case there are multiple client versions
// client_version is used to determine any backward compatiblity requirements or problems
strncpy(client_version, my_rig->state.client_version, sizeof(client_version));
}
@ -1855,6 +1864,20 @@ void version()
printf("%s\n", hamlib_copyright);
}
declare_proto_rig(client_version)
{
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
{
fprintf(fout, "%s: ", cmd->arg1);
}
fprintf(fout, "%s%c", arg1, resp_sep);
strncpy(rig->state.client_version, arg1, sizeof(rig->state.client_version) - 1);
rig_debug(RIG_DEBUG_VERBOSE, "%s: client_version=%s\n", __func__,
rig->state.client_version);
return RIG_OK;
}
void usage_rig(FILE *fout)
{