[pulseaudio-discuss] [PATCH] Don't settle on a card profile if it doesn't have any available port

Mario Sanchez Prada mario at endlessm.com
Mon Mar 23 10:49:30 PDT 2015


Hi Raymond,

On 21/03/15 08:16, Raymond Yau wrote:
>>
>> When creating a new card and selecting a new profile we need to check
>> whether there's a port available for that profile before settling on it,
>> or we might end up with a useless profile when we might have others that
>> would be a better choice.
> 
> Most PCI/PCIE sound cards used by desktop does not have any jack detection
> 
> do you consider them as always available ?
> 

Assuming the availability for those jacks will be PA_AVAILABLE_UNKNOWN, then
the answer is "Yes". This is how that functionality is implemented:

+static bool profile_contains_available_ports(pa_card_profile *profile) {
+    pa_card *card;
+    pa_device_port *port;
+    void *state;
+
+    pa_assert(profile);
+
+    card = profile->card;
+    pa_assert(card);
+
+    PA_HASHMAP_FOREACH(port, card->ports, state) {
+        if (pa_hashmap_get(port->profiles, profile->name)
+            && port->available != PA_AVAILABLE_NO)
+            return true;
+    }
+
+    return false;
+}

I understand that those kind of sound cards will report jack availability as
UNKNOWN. Therefore, profiles related to those cards would be considered to
always have ports available according to the snippet above.

Does that answer your question?

Thanks,
Mario


More information about the pulseaudio-discuss mailing list