Skip to content

alsa: Register the card ID instead of the name

Alex Hermann requested to merge alexhe/kmix:bug340502 into master

In ALSA, only the ID is guaranteed to be unique. The name can be duplicated, expecially whe using multiple (nearly) identical cards.

There is a hint of handling duplicate card names in the registerCard() function, but this code is flawed on multiple aspects:

  1. The "discriminator" counter (s_mixerNums[cardBaseName]) is never incremented, so it will always return 0.
  2. The class in which the counter is stored, is instantiated for every card separately, so the discrimination will never be possible across multiple cards.

To circumvent, implement getId() and return the ALSA ID. This will create DBUS names based on the ID, so selecting the right card is now possible.

Because the GUI requirers unique names, the ID is also added to the name.

Fixes BKO#340502

Edited by Alex Hermann

Merge request reports