From 30b321a440472b99efc5480a0b76fa50def4cc08 Mon Sep 17 00:00:00 2001 From: Thierry Bultel Date: Fri, 22 Jun 2018 11:16:13 +0200 Subject: alsa-utils-dump: added log upon failing parameters retrieval Signed-off-by: Thierry Bultel --- plugins/alsa/alsa-utils-dump.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/alsa/alsa-utils-dump.c b/plugins/alsa/alsa-utils-dump.c index c9bd3d4..953f005 100644 --- a/plugins/alsa/alsa-utils-dump.c +++ b/plugins/alsa/alsa-utils-dump.c @@ -70,18 +70,22 @@ OnErrorExit: return NULL; } -PUBLIC void AlsaDumpFormats(SoftMixerT *mixer, snd_pcm_t *pcmHandle) { +PUBLIC void AlsaDumpFormats(SoftMixerT *mixer, snd_pcm_t *pcm) { char string[32]; + int ret; snd_pcm_format_t format; snd_pcm_hw_params_t *pxmHwParams; - // retrieve hadware config from PCM + // retrieve hardware config from PCM snd_pcm_hw_params_alloca(&pxmHwParams); - snd_pcm_hw_params_any(pcmHandle, pxmHwParams); + ret = snd_pcm_hw_params_any(pcm, pxmHwParams); + if (ret < 0) { + AFB_ApiError(mixer->api, "FAILED to read params of PCM %s\n", snd_pcm_name(pcm)); + } - AFB_ApiNotice(mixer->api, "Available formats: PCM=%s", ALSA_PCM_UID(pcmHandle, string)); + AFB_ApiNotice(mixer->api, "Available formats: PCM=%s", ALSA_PCM_UID(pcm, string)); for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) { - if (snd_pcm_hw_params_test_format(pcmHandle, pxmHwParams, format) == 0) { + if (snd_pcm_hw_params_test_format(pcm, pxmHwParams, format) == 0) { AFB_ApiNotice(mixer->api, "- %s", snd_pcm_format_name(format)); } } -- cgit 1.2.3-korg