kopia lustrzana https://github.com/Hamlib/Hamlib
Change get_ptt RTS/DTR to keep serial port open
New option --set-conf=ptt_share=1 to revert to old behavior where serial port is opened/closed every get_ptt
https://github.com/Hamlib/Hamlib/issues/383
(cherry picked from commit 4faad82da7
)
Hamlib-4.0
rodzic
73a975c125
commit
3fadcb16c7
1
NEWS
1
NEWS
|
@ -30,6 +30,7 @@ Version 4.0
|
||||||
* New rig backend for Elecraft K4.
|
* New rig backend for Elecraft K4.
|
||||||
* New rig backend for PowerSDR (Flex and Apache users).
|
* New rig backend for PowerSDR (Flex and Apache users).
|
||||||
* Many fixes and enhancements. Mike, W9MDB and many contributors
|
* Many fixes and enhancements. Mike, W9MDB and many contributors
|
||||||
|
* PTT port is no longer shared by default, use --set-conf=ptt_share=1 to enable
|
||||||
|
|
||||||
Version 3.3
|
Version 3.3
|
||||||
2018-08-12
|
2018-08-12
|
||||||
|
|
|
@ -2039,6 +2039,7 @@ struct rig_state {
|
||||||
int auto_disable_screensaver; /*!< Allow Hamlib to disable the
|
int auto_disable_screensaver; /*!< Allow Hamlib to disable the
|
||||||
rig's screen saver automatically if
|
rig's screen saver automatically if
|
||||||
supported */
|
supported */
|
||||||
|
int ptt_share; /*!< Share ptt port by open/close during get_ptt, set_ptt hogs the port while active */
|
||||||
int power_now; /*!< Current RF power level in rig units */
|
int power_now; /*!< Current RF power level in rig units */
|
||||||
int power_min; /*!< Minimum RF power level in rig units */
|
int power_min; /*!< Minimum RF power level in rig units */
|
||||||
int power_max; /*!< Maximum RF power level in rig units */
|
int power_max; /*!< Maximum RF power level in rig units */
|
||||||
|
|
15
src/conf.c
15
src/conf.c
|
@ -138,6 +138,11 @@ static const struct confparams frontend_cfg_params[] =
|
||||||
"True enables compatible rigs to have their screen saver disabled on open",
|
"True enables compatible rigs to have their screen saver disabled on open",
|
||||||
"0", RIG_CONF_CHECKBUTTON, { }
|
"0", RIG_CONF_CHECKBUTTON, { }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
TOK_PTT_SHARE, "ptt_share", "Share ptt port with other apps",
|
||||||
|
"True enables ptt port to be shared with other apps",
|
||||||
|
"0", RIG_CONF_CHECKBUTTON, { }
|
||||||
|
},
|
||||||
|
|
||||||
{ RIG_CONF_END, NULL, }
|
{ RIG_CONF_END, NULL, }
|
||||||
};
|
};
|
||||||
|
@ -580,6 +585,16 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val)
|
||||||
rs->auto_disable_screensaver = val_i ? 1 : 0;
|
rs->auto_disable_screensaver = val_i ? 1 : 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TOK_PTT_SHARE:
|
||||||
|
if (1 != sscanf(val, "%d", &val_i))
|
||||||
|
{
|
||||||
|
return -RIG_EINVAL; //value format error
|
||||||
|
}
|
||||||
|
|
||||||
|
rs->ptt_share = val_i ? 1 : 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2233,9 +2233,9 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||||
retcode = ser_set_dtr(&rig->state.pttport, ptt != RIG_PTT_OFF);
|
retcode = ser_set_dtr(&rig->state.pttport, ptt != RIG_PTT_OFF);
|
||||||
|
|
||||||
if (strcmp(rs->pttport.pathname, rs->rigport.pathname)
|
if (strcmp(rs->pttport.pathname, rs->rigport.pathname)
|
||||||
&& ptt == RIG_PTT_OFF)
|
&& ptt == RIG_PTT_OFF && rs->ptt_share != 0)
|
||||||
{
|
{
|
||||||
|
rig_debug(RIG_DEBUG_TRACE, "%s: ptt_share=%d\n", __func__, rs->ptt_share);
|
||||||
/* free the port */
|
/* free the port */
|
||||||
ser_close(&rs->pttport);
|
ser_close(&rs->pttport);
|
||||||
}
|
}
|
||||||
|
@ -2280,9 +2280,9 @@ int HAMLIB_API rig_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)
|
||||||
retcode = ser_set_rts(&rig->state.pttport, ptt != RIG_PTT_OFF);
|
retcode = ser_set_rts(&rig->state.pttport, ptt != RIG_PTT_OFF);
|
||||||
|
|
||||||
if (strcmp(rs->pttport.pathname, rs->rigport.pathname)
|
if (strcmp(rs->pttport.pathname, rs->rigport.pathname)
|
||||||
&& ptt == RIG_PTT_OFF)
|
&& ptt == RIG_PTT_OFF && rs->ptt_share != 0)
|
||||||
{
|
{
|
||||||
|
rig_debug(RIG_DEBUG_TRACE, "%s: ptt_share=%d\n", __func__, rs->ptt_share);
|
||||||
/* free the port */
|
/* free the port */
|
||||||
ser_close(&rs->pttport);
|
ser_close(&rs->pttport);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,8 @@
|
||||||
#define TOK_DCD_PATHNAME TOKEN_FRONTEND(33)
|
#define TOK_DCD_PATHNAME TOKEN_FRONTEND(33)
|
||||||
/** \brief CM108 GPIO bit number for PTT */
|
/** \brief CM108 GPIO bit number for PTT */
|
||||||
#define TOK_PTT_BITNUM TOKEN_FRONTEND(34)
|
#define TOK_PTT_BITNUM TOKEN_FRONTEND(34)
|
||||||
|
/** \brief PTT share with other applications */
|
||||||
|
#define TOK_PTT_SHARE TOKEN_FRONTEND(35)
|
||||||
/*
|
/*
|
||||||
* rig specific tokens
|
* rig specific tokens
|
||||||
*/
|
*/
|
||||||
|
|
Ładowanie…
Reference in New Issue