On Thu, 2015-11-05 at 14:19 +0100, David Henningsson wrote: > > On 2015-10-29 13:22, Tanu Kaskinen wrote: > > On Tue, 2015-10-27 at 16:09 +0100, David Henningsson wrote: > > > Fill in input_name and output_name to make routing easier for > > > routing modules. > > > > > > Signed-off-by: David Henningsson <david.henningsson at canonical.com> > > > --- > > >  src/modules/alsa/alsa-mixer.c       | 14 +++++++++++++- > > >  src/modules/alsa/alsa-mixer.h       |  3 +++ > > >  src/modules/alsa/module-alsa-card.c |  2 ++ > > >  3 files changed, 18 insertions(+), 1 deletion(-) > > > > > > diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa- > > > mixer.c > > > index 486da83..4623677 100644 > > > --- a/src/modules/alsa/alsa-mixer.c > > > +++ b/src/modules/alsa/alsa-mixer.c > > > @@ -3465,6 +3465,8 @@ static void profile_free(pa_alsa_profile *p) { > > > > > >       pa_xfree(p->name); > > >       pa_xfree(p->description); > > > +    pa_xfree(p->input_name); > > > +    pa_xfree(p->output_name); > > > > > >       pa_xstrfreev(p->input_mapping_names); > > >       pa_xstrfreev(p->output_mapping_names); > > > @@ -4115,6 +4117,7 @@ static void profile_set_add_auto_pair( > > >       p->name = name; > > > > > >       if (m) { > > > +        p->output_name = pa_xstrdup(m->name); > > >           p->output_mappings = > > > pa_idxset_new(pa_idxset_trivial_hash_func, > > > pa_idxset_trivial_compare_func); > > >           pa_idxset_put(p->output_mappings, m, NULL); > > >           p->priority += m->priority * 100; > > > @@ -4122,6 +4125,7 @@ static void profile_set_add_auto_pair( > > >       } > > > > > >       if (n) { > > > +        p->input_name = pa_xstrdup(n->name); > > >           p->input_mappings = > > > pa_idxset_new(pa_idxset_trivial_hash_func, > > > pa_idxset_trivial_compare_func); > > >           pa_idxset_put(p->input_mappings, n, NULL); > > >           p->priority += n->priority; > > > @@ -4172,6 +4176,9 @@ static int profile_verify(pa_alsa_profile *p) { > > >       if (p->output_mapping_names) { > > >           char **name; > > > > > > +        if (!p->output_name && !p->input_mapping_names) > > > +            p->output_name = pa_xstrdup(p->name); > > > > Do you have an example where setting the input/output_name to the > > profile name is helpful? It's weird that sometimes the name refers to a > > mapping name and sometimes to the profile name, and I haven't figured > > out when the profile name makes sense. > > Sorry for the late reply. It is to distinguish between "no info > available" and "unidirectional profile". If input_name and output_name > are both NULL, it means that the backend has not supplied information. > > If either is NULL but not the other one, it indicates a unidirectional > profile. We fill in the profile name there because it is a unique name. > > I'm not sure whether this would actually help, though, I mostly added it > because it felt like the right thing to do. And if it helps, it's > probably in edge cases only, so I can remove it if you like. I would like that, yes. As far as I can see, output_name and input_name are only useful if the same name is shared between multiple profiles, and that never happens if the profile name is used. -- Tanu