summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Burnicki <martin.burnicki@meinberg.de>2023-02-23 17:02:41 +0100
committerMartin Burnicki <martin.burnicki@meinberg.de>2023-02-23 17:02:41 +0100
commita6546b03806f933b526c7c0b23917b93a334f5b4 (patch)
treef9690cc14a03d90ee9850e066797c5ad5d804979
parent3bcfdbb2e786e1c239a8e1cd0cf4a307c9e80c2f (diff)
downloadmbgtools-lx-a6546b03806f933b526c7c0b23917b93a334f5b4.tar.gz
mbgtools-lx-a6546b03806f933b526c7c0b23917b93a334f5b4.zip
mbgirigcfg: Fix bugs that occurred when changing IRIG settings
Support of the TFOM flag was incorrectly always checked against the timecode format configured for the timecode output, so setting the flag for the input happened to be accepted, or not. Before trying to save the configuration of the timecode output, it was incorrectly checked for the presence of a timecode input, so saving the configuration of the output of a device failed if the device did not also have an input. Also modified some message texts and did some cleanup.
-rw-r--r--mbgirigcfg/mbgirigcfg.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/mbgirigcfg/mbgirigcfg.c b/mbgirigcfg/mbgirigcfg.c
index b1136ae..984a886 100644
--- a/mbgirigcfg/mbgirigcfg.c
+++ b/mbgirigcfg/mbgirigcfg.c
@@ -1,15 +1,25 @@
/**************************************************************************
*
- * $Id: mbgirigcfg.c 1.18 2022/12/21 15:20:27 martin.burnicki REL_M $
+ * $Id: mbgirigcfg.c 1.19 2023/02/23 15:55:27 martin.burnicki REL_M $
*
* Description:
* Main file for the mbgirigcfg program which can be used to configure
- * the IRIG code frame and the UTC offset of the time contained in the
- * IRIG code.
+ * the time code format and the UTC offset of the time contained in the
+ * time code.
*
* -----------------------------------------------------------------------
* $Log: mbgirigcfg.c $
+ * Revision 1.19 2023/02/23 15:55:27 martin.burnicki
+ * Fixed bugs that occurred when changing IRIG settings.
+ * Support of the TFOM flag was incorrectly always checked against
+ * the timecode format configured for the timecode output, so setting
+ * the flag for the input happened to be accepted, or not.
+ * Before trying to save the configuration of the timecode output,
+ * it was incorrectly checked for the presence of a timecode input,
+ * so saving the configuration of the output of a device failed
+ * if the device did not also have an input.
+ * Also modified some message texts and did some cleanup.
* Revision 1.18 2022/12/21 15:20:27 martin.burnicki
* Removed obsolete (PCPS_DEV *) parameter from some functions,
* and use feature check functions instead of macros.
@@ -96,7 +106,7 @@ static char **glb_argv;
static const char str_yes[] = "YES";
static const char str_no[] = "NO";
-static const char str_not_supp[] = " (not supp. by this frame type)";
+static const char str_not_supp[] = " (not supp. by this code format)";
static const char info_curr[] = "Current";
static const char info_new[] = "New";
@@ -156,7 +166,7 @@ void print_cfg_rx( const char *info, const char *msg )
printf( "%s %s configuration:\n", info, msg );
- printf( " " DEFAULT_STR_IRIG_FMT_EN ": %s, %s\n",
+ printf( " " DEFAULT_STR_IRIG_FMT_EN ": %s (%s)\n",
icode_rx_names[idx],
icode_rx_descr[idx]
);
@@ -177,8 +187,8 @@ void print_cfg_rx( const char *info, const char *msg )
printf( "%s", cp );
- if ( ( 1UL << idx ) & MSK_ICODE_RX_HAS_TZI )
- printf( " (ignored with code %s)", icode_rx_names[idx] );
+ if ( _idx_bit( idx ) & MSK_ICODE_RX_HAS_TZI )
+ printf( " (ignored with selected code format \"%s\")", icode_rx_names[idx] );
printf( "\n" );
@@ -198,7 +208,7 @@ void print_cfg_tx( const char *info, const char *msg )
printf( "%s %s configuration:\n", info, msg );
- printf( " " DEFAULT_STR_IRIG_FMT_EN ": %s, %s\n",
+ printf( " " DEFAULT_STR_IRIG_FMT_EN ": %s (%s)\n",
icode_tx_names[idx],
icode_tx_descr[idx]
);
@@ -390,9 +400,10 @@ void set_new_irig_tx_local( char *s )
static /*HDR*/
-void set_new_tfom_flag( char *s, IRIG_SETTINGS *p, bool *changed_flag, bool *err_flag )
+void set_new_tfom_flag( char *s, IRIG_SETTINGS *p, int supp_mask,
+ bool *changed_flag, bool *err_flag )
{
- if ( !(_idx_bit( p->icode ) & MSK_ICODE_TX_HAS_TFOM ) )
+ if ( !(_idx_bit( p->icode ) & supp_mask ) )
return; // not supported
@@ -481,7 +492,7 @@ void check_cmd_line( int argc, char *argv[], MBG_DEV_HANDLE dh, bool dev_is_tcr,
// IRIG receiver options.
- case 'r': // IRIG RX code frame.
+ case 'r': // IRIG RX code format.
if ( chk_dev_rx( dev_opened, dev_is_tcr ) )
set_new_icode_rx( optarg );
break;
@@ -498,7 +509,8 @@ void check_cmd_line( int argc, char *argv[], MBG_DEV_HANDLE dh, bool dev_is_tcr,
case 'i': // Option flag: ignore incoming TFOM flag, alway sync.
if ( chk_dev_rx( dev_opened, dev_is_tcr ) )
- set_new_tfom_flag( optarg, &irig_rx_info.settings, &changed_cfg_rx, &cfg_err_rx );
+ set_new_tfom_flag( optarg, &irig_rx_info.settings, MSK_ICODE_RX_HAS_TFOM,
+ &changed_cfg_rx, &cfg_err_rx );
break;
case 'X': // Set UTC ref_offs to "not configured".
@@ -509,7 +521,7 @@ void check_cmd_line( int argc, char *argv[], MBG_DEV_HANDLE dh, bool dev_is_tcr,
// IRIG output options.
- case 't': // IRIG TX code frame.
+ case 't': // IRIG TX code format.
if ( chk_dev_tx( dev_opened, dev_has_tx ) )
set_new_icode_tx( optarg );
break;
@@ -521,7 +533,8 @@ void check_cmd_line( int argc, char *argv[], MBG_DEV_HANDLE dh, bool dev_is_tcr,
case 's': // Option flag: always send TFOM as "sync".
if ( chk_dev_tx( dev_opened, dev_has_tx ) )
- set_new_tfom_flag( optarg, &irig_tx_info.settings, &changed_cfg_tx, &cfg_err_tx );
+ set_new_tfom_flag( optarg, &irig_tx_info.settings, MSK_ICODE_TX_HAS_TFOM,
+ &changed_cfg_tx, &cfg_err_tx );
break;
} // switch
@@ -709,7 +722,7 @@ int do_mbgirigcfg( MBG_DEV_HANDLE dh )
if ( changed_cfg_tx )
{
- if ( chk_dev_tx( dev_opened, dev_is_tcr ) )
+ if ( chk_dev_tx( dev_opened, dev_has_irig_tx ) )
{
print_cfg_tx( info_new, msg_tx );