mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
spa: acp: indicate ALSA UCM profile errors in UIs
Add "[ALSA UCM error]" to the end of card description, to indicate something is wrong.
This commit is contained in:
parent
ba3a36b3d1
commit
d58d2a2375
3 changed files with 29 additions and 1 deletions
|
|
@ -498,6 +498,7 @@ static void add_profiles(pa_card *impl)
|
|||
int n_profiles, n_ports, n_devices;
|
||||
uint32_t idx;
|
||||
const char *arr;
|
||||
bool broken_ucm = false;
|
||||
|
||||
n_devices = 0;
|
||||
pa_dynarray_init(&impl->out.devices, device_free);
|
||||
|
|
@ -541,6 +542,9 @@ static void add_profiles(pa_card *impl)
|
|||
dev->ports, NULL);
|
||||
|
||||
pa_dynarray_append(&ap->out.devices, dev);
|
||||
|
||||
if (m->split && m->split->broken)
|
||||
broken_ucm = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -564,6 +568,9 @@ static void add_profiles(pa_card *impl)
|
|||
dev->ports, NULL);
|
||||
|
||||
pa_dynarray_append(&ap->out.devices, dev);
|
||||
|
||||
if (m->split && m->split->broken)
|
||||
broken_ucm = true;
|
||||
}
|
||||
}
|
||||
cp->n_devices = pa_dynarray_size(&ap->out.devices);
|
||||
|
|
@ -571,6 +578,22 @@ static void add_profiles(pa_card *impl)
|
|||
pa_hashmap_put(impl->profiles, ap->name, cp);
|
||||
}
|
||||
|
||||
|
||||
/* Add a conspicuous notice if there are errors in the UCM profile */
|
||||
if (broken_ucm) {
|
||||
const char *desc;
|
||||
char *new_desc = NULL;
|
||||
|
||||
desc = pa_proplist_gets(impl->proplist, PA_PROP_DEVICE_DESCRIPTION);
|
||||
if (!desc)
|
||||
desc = "";
|
||||
new_desc = spa_aprintf(_("%s [ALSA UCM error]"), desc);
|
||||
pa_log_notice("Errors in ALSA UCM profile for card %s", desc);
|
||||
if (new_desc)
|
||||
pa_proplist_sets(impl->proplist, PA_PROP_DEVICE_DESCRIPTION, new_desc);
|
||||
free(new_desc);
|
||||
}
|
||||
|
||||
pa_dynarray_init(&impl->out.ports, NULL);
|
||||
n_ports = 0;
|
||||
PA_HASHMAP_FOREACH(dp, impl->ports, state) {
|
||||
|
|
|
|||
|
|
@ -381,9 +381,11 @@ static pa_alsa_ucm_split *ucm_get_split_channels(pa_alsa_ucm_device *device, snd
|
|||
if (pa_atou(value, &idx) < 0)
|
||||
break;
|
||||
|
||||
if (idx >= hw_channels)
|
||||
if (idx >= hw_channels) {
|
||||
pa_log_notice("Error in ALSA UCM profile for %s (%s): %sChannel%d=%d >= %sChannels=%d",
|
||||
pcm_name, device_name, prefix, i, idx, prefix, hw_channels);
|
||||
split->broken = true;
|
||||
}
|
||||
|
||||
value = ucm_get_string(uc_mgr, "%sChannelPos%d/%s", prefix, i, device_name);
|
||||
if (!value) {
|
||||
|
|
@ -2453,10 +2455,12 @@ static snd_pcm_t* mapping_open_pcm(pa_alsa_ucm_config *ucm, pa_alsa_mapping *m,
|
|||
/* Just accept whatever we got... Some of the routings won't get connected
|
||||
* anywhere */
|
||||
m->split->hw_channels = try_map.channels;
|
||||
m->split->broken = true;
|
||||
} else if (try_map.channels > m->split->hw_channels) {
|
||||
pa_log_notice("Error in ALSA UCM profile for %s (%s): %sChannels=%d < avail %d",
|
||||
m->device_strings[0], m->name, mode_name, m->split->hw_channels, try_map.channels);
|
||||
m->split->hw_channels = try_map.channels;
|
||||
m->split->broken = true;
|
||||
}
|
||||
} else if (!exact_channels) {
|
||||
m->channel_map = try_map;
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ struct pa_alsa_ucm_split {
|
|||
int channels;
|
||||
int idx[PA_CHANNELS_MAX];
|
||||
enum snd_pcm_chmap_position pos[PA_CHANNELS_MAX];
|
||||
bool broken;
|
||||
};
|
||||
|
||||
struct pa_alsa_ucm_device {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue