kopia lustrzana https://github.com/Hamlib/Hamlib
Porównaj commity
17 Commity
17b9321310
...
d29caa7cad
Autor | SHA1 | Data |
---|---|---|
Mike Black W9MDB | d29caa7cad | |
Mike Black W9MDB | 267f30d16b | |
Mike Black W9MDB | 6ef2c457e4 | |
Mike Black W9MDB | 2efc2069f5 | |
Mike Black W9MDB | 703d86a025 | |
Mike Black W9MDB | c8e33010f6 | |
Mike Black W9MDB | 7fba4c012d | |
Michael Black | 10c002c13f | |
George Baltz N3GB | a0f8251b64 | |
Mike Black W9MDB | 9ed13add01 | |
Mike Black W9MDB | fabfe61a45 | |
Mike Black W9MDB | d8a9968fac | |
Mike Black W9MDB | 1b5fbc1d8b | |
Mike Black W9MDB | a4ff5a3e60 | |
Mike Black W9MDB | 83fa835864 | |
Michael Black | ceebaeae35 | |
George Baltz N3GB | 0145588fd9 |
2
NEWS
2
NEWS
|
@ -13,6 +13,8 @@ Version 5.x -- future
|
|||
* Change FT1000MP Mark V model names to align with FT1000MP
|
||||
|
||||
Version 4.6
|
||||
* Added macros for applications to obtain pointers to Hamlib structures(issues #1445, #1420, #487).
|
||||
Internal conversion is still a WIP, but use of these macros will make the final cutover transparent to applications.
|
||||
* Added Guohe Q900 entry
|
||||
* Unify behavior of all rigctl split commands
|
||||
* Make the set_split_* commands modify the state of the specified split VFO -- the current or targeted VFO do not have any effect
|
||||
|
|
|
@ -4572,7 +4572,7 @@ int kenwood_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
|
|||
}
|
||||
}
|
||||
|
||||
*tone = caps->ctcss_list[tone_idx] - kenwood_caps(rig)->tone_table_base;
|
||||
*tone = caps->ctcss_list[tone_idx - kenwood_caps(rig)->tone_table_base];
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
@ -4710,7 +4710,7 @@ int kenwood_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone)
|
|||
}
|
||||
}
|
||||
|
||||
*tone = caps->ctcss_list[tone_idx] - kenwood_caps(rig)->tone_table_base;
|
||||
*tone = caps->ctcss_list[tone_idx - kenwood_caps(rig)->tone_table_base];
|
||||
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
|
|
@ -387,7 +387,8 @@ const struct confparams newcat_cfg_params[] =
|
|||
/* NewCAT Internal Functions */
|
||||
static ncboolean newcat_is_rig(RIG *rig, rig_model_t model);
|
||||
|
||||
static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo, vfo_t *tx_vfo);
|
||||
static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo,
|
||||
vfo_t *tx_vfo);
|
||||
static int newcat_get_split(RIG *rig, split_t *split, vfo_t *tx_vfo);
|
||||
static int newcat_set_vfo_from_alias(RIG *rig, vfo_t *vfo);
|
||||
static int newcat_get_rx_bandwidth(RIG *rig, vfo_t vfo, rmode_t mode,
|
||||
|
@ -1328,7 +1329,26 @@ int newcat_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
// just drop through
|
||||
}
|
||||
|
||||
if (RIG_MODEL_FT450 == caps->rig_model)
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: is_ft991=%d, rig->state.cache.split=%d, vfo=%s\n",
|
||||
__func__, is_ft991, rig->state.cache.split, rig_strvfo(vfo));
|
||||
|
||||
if (is_ft991 && vfo == RIG_VFO_A)
|
||||
{
|
||||
if (rig->state.cache.split)
|
||||
{
|
||||
// FT991/991A bandstack does not work in split mode
|
||||
// so for a VFOA change we stop split, change bands, change freq, enable split
|
||||
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "FT2;BS%02d;FA%09.0f;FT3;",
|
||||
newcat_band_index(freq), freq);
|
||||
}
|
||||
else // in non-split us BS to get bandstack info
|
||||
{
|
||||
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "BS%02d;FA%09.0f;",
|
||||
newcat_band_index(freq), freq);
|
||||
}
|
||||
}
|
||||
|
||||
else if (RIG_MODEL_FT450 == caps->rig_model)
|
||||
{
|
||||
if (c == 'B')
|
||||
{
|
||||
|
@ -2729,9 +2749,12 @@ int newcat_set_split_vfo(RIG *rig, vfo_t vfo, split_t split, vfo_t tx_vfo)
|
|||
{
|
||||
RETURNFUNC(err);
|
||||
}
|
||||
if (newcat_60m_exception(rig, rig->state.cache.freqMainA, rig->state.cache.modeMainA))
|
||||
|
||||
if (newcat_60m_exception(rig, rig->state.cache.freqMainA,
|
||||
rig->state.cache.modeMainA))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: force set_split off since we're on 60M exception\n", __func__);
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
"%s: force set_split off since we're on 60M exception\n", __func__);
|
||||
split = RIG_SPLIT_OFF;
|
||||
//return RIG_OK; // fake the return code to make things happy
|
||||
}
|
||||
|
@ -2848,6 +2871,7 @@ int newcat_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
|
|||
}
|
||||
|
||||
err = -RIG_ENAVAIL;
|
||||
|
||||
if (newcat_valid_command(rig, "ST"))
|
||||
{
|
||||
err = newcat_get_split(rig, split, tx_vfo);
|
||||
|
@ -2863,7 +2887,7 @@ int newcat_get_split_vfo(RIG *rig, vfo_t vfo, split_t *split, vfo_t *tx_vfo)
|
|||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: tx_vfo=%s, curr_vfo=%s\n", __func__,
|
||||
rig_strvfo(*tx_vfo), rig_strvfo(rig->state.current_vfo));
|
||||
rig_strvfo(*tx_vfo), rig_strvfo(rig->state.current_vfo));
|
||||
|
||||
if (*tx_vfo != rig->state.current_vfo)
|
||||
{
|
||||
|
@ -6940,12 +6964,14 @@ int newcat_get_parm(RIG *rig, setting_t parm, value_t *val)
|
|||
RETURNFUNC(-RIG_ENAVAIL);
|
||||
}
|
||||
|
||||
static int newcat_set_maxpower(RIG *rig, vfo_t vfo, hamlib_token_t token, float val)
|
||||
static int newcat_set_maxpower(RIG *rig, vfo_t vfo, hamlib_token_t token,
|
||||
float val)
|
||||
{
|
||||
return -RIG_ENIMPL;
|
||||
}
|
||||
|
||||
static int newcat_get_maxpower(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val)
|
||||
static int newcat_get_maxpower(RIG *rig, vfo_t vfo, hamlib_token_t token,
|
||||
value_t *val)
|
||||
{
|
||||
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
int retval;
|
||||
|
@ -7060,7 +7086,8 @@ int newcat_set_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t val)
|
|||
}
|
||||
}
|
||||
|
||||
int newcat_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token, value_t *val)
|
||||
int newcat_get_ext_level(RIG *rig, vfo_t vfo, hamlib_token_t token,
|
||||
value_t *val)
|
||||
{
|
||||
struct newcat_priv_data *priv = (struct newcat_priv_data *)rig->state.priv;
|
||||
char *result;
|
||||
|
@ -8242,8 +8269,9 @@ int newcat_set_tx_vfo(RIG *rig, vfo_t tx_vfo)
|
|||
}
|
||||
|
||||
// NOTE: FT-450 only has toggle command so not sure how to definitively set the TX VFO (VS; doesn't seem to help either)
|
||||
if (is_ft950 || is_ft2000 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000 || is_ftdx1200 || is_ft991 ||
|
||||
is_ftdx10 || is_ftdx101d || is_ftdx101mp)
|
||||
if (is_ft950 || is_ft2000 || is_ftdx3000 || is_ftdx3000dm || is_ftdx5000
|
||||
|| is_ftdx1200 || is_ft991 ||
|
||||
is_ftdx10 || is_ftdx101d || is_ftdx101mp)
|
||||
{
|
||||
// These rigs use numbers 2 and 3 to denote A/B or Main/Sub VFOs - 0 and 1 are for toggling TX function
|
||||
p1 = p1 + 2;
|
||||
|
@ -8302,6 +8330,7 @@ int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo)
|
|||
{
|
||||
*tx_vfo = RIG_VFO_A;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case '1' :
|
||||
|
@ -8313,6 +8342,7 @@ int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo)
|
|||
{
|
||||
*tx_vfo = RIG_VFO_B;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -8340,7 +8370,8 @@ int newcat_get_tx_vfo(RIG *rig, vfo_t *tx_vfo)
|
|||
}
|
||||
|
||||
|
||||
static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo, vfo_t *tx_vfo)
|
||||
static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo,
|
||||
vfo_t *tx_vfo)
|
||||
{
|
||||
struct newcat_priv_data *priv = (struct newcat_priv_data *) rig->state.priv;
|
||||
char *command = "ST";
|
||||
|
@ -8349,7 +8380,8 @@ static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo, vfo_t *tx_vf
|
|||
|
||||
ENTERFUNC;
|
||||
|
||||
if (!newcat_valid_command(rig, "ST") || is_ft450 || priv->split_st_command_missing)
|
||||
if (!newcat_valid_command(rig, "ST") || is_ft450
|
||||
|| priv->split_st_command_missing)
|
||||
{
|
||||
RETURNFUNC(-RIG_ENAVAIL);
|
||||
}
|
||||
|
@ -8366,9 +8398,11 @@ static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo, vfo_t *tx_vf
|
|||
case RIG_SPLIT_OFF:
|
||||
p1 = '0';
|
||||
break;
|
||||
|
||||
case RIG_SPLIT_ON:
|
||||
p1 = '1';
|
||||
break;
|
||||
|
||||
default:
|
||||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
@ -8392,7 +8426,9 @@ static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo, vfo_t *tx_vf
|
|||
*rx_vfo = rig->state.current_vfo;
|
||||
*tx_vfo = rig->state.current_vfo;
|
||||
break;
|
||||
|
||||
case RIG_SPLIT_ON:
|
||||
|
||||
// These rigs have fixed RX and TX VFOs when using the ST split command
|
||||
if (is_ftdx101d || is_ftdx101mp)
|
||||
{
|
||||
|
@ -8409,12 +8445,15 @@ static int newcat_set_split(RIG *rig, split_t split, vfo_t *rx_vfo, vfo_t *tx_vf
|
|||
*rx_vfo = rig->state.current_vfo;
|
||||
|
||||
result = newcat_get_tx_vfo(rig, tx_vfo);
|
||||
|
||||
if (result != RIG_OK)
|
||||
{
|
||||
RETURNFUNC(result);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
@ -8432,7 +8471,8 @@ static int newcat_get_split(RIG *rig, split_t *split, vfo_t *tx_vfo)
|
|||
|
||||
ENTERFUNC;
|
||||
|
||||
if (!newcat_valid_command(rig, "ST") || is_ft450 || priv->split_st_command_missing)
|
||||
if (!newcat_valid_command(rig, "ST") || is_ft450
|
||||
|| priv->split_st_command_missing)
|
||||
{
|
||||
RETURNFUNC(-RIG_ENAVAIL);
|
||||
}
|
||||
|
@ -8440,6 +8480,7 @@ static int newcat_get_split(RIG *rig, split_t *split, vfo_t *tx_vfo)
|
|||
SNPRINTF(priv->cmd_str, sizeof(priv->cmd_str), "%s%c", command, cat_term);
|
||||
|
||||
result = newcat_get_cmd(rig);
|
||||
|
||||
if (result != RIG_OK)
|
||||
{
|
||||
priv->split_st_command_missing = 1;
|
||||
|
@ -8454,10 +8495,12 @@ static int newcat_get_split(RIG *rig, split_t *split, vfo_t *tx_vfo)
|
|||
*split = RIG_SPLIT_OFF;
|
||||
|
||||
result = newcat_get_tx_vfo(rig, tx_vfo);
|
||||
|
||||
if (result != RIG_OK)
|
||||
{
|
||||
RETURNFUNC(result);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case '1' :
|
||||
|
@ -8475,11 +8518,13 @@ static int newcat_get_split(RIG *rig, split_t *split, vfo_t *tx_vfo)
|
|||
else
|
||||
{
|
||||
result = newcat_get_tx_vfo(rig, tx_vfo);
|
||||
|
||||
if (result != RIG_OK)
|
||||
{
|
||||
RETURNFUNC(result);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
typedef char ncboolean;
|
||||
|
||||
/* shared function version */
|
||||
#define NEWCAT_VER "20240118"
|
||||
#define NEWCAT_VER "20240127"
|
||||
|
||||
/* Hopefully large enough for future use, 128 chars plus '\0' */
|
||||
#define NEWCAT_DATA_LEN 129
|
||||
|
|
|
@ -28,6 +28,9 @@ int keyspd = 20;
|
|||
int bandselect = 5;
|
||||
int width = 21;
|
||||
int narrow = 0;
|
||||
int vd = 0;
|
||||
int sm0 = 0;
|
||||
int sm1 = 0;
|
||||
|
||||
// ID 0310 == 310, Must drop leading zero
|
||||
typedef enum nc_rigid_e
|
||||
|
@ -330,6 +333,33 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
sscanf(buf, "NA0%d", &narrow);
|
||||
}
|
||||
else if (strncmp(buf, "VD;", 3) == 0)
|
||||
{
|
||||
sprintf(buf, "VD%d;", vd);
|
||||
n = write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "VD", 2) == 0)
|
||||
{
|
||||
sscanf(buf, "VD%d", &vd);
|
||||
}
|
||||
else if (strncmp(buf, "SM0;", 4) == 0)
|
||||
{
|
||||
sprintf(buf, "SM0%d;", sm0);
|
||||
n = write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "SM0", 3) == 0)
|
||||
{
|
||||
sscanf(buf, "SM0%3d", &sm0);
|
||||
}
|
||||
else if (strncmp(buf, "SM1;", 4) == 0)
|
||||
{
|
||||
sprintf(buf, "SM1%d;", sm1);
|
||||
n = write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "SM1", 3) == 0)
|
||||
{
|
||||
sscanf(buf, "SM1%3d", &sm1);
|
||||
}
|
||||
|
||||
else if (strlen(buf) > 0)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@ int rport_gain_ssb = 50;
|
|||
int rport_gain_am = 50;
|
||||
int rport_gain_fm = 50;
|
||||
int rport_gain_psk = 50;
|
||||
int syncvfo=0;
|
||||
|
||||
// ID 0310 == 310, Must drop leading zero
|
||||
typedef enum nc_rigid_e
|
||||
|
@ -341,6 +342,15 @@ int main(int argc, char *argv[])
|
|||
printf("Here#1");
|
||||
sscanf(buf, "EX010415%d", &rport_gain_psk);
|
||||
}
|
||||
else if (strcmp(buf, "SY;") == 0)
|
||||
{
|
||||
sprintf(buf, "SY%d;", syncvfo);
|
||||
n = write(fd, buf, strlen(buf));
|
||||
}
|
||||
else if (strncmp(buf, "SY", 2) == 0)
|
||||
{
|
||||
sscanf(buf, "SY%d", &syncvfo);
|
||||
}
|
||||
|
||||
else if (strlen(buf) > 0)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
// This is currently included in rig.c
|
||||
// Can customize during build
|
||||
// Eventually should improved this for external actions when
|
||||
// rigctld gets integrated as a service within Hamlib
|
||||
int HAMLIB_API rig_band_changed(RIG *rig, hamlib_bandselect_t band)
|
||||
{
|
||||
// See band_changed.c
|
||||
// Examples:
|
||||
// rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_TUNER, 1);
|
||||
// rig_set_func(rig, RIG_VFO_CURR, RIG_FUNC_TUNER, 0);
|
||||
// value_t v;
|
||||
// rig_set_ant(rig, RIG_VFO_CURR, 1, v);
|
||||
switch (band)
|
||||
{
|
||||
case RIG_BANDSELECT_2200M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_600M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_160M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_80M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_60M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_40M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_30M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_20M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_17M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_15M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_12M:
|
||||
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_10M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_6M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_WFM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_MW:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_AIR:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_2M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_1_25M:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_70CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_33CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_23CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_13CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_9CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_5CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_3CM:
|
||||
break;
|
||||
|
||||
case RIG_BANDSELECT_GEN:
|
||||
break;
|
||||
|
||||
default:
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: Unknown band=%d\n", __func__, band);
|
||||
}
|
||||
|
||||
return RIG_OK;
|
||||
}
|
32
src/misc.c
32
src/misc.c
|
@ -761,7 +761,7 @@ static const struct
|
|||
{ RIG_BANDSELECT_20M, "BAND20M", 13900000, 14499999},
|
||||
{ RIG_BANDSELECT_17M, "BAND17M", 17900000, 18499999},
|
||||
{ RIG_BANDSELECT_15M, "BAND15M", 20900000, 21499999},
|
||||
{ RIG_BANDSELECT_12M, "BAND10M", 24400000, 25099999},
|
||||
{ RIG_BANDSELECT_12M, "BAND12M", 24400000, 25099999},
|
||||
{ RIG_BANDSELECT_10M, "BAND10M", 28000000, 29999999},
|
||||
{ RIG_BANDSELECT_6M, "BAND6M", 50000000, 53999999},
|
||||
{ RIG_BANDSELECT_WFM, "BANDWFM", 74800000, 107999999},
|
||||
|
@ -3042,6 +3042,36 @@ int rig_get_band_rig(RIG *rig, freq_t freq, const char *band)
|
|||
return 0; // just give a value for now of the 1st band -- this should be an error
|
||||
}
|
||||
|
||||
// Returns RIG_OK if 2038 time routines pass tests
|
||||
int rig_test_2038(RIG *rig)
|
||||
{
|
||||
time_t x;
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: enter\n", __func__);
|
||||
x = (time_t)((1U << 31) - 1);
|
||||
char *s = ctime(&x);
|
||||
|
||||
if (s == NULL)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: ctime is null, 2038 test failed\n", __func__);
|
||||
return 1;
|
||||
}
|
||||
if (!strstr(s, "2038")) { return 1; }
|
||||
|
||||
x += 1;
|
||||
s = ctime(&x);
|
||||
|
||||
if (!strstr(s, "2038")) { return 1; }
|
||||
|
||||
x += 1;
|
||||
s = ctime(&x);
|
||||
|
||||
if (!strstr(s, "2038")) { return 1; }
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//! @endcond
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -216,6 +216,8 @@ extern HAMLIB_EXPORT(hamlib_band_t) rig_get_band(RIG *rig, freq_t freq, int band
|
|||
extern HAMLIB_EXPORT(const char*) rig_get_band_str(RIG *rig, hamlib_band_t band, int which);
|
||||
extern HAMLIB_EXPORT(int) rig_get_band_rig(RIG *rig, freq_t freq, const char *band);
|
||||
|
||||
extern HAMLIB_EXPORT(int) rig_test_2038(RIG *rig);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MISC_H */
|
||||
|
|
102
src/rig.c
102
src/rig.c
|
@ -521,6 +521,16 @@ RIG *HAMLIB_API rig_init(rig_model_t rig_model)
|
|||
hamlib_port_t *rp, *pttp, *dcdp;
|
||||
int i;
|
||||
|
||||
if (rig_test_2038(NULL))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_WARN,
|
||||
"%s: 2038 time test failed....some time values may be incorrect\n", __func__);
|
||||
}
|
||||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: 2038 time test passed\n", __func__);
|
||||
}
|
||||
|
||||
rig_check_rig_caps();
|
||||
|
||||
rig_check_backend(rig_model);
|
||||
|
@ -2732,18 +2742,21 @@ int HAMLIB_API rig_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
|
|||
pbwidth_t cache_width;
|
||||
int cache_ms_freq, cache_ms_mode, cache_ms_width;
|
||||
|
||||
rig_get_cache(rig, vfo, &cache_freq, &cache_ms_freq, &cache_mode, &cache_ms_mode, &cache_width, &cache_ms_width);
|
||||
rig_get_cache(rig, vfo, &cache_freq, &cache_ms_freq, &cache_mode,
|
||||
&cache_ms_mode, &cache_width, &cache_ms_width);
|
||||
|
||||
if (cache_mode == mode)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: mode not changing, so ignoring\n",
|
||||
__func__);
|
||||
__func__);
|
||||
ELAPSED2;
|
||||
LOCK(0);
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: mode is not targetable, VFO swapping needed\n", __func__);
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: mode is not targetable, VFO swapping needed\n",
|
||||
__func__);
|
||||
|
||||
if (!caps->set_vfo)
|
||||
{
|
||||
|
@ -2849,6 +2862,7 @@ int HAMLIB_API rig_get_mode(RIG *rig,
|
|||
|
||||
curr_vfo = rig->state.current_vfo;
|
||||
vfo = vfo_fixup(rig, vfo, rig->state.cache.split);
|
||||
|
||||
if (vfo == RIG_VFO_CURR) { vfo = curr_vfo; }
|
||||
|
||||
*mode = RIG_MODE_NONE;
|
||||
|
@ -3279,7 +3293,7 @@ int HAMLIB_API rig_set_vfo(RIG *rig, vfo_t vfo)
|
|||
int HAMLIB_API rig_get_vfo(RIG *rig, vfo_t *vfo)
|
||||
{
|
||||
const struct rig_caps *caps;
|
||||
int retcode;
|
||||
int retcode = -RIG_EINTERNAL;
|
||||
int cache_ms;
|
||||
|
||||
if (CHECK_RIG_ARG(rig) || !vfo)
|
||||
|
@ -4502,13 +4516,17 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
// Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
|
||||
tx_vfo = rs->tx_vfo;
|
||||
|
||||
if (rs->cache.split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR)
|
||||
if (rs->cache.split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
|
||||
|| tx_vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// Turn split on if not enabled already
|
||||
retcode = rig_set_split_vfo(rig, rs->current_vfo, RIG_SPLIT_ON, vfo_fixup(rig, RIG_VFO_OTHER, RIG_SPLIT_OFF));
|
||||
retcode = rig_set_split_vfo(rig, rs->current_vfo, RIG_SPLIT_ON, vfo_fixup(rig,
|
||||
RIG_VFO_OTHER, RIG_SPLIT_OFF));
|
||||
|
||||
if (retcode != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error turning split on: result=%d\n", __func__, retcode);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error turning split on: result=%d\n", __func__,
|
||||
retcode);
|
||||
ELAPSED2;
|
||||
RETURNFUNC2(retcode);
|
||||
}
|
||||
|
@ -4532,10 +4550,12 @@ int HAMLIB_API rig_set_split_freq(RIG *rig, vfo_t vfo, freq_t tx_freq)
|
|||
HAMLIB_TRACE;
|
||||
retcode = caps->set_split_freq(rig, tx_vfo, tx_freq);
|
||||
ELAPSED2;
|
||||
|
||||
if (retcode == RIG_OK)
|
||||
{
|
||||
rig_set_cache_freq(rig, tx_vfo, tx_freq);
|
||||
}
|
||||
|
||||
RETURNFUNC2(retcode);
|
||||
}
|
||||
|
||||
|
@ -4685,7 +4705,8 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
|||
// Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
|
||||
tx_vfo = rs->tx_vfo;
|
||||
|
||||
if (rs->cache.split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR)
|
||||
if (rs->cache.split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
|
||||
|| tx_vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// Split frequency not available if split is off
|
||||
*tx_freq = 0;
|
||||
|
@ -4699,10 +4720,12 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
|||
HAMLIB_TRACE;
|
||||
retcode = caps->get_split_freq(rig, tx_vfo, tx_freq);
|
||||
ELAPSED2;
|
||||
|
||||
if (retcode == RIG_OK)
|
||||
{
|
||||
rig_set_cache_freq(rig, tx_vfo, *tx_freq);
|
||||
}
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
@ -4712,10 +4735,12 @@ int HAMLIB_API rig_get_split_freq(RIG *rig, vfo_t vfo, freq_t *tx_freq)
|
|||
HAMLIB_TRACE;
|
||||
retcode = caps->get_freq(rig, tx_vfo, tx_freq);
|
||||
ELAPSED2;
|
||||
|
||||
if (retcode == RIG_OK)
|
||||
{
|
||||
rig_set_cache_freq(rig, tx_vfo, *tx_freq);
|
||||
}
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
@ -4856,13 +4881,17 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
|
|||
// Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
|
||||
tx_vfo = rs->tx_vfo;
|
||||
|
||||
if (rs->cache.split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR)
|
||||
if (rs->cache.split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
|
||||
|| tx_vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// Turn split on if not enabled already
|
||||
retcode = rig_set_split_vfo(rig, rs->current_vfo, RIG_SPLIT_ON, vfo_fixup(rig, RIG_VFO_OTHER, RIG_SPLIT_OFF));
|
||||
retcode = rig_set_split_vfo(rig, rs->current_vfo, RIG_SPLIT_ON, vfo_fixup(rig,
|
||||
RIG_VFO_OTHER, RIG_SPLIT_OFF));
|
||||
|
||||
if (retcode != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error turning split on: result=%d\n", __func__, retcode);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error turning split on: result=%d\n", __func__,
|
||||
retcode);
|
||||
ELAPSED2;
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
@ -4882,7 +4911,8 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
|
|||
if (tx_mode == RIG_MODE_NONE)
|
||||
{
|
||||
// Get TX VFO mode from cache to avoid extra VFO swapping
|
||||
rig_get_cache(rig, tx_vfo, &cache_freq, &cache_ms_freq, &cache_mode, &cache_ms_mode, &cache_width, &cache_ms_width);
|
||||
rig_get_cache(rig, tx_vfo, &cache_freq, &cache_ms_freq, &cache_mode,
|
||||
&cache_ms_mode, &cache_width, &cache_ms_width);
|
||||
tx_mode = cache_mode;
|
||||
}
|
||||
|
||||
|
@ -4892,10 +4922,12 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
|
|||
HAMLIB_TRACE;
|
||||
retcode = caps->set_split_mode(rig, tx_vfo, tx_mode, tx_width);
|
||||
ELAPSED2;
|
||||
|
||||
if (retcode == RIG_OK)
|
||||
{
|
||||
rig_set_cache_mode(rig, tx_vfo, tx_mode, tx_width);
|
||||
}
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
@ -4911,10 +4943,12 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
|
|||
HAMLIB_TRACE;
|
||||
retcode = caps->set_mode(rig, tx_vfo, tx_mode, tx_width);
|
||||
ELAPSED2;
|
||||
|
||||
if (retcode == RIG_OK)
|
||||
{
|
||||
rig_set_cache_mode(rig, tx_vfo, tx_mode, tx_width);
|
||||
}
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
@ -4933,12 +4967,15 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
|
|||
__LINE__, rig_strvfo(rx_vfo), rig_strvfo(tx_vfo));
|
||||
|
||||
// If mode is not targetable, we will reuse cached mode/passband instead of trying to set them again
|
||||
rig_get_cache(rig, tx_vfo, &cache_freq, &cache_ms_freq, &cache_mode, &cache_ms_mode, &cache_width, &cache_ms_width);
|
||||
rig_get_cache(rig, tx_vfo, &cache_freq, &cache_ms_freq, &cache_mode,
|
||||
&cache_ms_mode, &cache_width, &cache_ms_width);
|
||||
|
||||
if ((tx_mode == cache_mode || tx_mode == RIG_MODE_NONE) && (tx_width == cache_width || tx_width == RIG_PASSBAND_NOCHANGE))
|
||||
if ((tx_mode == cache_mode || tx_mode == RIG_MODE_NONE)
|
||||
&& (tx_width == cache_width || tx_width == RIG_PASSBAND_NOCHANGE))
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s(%d): mode=%s and width=%ld already set for vfo=%s, ignoring\n",
|
||||
__func__, __LINE__, rig_strrmode(tx_mode), tx_width, rig_strvfo(tx_vfo));
|
||||
rig_debug(RIG_DEBUG_VERBOSE,
|
||||
"%s(%d): mode=%s and width=%ld already set for vfo=%s, ignoring\n",
|
||||
__func__, __LINE__, rig_strrmode(tx_mode), tx_width, rig_strvfo(tx_vfo));
|
||||
ELAPSED2;
|
||||
RETURNFUNC(RIG_OK);
|
||||
}
|
||||
|
@ -4955,10 +4992,12 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
|
|||
// special handling for netrigctl to avoid set_vfo
|
||||
retcode = caps->set_split_mode(rig, tx_vfo, tx_mode, tx_width);
|
||||
ELAPSED2;
|
||||
|
||||
if (retcode == RIG_OK)
|
||||
{
|
||||
rig_set_cache_mode(rig, tx_vfo, tx_mode, tx_width);
|
||||
}
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
@ -5078,7 +5117,8 @@ int HAMLIB_API rig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
|
|||
// Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
|
||||
tx_vfo = rs->tx_vfo;
|
||||
|
||||
if (rs->cache.split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR)
|
||||
if (rs->cache.split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
|
||||
|| tx_vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// Split mode and filter width are not available if split is off
|
||||
*tx_mode = RIG_MODE_NONE;
|
||||
|
@ -5093,10 +5133,12 @@ int HAMLIB_API rig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
|
|||
HAMLIB_TRACE;
|
||||
retcode = caps->get_split_mode(rig, tx_vfo, tx_mode, tx_width);
|
||||
ELAPSED2;
|
||||
|
||||
if (retcode == RIG_OK)
|
||||
{
|
||||
rig_set_cache_mode(rig, tx_vfo, *tx_mode, *tx_width);
|
||||
}
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
@ -5106,10 +5148,12 @@ int HAMLIB_API rig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode,
|
|||
HAMLIB_TRACE;
|
||||
retcode = caps->get_mode(rig, tx_vfo, tx_mode, tx_width);
|
||||
ELAPSED2;
|
||||
|
||||
if (retcode == RIG_OK)
|
||||
{
|
||||
rig_set_cache_mode(rig, tx_vfo, *tx_mode, *tx_width);
|
||||
}
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
@ -5232,13 +5276,17 @@ int HAMLIB_API rig_set_split_freq_mode(RIG *rig,
|
|||
// Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
|
||||
tx_vfo = rs->tx_vfo;
|
||||
|
||||
if (rs->cache.split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR)
|
||||
if (rs->cache.split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
|
||||
|| tx_vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// Turn split on if not enabled already
|
||||
retcode = rig_set_split_vfo(rig, rs->current_vfo, RIG_SPLIT_ON, vfo_fixup(rig, RIG_VFO_OTHER, RIG_SPLIT_OFF));
|
||||
retcode = rig_set_split_vfo(rig, rs->current_vfo, RIG_SPLIT_ON, vfo_fixup(rig,
|
||||
RIG_VFO_OTHER, RIG_SPLIT_OFF));
|
||||
|
||||
if (retcode != RIG_OK)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error turning split on: result=%d\n", __func__, retcode);
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error turning split on: result=%d\n", __func__,
|
||||
retcode);
|
||||
ELAPSED2;
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
@ -5289,11 +5337,13 @@ int HAMLIB_API rig_set_split_freq_mode(RIG *rig,
|
|||
#endif
|
||||
|
||||
ELAPSED2;
|
||||
|
||||
if (retcode == RIG_OK)
|
||||
{
|
||||
rig_set_cache_freq(rig, tx_vfo, tx_freq);
|
||||
rig_set_cache_mode(rig, tx_vfo, tx_mode, tx_width);
|
||||
}
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
else
|
||||
|
@ -5372,7 +5422,8 @@ int HAMLIB_API rig_get_split_freq_mode(RIG *rig,
|
|||
// Always use the previously selected TX VFO for split. The targeted VFO will have no effect.
|
||||
tx_vfo = rs->tx_vfo;
|
||||
|
||||
if (rs->cache.split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE || tx_vfo == RIG_VFO_CURR)
|
||||
if (rs->cache.split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE
|
||||
|| tx_vfo == RIG_VFO_CURR)
|
||||
{
|
||||
// Split frequency, mode and filter width are not available if split is off
|
||||
*tx_freq = 0;
|
||||
|
@ -5386,11 +5437,13 @@ int HAMLIB_API rig_get_split_freq_mode(RIG *rig,
|
|||
{
|
||||
retcode = caps->get_split_freq_mode(rig, tx_vfo, tx_freq, tx_mode, tx_width);
|
||||
ELAPSED2;
|
||||
|
||||
if (retcode == RIG_OK)
|
||||
{
|
||||
rig_set_cache_freq(rig, tx_vfo, *tx_freq);
|
||||
rig_set_cache_mode(rig, tx_vfo, *tx_mode, *tx_width);
|
||||
}
|
||||
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
@ -5504,8 +5557,9 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig,
|
|||
}
|
||||
}
|
||||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s: rig supports satmode, not fixing up vfos: rx=%s tx=%s\n",
|
||||
__func__, rig_strvfo(rx_vfo), rig_strvfo(tx_vfo));
|
||||
rig_debug(RIG_DEBUG_TRACE,
|
||||
"%s: rig supports satmode, not fixing up vfos: rx=%s tx=%s\n",
|
||||
__func__, rig_strvfo(rx_vfo), rig_strvfo(tx_vfo));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5567,6 +5621,7 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig,
|
|||
// Only update cache on success
|
||||
rs->rx_vfo = rs->current_vfo;
|
||||
rs->cache.split = split;
|
||||
|
||||
if (split == RIG_SPLIT_OFF)
|
||||
{
|
||||
rs->tx_vfo = rs->current_vfo;
|
||||
|
@ -5625,6 +5680,7 @@ int HAMLIB_API rig_set_split_vfo(RIG *rig,
|
|||
{
|
||||
// Only update cache on success
|
||||
rs->cache.split = split;
|
||||
|
||||
if (split == RIG_SPLIT_OFF)
|
||||
{
|
||||
if (caps->targetable_vfo & RIG_TARGETABLE_FREQ)
|
||||
|
|
|
@ -17,7 +17,7 @@ DISTCLEANFILES = rigctl.log rigctl.sum testbcd.log testbcd.sum
|
|||
bin_PROGRAMS = rigctl rigctld rigmem rigsmtr rigswr rotctl rotctld rigctlcom rigctltcp rigctlsync ampctl ampctld rigtestmcast rigtestmcastrx $(TESTLIBUSB) rigfreqwalk
|
||||
|
||||
#check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid testsecurity
|
||||
check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid hamlibmodels testmW2power
|
||||
check_PROGRAMS = dumpmem testrig testrigopen testrigcaps testtrn testbcd testfreq listrigs testloc rig_bench testcache cachetest cachetest2 testcookie testgrid hamlibmodels testmW2power test2038
|
||||
|
||||
RIGCOMMONSRC = rigctl_parse.c rigctl_parse.h dumpcaps.c dumpstate.c uthash.h rig_tests.c rig_tests.h dumpcaps.h
|
||||
ROTCOMMONSRC = rotctl_parse.c rotctl_parse.h dumpcaps_rot.c uthash.h dumpcaps_rot.h
|
||||
|
@ -106,7 +106,7 @@ endif
|
|||
EXTRA_DIST = rigmatrix_head.html rig_split_lst.awk testctld.pl testrotctld.pl
|
||||
|
||||
# Support 'make check' target for simple tests
|
||||
check_SCRIPTS = testrig.sh testfreq.sh testbcd.sh testloc.sh testrigcaps.sh testcache.sh testcookie.sh testgrid.sh
|
||||
check_SCRIPTS = testrig.sh testfreq.sh testbcd.sh testloc.sh testrigcaps.sh testcache.sh testcookie.sh testgrid.sh test2038.sh
|
||||
|
||||
TESTS = $(check_SCRIPTS)
|
||||
|
||||
|
@ -143,4 +143,8 @@ testgrid.sh:
|
|||
echo './testgrid' > testgrid.sh
|
||||
chmod +x ./testgrid.sh
|
||||
|
||||
CLEANFILES = testrig.sh testfreq.sh testbcd.sh testloc.sh testrigcaps.sh testcache.sh testcookie.sh rigtestlibusb build-w32.sh build-w64.sh build-w64-jtsdk.sh testgrid.sh testrigcaps.sh
|
||||
test2038.sh:
|
||||
echo 'LD_LIBRARY_PATH=$(top_builddir)/src/.libs:$(top_builddir)/dummy/.libs ./test2038 1' > test2038.sh
|
||||
chmod +x ./test2038.sh
|
||||
|
||||
CLEANFILES = testrig.sh testfreq.sh testbcd.sh testloc.sh testrigcaps.sh testcache.sh testcookie.sh rigtestlibusb build-w32.sh build-w64.sh build-w64-jtsdk.sh testgrid.sh testrigcaps.sh test2038.sh
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/* 2038 test
|
||||
This is OK on 64-bit systems and mingw64
|
||||
Does fail when compiled with gcc -m32 -o 2038 2038.c
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
int test2038(void)
|
||||
{
|
||||
time_t x;
|
||||
|
||||
//printf("sizeof(time_t)=%d\n", (int)sizeof(time_t));
|
||||
|
||||
x = (time_t)((1U << 31) - 1);
|
||||
//printf("x=%lu\n", (unsigned long)x);
|
||||
char *s = ctime(&x);
|
||||
|
||||
//printf("%s\n", s);
|
||||
//printf("x=%lu\n", (unsigned long)x);
|
||||
if (!strstr(s, "2038")) { return 1; }
|
||||
|
||||
x += 1;
|
||||
s = ctime(&x);
|
||||
|
||||
//printf("x=%lu\n", (unsigned long)x);
|
||||
//printf("%s\n", s);
|
||||
if (!strstr(s, "2038")) { return 1; }
|
||||
|
||||
//printf("x=%lu\n", (unsigned long)x);
|
||||
//printf("%s\n", s);
|
||||
x += 1;
|
||||
s = ctime(&x);
|
||||
|
||||
if (!strstr(s, "2038")) { return 1; }
|
||||
|
||||
//printf("%s\n", s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return test2038();
|
||||
}
|
Ładowanie…
Reference in New Issue