summaryrefslogtreecommitdiffstats
path: root/src/modules/alsa
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/alsa')
-rw-r--r--src/modules/alsa/alsa-sink.c2
-rw-r--r--src/modules/alsa/alsa-source.c2
-rw-r--r--src/modules/alsa/alsa-util.c42
-rw-r--r--src/modules/alsa/alsa-util.h1
-rw-r--r--src/modules/alsa/module-alsa-card.c1
5 files changed, 37 insertions, 11 deletions
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 708e020c..d4325881 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1667,6 +1667,8 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_DESCRIPTION, profile->description);
}
+ pa_alsa_init_description(data.proplist);
+
u->sink = pa_sink_new(m->core, &data, PA_SINK_HARDWARE|PA_SINK_LATENCY);
pa_sink_new_data_done(&data);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 4321c7ff..7a1b0f8d 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1509,6 +1509,8 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_DESCRIPTION, profile->description);
}
+ pa_alsa_init_description(data.proplist);
+
u->source = pa_source_new(m->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY);
pa_source_new_data_done(&data);
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index 6740c069..7d833ff7 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -47,6 +47,10 @@
#include "hal-util.h"
#endif
+#ifdef HAVE_UDEV
+#include "udev-util.h"
+#endif
+
struct pa_alsa_fdlist {
unsigned num_fds;
struct pollfd *fds;
@@ -1362,6 +1366,26 @@ void pa_alsa_redirect_errors_dec(void) {
snd_lib_error_set_handler(NULL);
}
+pa_bool_t pa_alsa_init_description(pa_proplist *p) {
+ const char *s;
+ pa_assert(p);
+
+ if (pa_device_init_description(p))
+ return TRUE;
+
+ if ((s = pa_proplist_gets(p, "alsa.card_name"))) {
+ pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, s);
+ return TRUE;
+ }
+
+ if ((s = pa_proplist_gets(p, "alsa.name"))) {
+ pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, s);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) {
char *cn, *lcn, *dn;
@@ -1385,6 +1409,10 @@ void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) {
pa_xfree(dn);
}
+#ifdef HAVE_UDEV
+ pa_udev_get_info(c, p, card);
+#endif
+
#ifdef HAVE_HAL
pa_hal_get_info(c, p, card);
#endif
@@ -1411,7 +1439,7 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *
snd_pcm_class_t class;
snd_pcm_subclass_t subclass;
- const char *n, *id, *sdn, *cn = NULL;
+ const char *n, *id, *sdn;
int card;
pa_assert(p);
@@ -1426,6 +1454,7 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *
if (alsa_class_table[class])
pa_proplist_sets(p, "alsa.class", alsa_class_table[class]);
}
+
subclass = snd_pcm_info_get_subclass(pcm_info);
if (subclass <= SND_PCM_SUBCLASS_LAST)
if (alsa_subclass_table[subclass])
@@ -1443,17 +1472,8 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *
pa_proplist_setf(p, "alsa.device", "%u", snd_pcm_info_get_device(pcm_info));
- if ((card = snd_pcm_info_get_card(pcm_info)) >= 0) {
+ if ((card = snd_pcm_info_get_card(pcm_info)) >= 0)
pa_alsa_init_proplist_card(c, p, card);
- cn = pa_proplist_gets(p, "alsa.card_name");
- }
-
- if (cn && n && !strstr(cn, n) && !strstr(n, cn))
- pa_proplist_setf(p, PA_PROP_DEVICE_DESCRIPTION, "%s, %s", cn, n);
- else if (cn && (!n || strstr(cn, n)))
- pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, cn);
- else if (n)
- pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, n);
}
void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm) {
diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h
index 899532e2..a8397ae9 100644
--- a/src/modules/alsa/alsa-util.h
+++ b/src/modules/alsa/alsa-util.h
@@ -123,6 +123,7 @@ void pa_alsa_redirect_errors_dec(void);
void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *pcm_info);
void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card);
void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm);
+pa_bool_t pa_alsa_init_description(pa_proplist *p);
int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents);
diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index fc6b886b..9e149a48 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -318,6 +318,7 @@ int pa__init(pa_module *m) {
data.module = m;
pa_alsa_init_proplist_card(m->core, data.proplist, alsa_card_index);
pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, u->device_id);
+ pa_alsa_init_description(data.proplist);
set_card_name(&data, ma, u->device_id);
if (reserve)