[PATCH 14/17] bluetooth: Allow policy module to pick 'off' profile

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

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

This allow 'off' profile to be choosen when no other profile is available
which is considered better since it requires less resources than other
profiles.
---
 src/modules/bluetooth/module-bluetooth-policy.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/modules/bluetooth/module-bluetooth-policy.c b/src/modules/bluetooth/module-bluetooth-policy.c
index 8bbda3d..9746332 100644
--- a/src/modules/bluetooth/module-bluetooth-policy.c
+++ b/src/modules/bluetooth/module-bluetooth-policy.c
@@ -143,12 +143,9 @@ static pa_card_profile *find_best_profile(pa_card *card) {
     void *state;
     pa_card_profile *profile;
     pa_card_profile *result = card->active_profile;
-    pa_card_profile *off;
-
-    pa_assert_se(off = pa_hashmap_get(card->profiles, "off"));
 
     PA_HASHMAP_FOREACH(profile, card->profiles, state) {
-        if (profile->available == PA_AVAILABLE_NO || profile == off)
+        if (profile->available == PA_AVAILABLE_NO)
             continue;
 
         if (result == NULL ||
@@ -157,7 +154,7 @@ static pa_card_profile *find_best_profile(pa_card *card) {
             result = profile;
     }
 
-    return result ? result : off;
+    return result;
 }
 
 static pa_hook_result_t profile_available_hook_callback(pa_core *c, pa_card_profile *profile, void *userdata) {
@@ -170,6 +167,8 @@ static pa_hook_result_t profile_available_hook_callback(pa_core *c, pa_card_prof
     pa_assert(profile);
     pa_assert_se((card = profile->card));
 
+    pa_log_debug("Card '%s' profile '%s' available '%u'", card->name, profile->name, profile->available);
+
     /* Only consider bluetooth cards */
     s = pa_proplist_gets(card->proplist, PA_PROP_DEVICE_BUS);
     if (!s || !pa_streq(s, "bluetooth"))
-- 
1.9.3



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

  Powered by Linux