summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/alsa/alsa-sink.c5
-rw-r--r--src/modules/alsa/alsa-source.c5
-rw-r--r--src/modules/alsa/alsa-util.c12
-rw-r--r--src/modules/alsa/alsa-util.h2
4 files changed, 24 insertions, 0 deletions
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index b43fa06d..cdf1ca80 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1617,6 +1617,11 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
pa_assert(u->device_name);
pa_log_info("Successfully opened device %s.", u->device_name);
+ if (pa_alsa_pcm_is_modem(u->pcm_handle)) {
+ pa_log_notice("Device %s is modem, refusing further initialization.", u->device_name);
+ goto fail;
+ }
+
if (profile)
pa_log_info("Selected configuration '%s' (%s).", profile->description, profile->name);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 348cd082..d9c60103 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1469,6 +1469,11 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
pa_assert(u->device_name);
pa_log_info("Successfully opened device %s.", u->device_name);
+ if (pa_alsa_pcm_is_modem(u->pcm_handle)) {
+ pa_log_notice("Device %s is modem, refusing further initialization.", u->device_name);
+ goto fail;
+ }
+
if (profile)
pa_log_info("Selected configuration '%s' (%s).", profile->description, profile->name);
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index be8cd1cb..870cf0f1 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -1769,3 +1769,15 @@ pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm) {
return snd_pcm_info_get_card(info) >= 0;
}
+
+pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm) {
+ snd_pcm_info_t* info;
+ snd_pcm_info_alloca(&info);
+
+ pa_assert(pcm);
+
+ if (snd_pcm_info(pcm, info) < 0)
+ return FALSE;
+
+ return snd_pcm_info_get_class(info) == SND_PCM_CLASS_MODEM;
+}
diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h
index 5cad2958..94f27d14 100644
--- a/src/modules/alsa/alsa-util.h
+++ b/src/modules/alsa/alsa-util.h
@@ -141,4 +141,6 @@ char *pa_alsa_get_reserve_name(const char *device);
pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm);
+pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm);
+
#endif