diff options
author | Simon Ser <simon.ser@intel.com> | 2019-04-23 16:04:54 +0300 |
---|---|---|
committer | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2019-04-25 13:07:41 +0300 |
commit | 9a0770f04f7e24fb9eb41308dd0435166d467323 (patch) | |
tree | 2d65105f9b182d14d96e7a3ee5b486a41178915f /lib/igt_alsa.c | |
parent | e5fc41b102ec50210646449822cb7f2f81d7f99a (diff) |
lib/igt_{alsa, audio}: improve logging
- Print matched audio devices
- Print min/max values when alsa_test_configuration fails
- Print debug log line when skipping a frequency
Signed-off-by: Simon Ser <simon.ser@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
Diffstat (limited to 'lib/igt_alsa.c')
-rw-r--r-- | lib/igt_alsa.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/igt_alsa.c b/lib/igt_alsa.c index fc6d336b..3b1a9e90 100644 --- a/lib/igt_alsa.c +++ b/lib/igt_alsa.c @@ -182,6 +182,8 @@ static char *alsa_resolve_indentifier(const char *device_name, int skip) continue; } + igt_debug("Matched device \"%s\"\n", pcm_name); + snprintf(name, sizeof(name), "hw:%d,%d", card, dev); @@ -329,6 +331,9 @@ static bool alsa_test_configuration(snd_pcm_t *handle, int channels, { snd_pcm_hw_params_t *params; int ret; + unsigned int min_channels, max_channels; + unsigned int min_rate, max_rate; + int min_rate_dir, max_rate_dir; snd_pcm_hw_params_alloca(¶ms); @@ -337,12 +342,24 @@ static bool alsa_test_configuration(snd_pcm_t *handle, int channels, return false; ret = snd_pcm_hw_params_test_rate(handle, params, sampling_rate, 0); - if (ret < 0) + if (ret < 0) { + snd_pcm_hw_params_get_rate_min(params, &min_rate, &min_rate_dir); + snd_pcm_hw_params_get_rate_max(params, &max_rate, &max_rate_dir); + igt_debug("Output device supports rates between %u and %u, " + "requested %d\n", + min_rate, max_rate, sampling_rate); return false; + } ret = snd_pcm_hw_params_test_channels(handle, params, channels); - if (ret < 0) + if (ret < 0) { + snd_pcm_hw_params_get_channels_min(params, &min_channels); + snd_pcm_hw_params_get_channels_max(params, &max_channels); + igt_debug("Output device supports between %u and " + "%u channels, requested %d\n", + min_channels, max_channels, channels); return false; + } return true; } |