Skip to content

Commit 5e9d678

Browse files
committed
Better error messages.
1 parent 95c3025 commit 5e9d678

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

audio.c

+14-3
Original file line numberDiff line numberDiff line change
@@ -921,11 +921,22 @@ int audio_get (int a)
921921
/* Error */
922922
// TODO: Needs more study and testing.
923923

924-
// TODO: print n. should snd_strerror use n or errno?
925-
// Audio input device error: Unknown error
924+
// Only expected error conditions:
925+
// -EBADFD PCM is not in the right state (SND_PCM_STATE_PREPARED or SND_PCM_STATE_RUNNING)
926+
// -EPIPE an overrun occurred
927+
// -ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
928+
929+
// Data overrun is displayed as "broken pipe" which seems a little misleading.
930+
// Add our own message which says something about CPU being too slow.
926931

927932
text_color_set(DW_COLOR_ERROR);
928-
dw_printf ("Audio input device %d error: %s\n", a, snd_strerror(n));
933+
dw_printf ("Audio input device %d error code %d: %s\n", a, n, snd_strerror(n));
934+
935+
if (n == (-EPIPE)) {
936+
dw_printf ("This is most likely caused by the CPU being too slow to keep up with the audio stream.\n");
937+
dw_printf ("Use the \"top\" command, in another command window, to look at CPU usage.\n");
938+
dw_printf ("This might be a temporary condition so we will attempt to recover a few times before giving up.\n");
939+
}
929940

930941
audio_stats (a,
931942
save_audio_config_p->adev[a].num_channels,

kiss_frame.c

+3
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,9 @@ void kiss_process_msg (unsigned char *kiss_msg, int kiss_len, int debug, int cli
708708
dw_printf ("\n");
709709
dw_printf ("It looks like you are trying to use the \"XKISS\" protocol which is not supported.\n");
710710
dw_printf ("Change your application settings to use standard \"KISS\" rather than some other variant.\n");
711+
dw_printf ("If you are using Winlink Express, configure like this:\n");
712+
dw_printf (" Packet TNC Type: KISS\n");
713+
dw_printf (" Packet TNC Model: NORMAL -- Using ACKMODE will cause this error.\n");
711714
dw_printf ("\n");
712715
}
713716
break;

multi_modem.c

+14-3
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,22 @@ void multi_modem_process_sample (int chan, int audio_sample)
314314
dc_average[chan] = dc_average[chan] * 0.999f + (float)audio_sample * 0.001f;
315315

316316

317-
// TODO: temp debug, remove this.
317+
// Issue 128. Someone ran into this.
318+
319+
//assert (save_audio_config_p->achan[chan].num_subchan > 0 && save_audio_config_p->achan[chan].num_subchan <= MAX_SUBCHANS);
320+
//assert (save_audio_config_p->achan[chan].num_slicers > 0 && save_audio_config_p->achan[chan].num_slicers <= MAX_SLICERS);
318321

319-
assert (save_audio_config_p->achan[chan].num_subchan > 0 && save_audio_config_p->achan[chan].num_subchan <= MAX_SUBCHANS);
320-
assert (save_audio_config_p->achan[chan].num_slicers > 0 && save_audio_config_p->achan[chan].num_slicers <= MAX_SLICERS);
322+
if (save_audio_config_p->achan[chan].num_subchan <= 0 || save_audio_config_p->achan[chan].num_subchan > MAX_SUBCHANS ||
323+
save_audio_config_p->achan[chan].num_slicers <= 0 || save_audio_config_p->achan[chan].num_slicers > MAX_SLICERS) {
321324

325+
text_color_set(DW_COLOR_ERROR);
326+
dw_printf ("ERROR! Something is seriously wrong in %s %s.\n", __FILE__, __func__);
327+
dw_printf ("chan = %d, num_subchan = %d [max %d], num_slicers = %d [max %d]\n", chan,
328+
save_audio_config_p->achan[chan].num_subchan, MAX_SUBCHANS,
329+
save_audio_config_p->achan[chan].num_slicers, MAX_SLICERS);
330+
dw_printf ("Please report this message and include a copy of your configuration file.\n");
331+
exit (EXIT_FAILURE);
332+
}
322333

323334
/* Formerly one loop. */
324335
/* 1.2: We can feed one demodulator but end up with multiple outputs. */

0 commit comments

Comments
 (0)