mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: put card name in udev monitor event
So that we can use it to construct a good name for the card. Fixes #524
This commit is contained in:
parent
bf25fc1388
commit
9b9b85ddbf
2 changed files with 12 additions and 2 deletions
|
|
@ -241,8 +241,8 @@ static int emit_object_info(struct impl *this, struct device *device)
|
|||
struct udev_device *dev = device->dev;
|
||||
snd_ctl_t *ctl_hndl;
|
||||
const char *str;
|
||||
char path[32];
|
||||
struct spa_dict_item items[23];
|
||||
char path[32], *cn = NULL, *cln = NULL;
|
||||
struct spa_dict_item items[25];
|
||||
uint32_t n_items = 0;
|
||||
int res, pcm;
|
||||
|
||||
|
|
@ -287,6 +287,10 @@ static int emit_object_info(struct impl *this, struct device *device)
|
|||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_MEDIA_CLASS, "Audio/Device");
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_ALSA_PATH, path);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_ALSA_CARD, path+3);
|
||||
if (snd_card_get_name(id, &cn) >= 0)
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_ALSA_CARD_NAME, cn);
|
||||
if (snd_card_get_longname(id, &cln) >= 0)
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_ALSA_CARD_LONGNAME, cln);
|
||||
|
||||
if ((str = udev_device_get_property_value(dev, "ACP_NAME")) && *str)
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_NAME, str);
|
||||
|
|
@ -362,6 +366,8 @@ static int emit_object_info(struct impl *this, struct device *device)
|
|||
|
||||
spa_device_emit_object_info(&this->hooks, id, &info);
|
||||
device->emited = true;
|
||||
free(cn);
|
||||
free(cln);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,6 +212,8 @@ static struct node *alsa_create_node(struct device *device, uint32_t id,
|
|||
int i, priority;
|
||||
|
||||
pw_log_debug("new node %u", id);
|
||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||
spa_debug_dict(0, info->props);
|
||||
|
||||
if (strcmp(info->type, SPA_TYPE_INTERFACE_Node) != 0) {
|
||||
errno = EINVAL;
|
||||
|
|
@ -846,6 +848,8 @@ static struct device *alsa_create_device(struct impl *impl, uint32_t id,
|
|||
const char *str, *card, *rules;
|
||||
|
||||
pw_log_debug("new device %u", id);
|
||||
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
|
||||
spa_debug_dict(0, info->props);
|
||||
|
||||
if (strcmp(info->type, SPA_TYPE_INTERFACE_Device) != 0) {
|
||||
errno = EINVAL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue