kopia lustrzana https://github.com/Hamlib/Hamlib
astyle files
rodzic
1ef3549e94
commit
ca4814c472
|
@ -812,26 +812,31 @@ static int netrigctl_open(RIG *rig)
|
|||
}
|
||||
else if (strcmp(setting, "agc_levels") == 0)
|
||||
{
|
||||
int i=1;
|
||||
char *p = strtok(value," ");
|
||||
int i = 1;
|
||||
char *p = strtok(value, " ");
|
||||
rig->caps->agc_levels[0] = RIG_AGC_OFF;
|
||||
while(p)
|
||||
|
||||
while (p)
|
||||
{
|
||||
int agc_code;
|
||||
char agc_string[32];
|
||||
int n = sscanf(p, "%d=%s\n", &agc_code, agc_string);
|
||||
|
||||
if (n == 2)
|
||||
{
|
||||
rig->caps->agc_levels[i++] = agc_code;
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig has agc code=%d, level=%s\n", __func__, agc_code, agc_string);
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: rig has agc code=%d, level=%s\n", __func__,
|
||||
agc_code, agc_string);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s did not parse code=agc from '%s'\n", __func__, p);
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%d=%s\n", agc_code, agc_string);
|
||||
p = strtok(NULL, " ");
|
||||
}
|
||||
|
||||
rig->caps->agc_level_count = i;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -46,7 +46,7 @@ const struct rig_caps mds_9710_caps =
|
|||
{
|
||||
.startf = MHz(800), .endf = MHz(880), .modes = MDS_ALL_MODES,
|
||||
.startf = MHz(880), .endf = MHz(960), .modes = MDS_ALL_MODES,
|
||||
.low_power = 0, .high_power = 0, MDS_ALL_MODES, RIG_ANT_1,
|
||||
.low_power = 0, .high_power = 0, MDS_ALL_MODES, RIG_ANT_1,
|
||||
},
|
||||
RIG_FRNG_END,
|
||||
},
|
||||
|
|
|
@ -954,7 +954,7 @@ int HAMLIB_API write_block_sync(hamlib_port_t *p, const unsigned char *txbuffer,
|
|||
|
||||
if (p->asyncio)
|
||||
{
|
||||
return (int) write(p->fd_sync_write, txbuffer, count);
|
||||
return (int) write(p->fd_sync_write, txbuffer, count);
|
||||
}
|
||||
|
||||
return (int) write(p->fd, txbuffer, count);
|
||||
|
|
17
src/rig.c
17
src/rig.c
|
@ -7454,17 +7454,22 @@ HAMLIB_EXPORT(int) rig_send_raw(RIG *rig, const unsigned char *send,
|
|||
retval);
|
||||
RETURNFUNC(retval);
|
||||
}
|
||||
|
||||
if (nbytes >= reply_len)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: reply_len(%d) less than reply from rig(%d)\n", __func__, reply_len, nbytes);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: reply_len(%d) less than reply from rig(%d)\n",
|
||||
__func__, reply_len, nbytes);
|
||||
return -RIG_EINVAL;
|
||||
}
|
||||
memcpy(reply,buf,reply_len-1);
|
||||
}
|
||||
else
|
||||
RETURNFUNC(retval);
|
||||
|
||||
RETURNFUNC(nbytes > 0? nbytes:-RIG_EPROTO);
|
||||
memcpy(reply, buf, reply_len - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
RETURNFUNC(retval);
|
||||
}
|
||||
|
||||
RETURNFUNC(nbytes > 0 ? nbytes : -RIG_EPROTO);
|
||||
}
|
||||
|
||||
HAMLIB_EXPORT(int) rig_set_lock_mode(RIG *rig, int mode)
|
||||
|
|
|
@ -913,7 +913,8 @@ int rig_sprintf_agc_levels(RIG *rig, char *str, int lenstr)
|
|||
if (priv_caps && RIG_BACKEND_NUM(rig->caps->rig_model) == RIG_ICOM
|
||||
&& priv_caps->agc_levels_present)
|
||||
{
|
||||
for (i = 0; i <= HAMLIB_MAX_AGC_LEVELS && priv_caps->agc_levels[i].level != RIG_AGC_LAST
|
||||
for (i = 0; i <= HAMLIB_MAX_AGC_LEVELS
|
||||
&& priv_caps->agc_levels[i].level != RIG_AGC_LAST
|
||||
&& priv_caps->agc_levels[i].icom_level >= 0; i++)
|
||||
{
|
||||
if (strlen(str) > 0) { strcat(str, " "); }
|
||||
|
@ -936,7 +937,7 @@ int rig_sprintf_agc_levels(RIG *rig, char *str, int lenstr)
|
|||
{
|
||||
for (i = 0; i < HAMLIB_MAX_AGC_LEVELS && i < rig->caps->agc_level_count; i++)
|
||||
{
|
||||
if (strlen(str)>0) { strcat(str, " "); }
|
||||
if (strlen(str) > 0) { strcat(str, " "); }
|
||||
|
||||
sprintf(tmpbuf, "%d=%s", rig->caps->agc_levels[i],
|
||||
rig_stragclevel(rig->caps->agc_levels[i]));
|
||||
|
|
|
@ -319,12 +319,13 @@ int dumpcaps(RIG *rig, FILE *fout)
|
|||
rig_stragclevel(caps->agc_levels[i]));
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
//fprintf(fout, "\n");
|
||||
fprintf(fout, "AGC levels: ");
|
||||
char buf[1024];
|
||||
rig_sprintf_agc_levels(rig, buf, (int)sizeof(buf));
|
||||
fprintf(fout,"%s", buf);
|
||||
fprintf(fout, "%s", buf);
|
||||
#endif
|
||||
|
||||
if (i == 0)
|
||||
|
|
|
@ -24,11 +24,15 @@ main()
|
|||
printf("rig_open: error = %s\n", rigerror(retcode));
|
||||
exit(2);
|
||||
}
|
||||
|
||||
freq_t f;
|
||||
rig_get_freq(my_rig, RIG_VFO_A, &f);
|
||||
|
||||
int nbytes = rig_send_raw(my_rig, sendCmd, sendCmdLen, rcvdCmd, rcvdCmdLen, term);
|
||||
if (nbytes >= 0) printf("Response(%d bytes): %s\n", nbytes, rcvdCmd);
|
||||
else printf("Error occurred = %s\n", rigerror(retcode));
|
||||
int nbytes = rig_send_raw(my_rig, sendCmd, sendCmdLen, rcvdCmd, rcvdCmdLen,
|
||||
term);
|
||||
|
||||
if (nbytes >= 0) { printf("Response(%d bytes): %s\n", nbytes, rcvdCmd); }
|
||||
else { printf("Error occurred = %s\n", rigerror(retcode)); }
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue