Fixup a few things in the new path probing

* If mapping_probe_paths() fails to open the mixer, all paths are now
removed from the mapping's path sets.
 * pa_path_set.probed isn't really used for anything (removed).
 * If profile probing is configured to be skipped, mapping_paths_probe()
should still be called.

Thanks to Tanu for spotting.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2011-12-02 10:20:23 +01:00 committed by Tanu Kaskinen
parent 426daaf6bb
commit c1f3f7709f
2 changed files with 10 additions and 8 deletions

View file

@ -2903,10 +2903,9 @@ void pa_alsa_path_set_dump(pa_alsa_path_set *ps) {
void *state; void *state;
pa_assert(ps); pa_assert(ps);
pa_log_debug("Path Set %p, direction=%i, probed=%s", pa_log_debug("Path Set %p, direction=%i",
(void*) ps, (void*) ps,
ps->direction, ps->direction);
pa_yes_no(ps->probed));
PA_HASHMAP_FOREACH(p, ps->paths, state) PA_HASHMAP_FOREACH(p, ps->paths, state)
pa_alsa_path_dump(p); pa_alsa_path_dump(p);
@ -3726,8 +3725,12 @@ static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile,
pa_assert(pcm_handle); pa_assert(pcm_handle);
mixer_handle = pa_alsa_open_mixer_for_pcm(pcm_handle, NULL); mixer_handle = pa_alsa_open_mixer_for_pcm(pcm_handle, NULL);
if (!mixer_handle) if (!mixer_handle) {
return; /* Cannot open mixer :-( */ /* Cannot open mixer, remove all entries */
while (pa_hashmap_steal_first(ps->paths));
return;
}
PA_HASHMAP_FOREACH(p, ps->paths, state) { PA_HASHMAP_FOREACH(p, ps->paths, state) {
if (pa_alsa_path_probe(p, mixer_handle, m->profile_set->ignore_dB) < 0) { if (pa_alsa_path_probe(p, mixer_handle, m->profile_set->ignore_dB) < 0) {
@ -3737,7 +3740,6 @@ static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile,
path_set_condense(ps, mixer_handle); path_set_condense(ps, mixer_handle);
path_set_make_paths_unique(ps); path_set_make_paths_unique(ps);
ps->probed = TRUE;
if (mixer_handle) if (mixer_handle)
snd_mixer_close(mixer_handle); snd_mixer_close(mixer_handle);
@ -4175,7 +4177,7 @@ void pa_alsa_profile_set_probe(
/* Is this already marked that it is supported? (i.e. from the config file) */ /* Is this already marked that it is supported? (i.e. from the config file) */
if (p->supported) if (p->supported)
continue; goto probe_paths;
pa_log_debug("Looking at profile %s", p->name); pa_log_debug("Looking at profile %s", p->name);
@ -4276,6 +4278,7 @@ void pa_alsa_profile_set_probe(
if (!p->supported) if (!p->supported)
continue; continue;
probe_paths:
pa_log_debug("Profile %s supported.", p->name); pa_log_debug("Profile %s supported.", p->name);
if (p->output_mappings) if (p->output_mappings)

View file

@ -191,7 +191,6 @@ struct pa_alsa_path {
struct pa_alsa_path_set { struct pa_alsa_path_set {
pa_hashmap *paths; pa_hashmap *paths;
pa_alsa_direction_t direction; pa_alsa_direction_t direction;
pa_bool_t probed:1;
}; };
int pa_alsa_setting_select(pa_alsa_setting *s, snd_mixer_t *m); int pa_alsa_setting_select(pa_alsa_setting *s, snd_mixer_t *m);