Commit c0bfd9ff authored by Marijn Suijten's avatar Marijn Suijten 🦀
Browse files

bluetooth: Mark profile available when the peer supports it

parent 8f285d27
......@@ -194,7 +194,7 @@ static const char *transport_state_to_string(pa_bluetooth_transport_state_t stat
return "invalid";
}
static bool device_supports_profile(pa_bluetooth_device *device, pa_bluetooth_profile_t profile) {
bool device_supports_profile(pa_bluetooth_device *device, pa_bluetooth_profile_t profile) {
bool show_hfp, show_hsp;
if (device->enable_hfp_hf) {
......
......@@ -206,4 +206,6 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y);
void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y);
void pa_bluetooth_discovery_set_ofono_running(pa_bluetooth_discovery *y, bool is_running);
bool pa_bluetooth_discovery_get_enable_native_hfp_hf(pa_bluetooth_discovery *y);
bool device_supports_profile(pa_bluetooth_device *device, pa_bluetooth_profile_t profile);
#endif
......@@ -2011,10 +2011,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, pa_bluetooth_pro
*p = profile;
if (u->device->transports[*p])
cp->available = transport_state_to_availability(u->device->transports[*p]->state);
else
cp->available = PA_AVAILABLE_NO;
cp->available = device_supports_profile(u->device, profile) ? PA_AVAILABLE_YES : PA_AVAILABLE_NO;
return cp;
}
......@@ -2198,13 +2195,8 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot
pa_assert(t);
pa_assert_se(cp = pa_hashmap_get(u->card->profiles, pa_bluetooth_profile_to_string(t->profile)));
// TODO: Makes no sense to check this anymore, but maybe that breaks the boolean?
oldavail = cp->available;
/*
* If codec switching is in progress, transport state change should not
* make profile unavailable.
*/
if (!t->device->codec_switching_in_progress)
pa_card_profile_set_available(cp, transport_state_to_availability(t->state));
/* Update port availability */
pa_assert_se(port = pa_hashmap_get(u->card->ports, u->output_port_name));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment