aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/pulseaudio/pulseaudio/0002-alsa-bluetooth-fail-if-user-requested-profile-doesn-.patch
blob: be3655b23cfcb6df6e8993da300ca9b4a88f9ba9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 339eb179baa7810113f6456accc05b3a32c1cdba Mon Sep 17 00:00:00 2001
From: Tanu Kaskinen <tanuk@iki.fi>
Date: Fri, 23 Oct 2015 12:36:34 +0300
Subject: [PATCH 2/4] alsa, bluetooth: fail if user-requested profile doesn't
 exist

If we can't fulfill the user request fully, I think we shouldn't
fulfill it at all, to make it clear that the requested operation
didn't succeed.

http://bugzilla.yoctoproject.org/show_bug.cgi?id=8448

Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>

Upstream-Status: Denied [The patch set needs some work to be accepted.
The review thread:
http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/24301]

Signed-off-by: Tanu Kaskinen <tanuk@iki.fi>
---
 src/modules/alsa/module-alsa-card.c          | 10 ++++++++--
 src/modules/bluetooth/module-bluez4-device.c |  6 ++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index a7fec04..32f517e 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -754,8 +754,14 @@ int pa__init(pa_module *m) {
         goto fail;
     }
 
-    if ((profile = pa_modargs_get_value(u->modargs, "profile", NULL)))
-        pa_card_new_data_set_profile(&data, profile);
+    if ((profile = pa_modargs_get_value(u->modargs, "profile", NULL))) {
+        if (pa_hashmap_get(data.profiles, profile))
+            pa_card_new_data_set_profile(&data, profile);
+        else {
+            pa_log("No such profile: %s", profile);
+            goto fail;
+        }
+    }
 
     u->card = pa_card_new(m->core, &data);
     pa_card_new_data_done(&data);
diff --git a/src/modules/bluetooth/module-bluez4-device.c b/src/modules/bluetooth/module-bluez4-device.c
index b40c6a0..94e6988 100644
--- a/src/modules/bluetooth/module-bluez4-device.c
+++ b/src/modules/bluetooth/module-bluez4-device.c
@@ -2310,8 +2310,10 @@ static int add_card(struct userdata *u) {
     if ((default_profile = pa_modargs_get_value(u->modargs, "profile", NULL))) {
         if (pa_hashmap_get(data.profiles, default_profile))
             pa_card_new_data_set_profile(&data, default_profile);
-        else
-            pa_log_warn("Profile '%s' not valid or not supported by device.", default_profile);
+        else {
+            pa_log("Profile '%s' not valid or not supported by device.", default_profile);
+            return -1;
+        }
     }
 
     u->card = pa_card_new(u->core, &data);
-- 
2.1.4