Having a warning in the syslog should make it a bit easier to debug situations where some other program is hogging the sound card. --- Changes in v2: - Got rid of path_get_card_id() repetition by adding the id variable. - More informative log message (includes the alsa card index and a suggestion to use lsof). - Replaced the separate "if (busy)" and "if (!busy)" checks with an if-else structure. Would someone like to make a patch for actually running the lsof command and including the output in the log message? I may or may do it myself at some point, but of course I'd like it if someone else did that for me :) src/modules/module-udev-detect.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c index d119f96ae..c67789293 100644 --- a/src/modules/module-udev-detect.c +++ b/src/modules/module-udev-detect.c @@ -279,6 +279,7 @@ fail: } static void verify_access(struct userdata *u, struct device *d) { + const char *id; char *cd; pa_card *card; bool accessible; @@ -286,7 +287,8 @@ static void verify_access(struct userdata *u, struct device *d) { pa_assert(u); pa_assert(d); - cd = pa_sprintf_malloc("/dev/snd/controlC%s", path_get_card_id(d->path)); + id = path_get_card_id(d->path); + cd = pa_sprintf_malloc("/dev/snd/controlC%s", id); accessible = access(cd, R_OK|W_OK) >= 0; pa_log_debug("%s is accessible: %s", cd, pa_yes_no(accessible)); @@ -307,10 +309,13 @@ static void verify_access(struct userdata *u, struct device *d) { * device closes it we will get another notification via * inotify and can then recheck. */ - busy = is_card_busy(path_get_card_id(d->path)); - pa_log_debug("%s is busy: %s", d->path, pa_yes_no(busy)); + busy = is_card_busy(id); - if (!busy) { + if (busy) + pa_log_warn(_("Can't use sound card %s (alsa card index: %s), because some other program is using it. " + "This command may be helpful in figuring what program that is: lsof /dev/snd/pcmC%s*"), + d->card_name, id, id); + else { /* So, why do we rate limit here? It's certainly ugly, * but there seems to be no other way. Problem is -- 2.17.0