From 4dbec538f657854d9cd0890db06b5ebdddceb9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Fillod=2C=20F8CFE?= Date: Wed, 15 Apr 2009 17:34:16 +0000 Subject: [PATCH] make ptt/dcd override accessible trough set_conf/get_conf git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2688 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- src/conf.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++- src/token.h | 10 ++++++++- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/src/conf.c b/src/conf.c index 3bd5fa85b..cfbc2f5fb 100644 --- a/src/conf.c +++ b/src/conf.c @@ -108,7 +108,22 @@ static const struct confparams frontend_cfg_params[] = { "Polling interval in millisecond for transceive emulation", "500", RIG_CONF_NUMERIC, { .n = { 0, 1000000, 1 } } }, - + { TOK_PTT_TYPE, "ptt_type", "PTT type", + "Push-To-Talk interface type override", + "RIG", RIG_CONF_COMBO, { .c = {{ "RIG", "DTR", "RTS", "Parallel", "None", NULL }} } + }, + { TOK_PTT_PATHNAME, "ptt_pathname", "PTT path name", + "Path name to the device file of the Push-To-Talk", + "/dev/rig", RIG_CONF_STRING, + }, + { TOK_DCD_TYPE, "dcd_type", "DCD type", + "Data Carrier Detect (or squelch) interface type override", + "RIG", RIG_CONF_COMBO, { .c = {{ "RIG", "DSR", "CTS", "CD", "Parallel", "None", NULL }} } + }, + { TOK_DCD_PATHNAME, "dcd_pathname", "DCD path name", + "Path name to the device file of the Data Carrier Detect (or squelch)", + "/dev/rig", RIG_CONF_STRING, + }, { RIG_CONF_END, NULL, } }; @@ -254,7 +269,48 @@ static int frontend_set_conf(RIG *rig, token_t token, const char *val) return -RIG_EINVAL; } break; + + case TOK_PTT_TYPE: + if (!strcmp(val, "RIG")) + rs->pttport.type.ptt = RIG_PTT_RIG; + else if (!strcmp(val, "DTR")) + rs->pttport.type.ptt = RIG_PTT_SERIAL_DTR; + else if (!strcmp(val, "RTS")) + rs->pttport.type.ptt = RIG_PTT_SERIAL_RTS; + else if (!strcmp(val, "Parallel")) + rs->pttport.type.ptt = RIG_PTT_PARALLEL; + else if (!strcmp(val, "None")) + rs->pttport.type.ptt = RIG_PTT_NONE; + else + return -RIG_EINVAL; + break; + + case TOK_PTT_PATHNAME: + strncpy(rs->pttport.pathname, val, FILPATHLEN-1); + break; + case TOK_DCD_TYPE: + if (!strcmp(val, "RIG")) + rs->dcdport.type.dcd = RIG_DCD_RIG; + else if (!strcmp(val, "DSR")) + rs->dcdport.type.dcd = RIG_DCD_SERIAL_DSR; + else if (!strcmp(val, "CTS")) + rs->dcdport.type.dcd = RIG_DCD_SERIAL_CTS; + else if (!strcmp(val, "CD")) + rs->dcdport.type.dcd = RIG_DCD_SERIAL_CAR; + else if (!strcmp(val, "Parallel")) + rs->dcdport.type.dcd = RIG_DCD_PARALLEL; + else if (!strcmp(val, "None")) + rs->dcdport.type.dcd = RIG_DCD_NONE; + else + return -RIG_EINVAL; + break; + + case TOK_DCD_PATHNAME: + strncpy(rs->dcdport.pathname, val, FILPATHLEN-1); + break; + + case TOK_VFO_COMP: rs->vfo_comp = atof(val); break; diff --git a/src/token.h b/src/token.h index ae669a709..6164265b4 100644 --- a/src/token.h +++ b/src/token.h @@ -1,6 +1,6 @@ /* * Hamlib Interface - token header - * Copyright (c) 2000-2003 by Stephane Fillod + * Copyright (c) 2000-2009 by Stephane Fillod * * $Id: token.h,v 1.5 2006-10-28 03:49:46 aa6e Exp $ * @@ -78,6 +78,14 @@ #define TOK_RTS_STATE TOKEN_FRONTEND(25) /** \brief Serial Data Terminal Ready status */ #define TOK_DTR_STATE TOKEN_FRONTEND(26) +/** \brief PTT type override */ +#define TOK_PTT_TYPE TOKEN_FRONTEND(30) +/** \brief PTT pathname override */ +#define TOK_PTT_PATHNAME TOKEN_FRONTEND(31) +/** \brief DCD type override */ +#define TOK_DCD_TYPE TOKEN_FRONTEND(32) +/** \brief DCD pathname override */ +#define TOK_DCD_PATHNAME TOKEN_FRONTEND(33) /* * rig specific tokens