alsa: use the local alibpref of the card

The _alibpref of the device was created in the session manager and
does not match our local _alibpref. Patch the device name with
the local _alibpref to make things match.

See #1286
This commit is contained in:
Wim Taymans 2021-06-10 13:23:18 +02:00
parent 23a0f29d48
commit 283e13629c

View file

@ -23,6 +23,7 @@ int spa_alsa_init(struct state *state)
if (state->open_ucm) {
char card_name[64];
const char *alibpref = NULL;
snprintf(card_name, sizeof(card_name), "hw:%i", state->card_index);
err = snd_use_case_mgr_open(&state->ucm, card_name);
@ -44,6 +45,14 @@ int spa_alsa_init(struct state *state)
return err;
}
}
if ((snd_use_case_get(state->ucm, "_alibpref", &alibpref) != 0))
alibpref = NULL;
if (alibpref != NULL) {
size_t len = strlen(alibpref);
if (len > 4 && strncmp(state->props.device, alibpref, 4) == 0)
memcpy(state->props.device, alibpref, len);
}
}
return 0;
}