Update KISSPORT default handling

- Do not require use of KISSPORT 0 to remove default setting from
  KISSPORT configuration
- For existing config files with KISSPORT 0, warn that the setting
  is not needed and ignore
This commit is contained in:
Brent Petit 2021-04-25 23:22:38 -05:00
parent b66c21d39b
commit eb949211af
1 changed files with 30 additions and 30 deletions

View File

@ -857,8 +857,6 @@ void config_init (char *fname, struct audio_s *p_audio_config,
p_misc_config->kiss_port[i] = 0; // entry not used. p_misc_config->kiss_port[i] = 0; // entry not used.
p_misc_config->kiss_chan[i] = -1; p_misc_config->kiss_chan[i] = -1;
} }
p_misc_config->kiss_port[0] = DEFAULT_KISS_PORT;
p_misc_config->kiss_chan[0] = -1; // all channels.
p_misc_config->enable_kiss_pt = 0; /* -p option */ p_misc_config->enable_kiss_pt = 0; /* -p option */
p_misc_config->kiss_copy = 0; p_misc_config->kiss_copy = 0;
@ -4537,6 +4535,13 @@ void config_init (char *fname, struct audio_s *p_audio_config,
continue; continue;
} }
if (tcp_port == 0) {
// If existing config files have KISSPORT 0, ignore it and move on
text_color_set(DW_COLOR_ERROR);
dw_printf ("Line %d: Warning: KISSPORT 0 setting no longer needed.\n", line);
continue;
}
t = split(NULL,0); t = split(NULL,0);
if (t != NULL) { if (t != NULL) {
chan = atoi(t); chan = atoi(t);
@ -4547,13 +4552,6 @@ void config_init (char *fname, struct audio_s *p_audio_config,
} }
} }
// "KISSPORT 0" is used to remove the default entry.
if (tcp_port == 0) {
p_misc_config->kiss_port[0] = 0; // Should all be wiped out?
}
else {
// Try to find an empty slot. // Try to find an empty slot.
// A duplicate TCP port number will overwrite the previous value. // A duplicate TCP port number will overwrite the previous value.
@ -4561,11 +4559,9 @@ void config_init (char *fname, struct audio_s *p_audio_config,
for (int i = 0; i < MAX_KISS_TCP_PORTS && slot == -1; i++) { for (int i = 0; i < MAX_KISS_TCP_PORTS && slot == -1; i++) {
if (p_misc_config->kiss_port[i] == tcp_port) { if (p_misc_config->kiss_port[i] == tcp_port) {
slot = i; slot = i;
if ( ! (slot == 0 && tcp_port == DEFAULT_KISS_PORT)) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
dw_printf ("Line %d: Warning: Duplicate TCP port %d will overwrite previous value.\n", line, tcp_port); dw_printf ("Line %d: Warning: Duplicate TCP port %d will overwrite previous value.\n", line, tcp_port);
} }
}
else if (p_misc_config->kiss_port[i] == 0) { else if (p_misc_config->kiss_port[i] == 0) {
slot = i; slot = i;
} }
@ -4579,7 +4575,6 @@ void config_init (char *fname, struct audio_s *p_audio_config,
dw_printf ("Line %d: Too many KISSPORT commands.\n", line); dw_printf ("Line %d: Too many KISSPORT commands.\n", line);
} }
} }
}
/* /*
* NULLMODEM name [ speed ] - Device name for serial port or our end of the virtual "null modem" * NULLMODEM name [ speed ] - Device name for serial port or our end of the virtual "null modem"
@ -5357,6 +5352,11 @@ void config_init (char *fname, struct audio_s *p_audio_config,
p_misc_config->maxv22 = p_misc_config->retry / 3; p_misc_config->maxv22 = p_misc_config->retry / 3;
} }
/* If no kiss port specified, add default to first slot */
if (p_misc_config->kiss_port[0] == 0) {
p_misc_config->kiss_port[0] = DEFAULT_KISS_PORT;
}
} /* end config_init */ } /* end config_init */