kopia lustrzana https://github.com/Hamlib/Hamlib
Fix rotctld dumpcaps to expose client rot_type instead of Other
https://github.com/Hamlib/Hamlib/issues/1035pull/1148/head
rodzic
eeac97c725
commit
853806b978
|
@ -144,7 +144,7 @@ static int netrotctl_open(ROT *rot)
|
|||
}
|
||||
|
||||
rs->max_el = rot->caps->max_el = atof(buf);
|
||||
|
||||
|
||||
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
|
||||
sizeof("\n"), 0, 1);
|
||||
|
||||
|
@ -155,6 +155,23 @@ static int netrotctl_open(ROT *rot)
|
|||
|
||||
rs->south_zero = atoi(buf);
|
||||
|
||||
// Prot 1 is tag=value format
|
||||
if (prot_ver >= 1)
|
||||
{
|
||||
ret = read_string(&rot->state.rotport, (unsigned char *) buf, BUF_MAX, "\n",
|
||||
sizeof("\n"), 0, 1);
|
||||
|
||||
if (ret <= 0)
|
||||
{
|
||||
return (ret < 0) ? ret : -RIG_EPROTO;
|
||||
}
|
||||
|
||||
if (strstr(buf, "AzEl")) { rot->caps->rot_type = ROT_TYPE_AZEL; }
|
||||
else if (strstr(buf, "Az")) { rot->caps->rot_type = ROT_TYPE_AZIMUTH; }
|
||||
else if (strstr(buf, "El")) { rot->caps->rot_type = ROT_TYPE_ELEVATION; }
|
||||
}
|
||||
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -369,6 +369,14 @@ int main(int argc, char *argv[])
|
|||
rot_token_foreach(my_rot, print_conf_list, (rig_ptr_t)my_rot);
|
||||
}
|
||||
|
||||
retcode = rot_open(my_rot);
|
||||
|
||||
if (retcode != RIG_OK)
|
||||
{
|
||||
fprintf(stderr, "rot_open: error = %s \n", rigerror(retcode));
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print out capabilities, and exits immediately as we may be interested
|
||||
* only in caps, and rig_open may fail.
|
||||
|
@ -380,14 +388,6 @@ int main(int argc, char *argv[])
|
|||
exit(0);
|
||||
}
|
||||
|
||||
retcode = rot_open(my_rot);
|
||||
|
||||
if (retcode != RIG_OK)
|
||||
{
|
||||
fprintf(stderr, "rot_open: error = %s \n", rigerror(retcode));
|
||||
exit(2);
|
||||
}
|
||||
|
||||
my_rot->state.az_offset = az_offset;
|
||||
my_rot->state.el_offset = el_offset;
|
||||
|
||||
|
|
|
@ -2363,7 +2363,7 @@ declare_proto_rot(dump_state)
|
|||
/*
|
||||
* - Protocol version
|
||||
*/
|
||||
#define ROTCTLD_PROT_VER 0
|
||||
#define ROTCTLD_PROT_VER 1
|
||||
|
||||
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
|
||||
{
|
||||
|
@ -2414,6 +2414,21 @@ declare_proto_rot(dump_state)
|
|||
|
||||
fprintf(fout, "%d%c", rs->south_zero, resp_sep);
|
||||
|
||||
char *rtype = "Unknown";
|
||||
|
||||
switch (rot->caps->rot_type)
|
||||
{
|
||||
case ROT_TYPE_OTHER: rtype = "Other"; break;
|
||||
|
||||
case ROT_TYPE_AZIMUTH : rtype = "Az"; break;
|
||||
|
||||
case ROT_TYPE_ELEVATION : rtype = "El"; break;
|
||||
|
||||
case ROT_TYPE_AZEL : rtype = "AzEl"; break;
|
||||
}
|
||||
|
||||
fprintf(fout, "rot_type=%s%c", rtype, resp_sep);
|
||||
|
||||
return RIG_OK;
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue