alsa-ucm: Fix UCM devices which names share a prefix being seen as the same
authorHans de Goede <hdegoede@redhat.com>
Mon, 24 Dec 2018 11:45:48 +0000 (12:45 +0100)
committerHans de Goede <hdegoede@redhat.com>
Mon, 24 Dec 2018 11:45:48 +0000 (12:45 +0100)
commitadef9a442196a9b5ad6da16f7a88419ab1a4cac8
tree14ea6cd2f6b0e1c4c595cfcf904f0197491c9701
parent1b7fab22a419ad284a28e84083ba29cae2fb4b2f
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>
src/modules/alsa/alsa-ucm.c