diff --git a/src/amp_conf.c b/src/amp_conf.c index 9f07cb27b..e47d7d1ef 100644 --- a/src/amp_conf.c +++ b/src/amp_conf.c @@ -268,6 +268,64 @@ int frontamp_set_conf(AMP *amp, token_t token, const char *val) } break; + case TOK_RTS_STATE: + if (rs->ampport.type.rig != RIG_PORT_SERIAL) + { + return -RIG_EINVAL; + } + + if (!strcmp(val, "Unset")) + { + rs->ampport.parm.serial.rts_state = RIG_SIGNAL_UNSET; + rs->ampport_deprecated.parm.serial.rts_state = RIG_SIGNAL_UNSET; + } + else if (!strcmp(val, "ON")) + { + rs->ampport.parm.serial.rts_state = RIG_SIGNAL_ON; + rs->ampport_deprecated.parm.serial.rts_state = RIG_SIGNAL_ON; + } + else if (!strcmp(val, "OFF")) + { + rs->ampport.parm.serial.rts_state = RIG_SIGNAL_OFF; + rs->ampport_deprecated.parm.serial.rts_state = RIG_SIGNAL_OFF; + } + else + { + return -RIG_EINVAL; + } + + break; + + case TOK_DTR_STATE: + if (rs->ampport.type.rig != RIG_PORT_SERIAL) + { + return -RIG_EINVAL; + } + + if (!strcmp(val, "Unset")) + { + rs->ampport.parm.serial.dtr_state = RIG_SIGNAL_UNSET; + rs->ampport_deprecated.parm.serial.dtr_state = RIG_SIGNAL_UNSET; + } + else if (!strcmp(val, "ON")) + { + rs->ampport.parm.serial.dtr_state = RIG_SIGNAL_ON; + rs->ampport_deprecated.parm.serial.dtr_state = RIG_SIGNAL_ON; + } + else if (!strcmp(val, "OFF")) + { + rs->ampport.parm.serial.dtr_state = RIG_SIGNAL_OFF; + rs->ampport_deprecated.parm.serial.dtr_state = RIG_SIGNAL_OFF; + } + else + { + return -RIG_EINVAL; + } + + break; + + + #if 0 diff --git a/src/rot_conf.c b/src/rot_conf.c index 73c147d19..bfb9a2527 100644 --- a/src/rot_conf.c +++ b/src/rot_conf.c @@ -328,6 +328,64 @@ int frontrot_set_conf(ROT *rot, token_t token, const char *val) rs->south_zero = atoi(val); break; + + case TOK_RTS_STATE: + if (rs->rotport.type.rig != RIG_PORT_SERIAL) + { + return -RIG_EINVAL; + } + + if (!strcmp(val, "Unset")) + { + rs->rotport.parm.serial.rts_state = RIG_SIGNAL_UNSET; + rs->rotport_deprecated.parm.serial.rts_state = RIG_SIGNAL_UNSET; + } + else if (!strcmp(val, "ON")) + { + rs->rotport.parm.serial.rts_state = RIG_SIGNAL_ON; + rs->rotport_deprecated.parm.serial.rts_state = RIG_SIGNAL_ON; + } + else if (!strcmp(val, "OFF")) + { + rs->rotport.parm.serial.rts_state = RIG_SIGNAL_OFF; + rs->rotport_deprecated.parm.serial.rts_state = RIG_SIGNAL_OFF; + } + else + { + return -RIG_EINVAL; + } + + break; + + case TOK_DTR_STATE: + if (rs->rotport.type.rig != RIG_PORT_SERIAL) + { + return -RIG_EINVAL; + } + + if (!strcmp(val, "Unset")) + { + rs->rotport.parm.serial.dtr_state = RIG_SIGNAL_UNSET; + rs->rotport_deprecated.parm.serial.dtr_state = RIG_SIGNAL_UNSET; + } + else if (!strcmp(val, "ON")) + { + rs->rotport.parm.serial.dtr_state = RIG_SIGNAL_ON; + rs->rotport_deprecated.parm.serial.dtr_state = RIG_SIGNAL_ON; + } + else if (!strcmp(val, "OFF")) + { + rs->rotport.parm.serial.dtr_state = RIG_SIGNAL_OFF; + rs->rotport_deprecated.parm.serial.dtr_state = RIG_SIGNAL_OFF; + } + else + { + return -RIG_EINVAL; + } + + break; + + default: return -RIG_EINVAL; } diff --git a/tests/ampctl_parse.c b/tests/ampctl_parse.c index a59c8a128..01ffba765 100644 --- a/tests/ampctl_parse.c +++ b/tests/ampctl_parse.c @@ -1593,7 +1593,9 @@ void list_models() int set_conf(AMP *my_amp, char *conf_parms) { char *p, *n; + int token; + amp_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); p = conf_parms; while (p && *p != '\0') @@ -1616,11 +1618,19 @@ int set_conf(AMP *my_amp, char *conf_parms) *n++ = '\0'; } - ret = amp_set_conf(my_amp, amp_token_lookup(my_amp, p), q); + token = amp_token_lookup(my_amp, p); - if (ret != RIG_OK) + if (token != 0) { - return ret; + ret = amp_set_conf(my_amp, token, q); + if (ret != RIG_OK) + { + return ret; + } + } + else + { + rig_debug(RIG_DEBUG_WARN, "%s: invalid token %s for this rig\n", __func__, p); } p = n; diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c index 3393d3dcf..1f1d1a0fd 100644 --- a/tests/rigctl_parse.c +++ b/tests/rigctl_parse.c @@ -2031,6 +2031,7 @@ int set_conf(RIG *my_rig, char *conf_parms) char *p, *n; int token; + rig_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); p = conf_parms; while (p && *p != '\0') diff --git a/tests/rotctl_parse.c b/tests/rotctl_parse.c index 82c71268e..0db890683 100644 --- a/tests/rotctl_parse.c +++ b/tests/rotctl_parse.c @@ -1664,6 +1664,7 @@ void list_models() int set_conf(ROT *my_rot, char *conf_parms) { char *p; + int token; rot_debug(RIG_DEBUG_TRACE, "%s: called\n", __func__); p = conf_parms; @@ -1688,12 +1689,20 @@ int set_conf(ROT *my_rot, char *conf_parms) *n++ = '\0'; } - rig_debug(RIG_DEBUG_TRACE, "%s: token=%s, val=%s\n", __func__, p, q); - ret = rot_set_conf(my_rot, rot_token_lookup(my_rot, p), q); + token = rot_token_lookup(my_rot, p); - if (ret != RIG_OK) + if (token != 0) { - return ret; + ret = rot_set_conf(my_rot, token, q); + + if (ret != RIG_OK) + { + return ret; + } + } + else + { + rig_debug(RIG_DEBUG_WARN, "%s: invalid token %s for this rig\n", __func__, p); } p = n;