[PATCH 13/30] sink, source: Better error reporting for port change failures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It doesn't make sense to blindly return PA_ERR_NOENTITY whenever
a port change fails.

The only place that reports failures is the UCM code. The "normal"
ALSA port switching code ignores any errors, and Bluetooth doesn't
need to care port switching at all, because all sinks and sources
have only one port.
---
 src/modules/alsa/alsa-ucm.c | 4 ++--
 src/pulsecore/sink.c        | 2 +-
 src/pulsecore/source.c      | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
index 28e922e..26ed4b5 100644
--- a/src/modules/alsa/alsa-ucm.c
+++ b/src/modules/alsa/alsa-ucm.c
@@ -852,7 +852,7 @@ int pa_alsa_ucm_set_port(pa_alsa_ucm_mapping_context *context, pa_device_port *p
             pa_log_debug("Disable ucm device %s", dev_name);
             if (snd_use_case_set(ucm->ucm_mgr, "_disdev", dev_name) < 0) {
                 pa_log("Failed to disable ucm device %s", dev_name);
-                ret = -1;
+                ret = -PA_ERR_INTERNAL;
                 break;
             }
         }
@@ -862,7 +862,7 @@ int pa_alsa_ucm_set_port(pa_alsa_ucm_mapping_context *context, pa_device_port *p
         pa_log_debug("Enable ucm device %s", enable_devs[i]);
         if (snd_use_case_set(ucm->ucm_mgr, "_enadev", enable_devs[i]) < 0) {
             pa_log("Failed to enable ucm device %s", enable_devs[i]);
-            ret = -1;
+            ret = -PA_ERR_INTERNAL;
             break;
         }
     }
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 70894f2..96a4a22 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -3455,7 +3455,7 @@ int pa_sink_set_port(pa_sink *s, const char *name, bool save) {
         ret = s->set_port(s, port);
 
     if (ret < 0)
-        return -PA_ERR_NOENTITY;
+        return ret;
 
     pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
 
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 44d2f70..050e519 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -2748,7 +2748,7 @@ int pa_source_set_port(pa_source *s, const char *name, bool save) {
         ret = s->set_port(s, port);
 
     if (ret < 0)
-        return -PA_ERR_NOENTITY;
+        return ret;
 
     pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
 
-- 
1.8.3.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux