[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] alsa-ucm: Fix UCM devices which names share a prefix being seen as the same

Arun Raghavan gitlab at gitlab.freedesktop.org
Thu Dec 27 11:40:55 UTC 2018


Arun Raghavan pushed to branch master at PulseAudio / pulseaudio


Commits:
adef9a44 by Hans de Goede at 2018-12-24T11:45:48Z
alsa-ucm: Fix UCM devices which names share a prefix being seen as the same

Before this commit ucm_port_contains() was using a strncmp to compare
UCM-device-names without first checking that the part of the port_name
being compared and the device-name have the same length, this was causing
it to return true for both "InternalMic-IN1" and "InternalMic-IN12" when
port_name contained "InternalMic-IN1".

We hit this with the bytcr_rt5651 UCM profile which has "InternalMic-IN1",
"InternalMic-IN2" and "InternalMic-IN12" devices, for devices with their
internal mic connected to IN1, or IN2, or using stereo internal mics
connected to both. This problem resulted in various problems including
the RECMIXL? BST2 switch getting turned on when selecting only
"InternalMic-IN1", as well as confusing the gnome-control-center sound
panel, which could not figure out which device is selected in this case.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>

- - - - -


1 changed file:

- src/modules/alsa/alsa-ucm.c


Changes:

=====================================
src/modules/alsa/alsa-ucm.c
=====================================
@@ -809,7 +809,7 @@ static int ucm_port_contains(const char *port_name, const char *dev_name, bool i
     port_name += is_sink ? strlen(PA_UCM_PRE_TAG_OUTPUT) : strlen(PA_UCM_PRE_TAG_INPUT);
 
     while ((r = pa_split_in_place(port_name, "+", &len, &state))) {
-        if (!strncmp(r, dev_name, len)) {
+        if (strlen(dev_name) == len && !strncmp(r, dev_name, len)) {
             ret = 1;
             break;
         }



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/adef9a442196a9b5ad6da16f7a88419ab1a4cac8

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/adef9a442196a9b5ad6da16f7a88419ab1a4cac8
You're receiving this email because of your account on gitlab.freedesktop.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20181227/9a7a9509/attachment.html>


More information about the pulseaudio-commits mailing list