mirror of
https://github.com/pulseaudio/pulseaudio.git
synced 2024-11-23 18:03:32 +08:00
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@redhat.com>
This commit is contained in:
parent
1b7fab22a4
commit
adef9a4421
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user