Skip to content

Commit

Permalink
sfos: bluez5: Don't create sinks or sources with droid backend.
Browse files Browse the repository at this point in the history
When running in droid setup we don't create sinks or sources,
as the reading and writing to headset is done through
droid.sink and droid.source with sco ports enabled.
  • Loading branch information
jusa committed Mar 21, 2019
1 parent 87eeea2 commit 9b8ba28
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/modules/bluetooth/module-bluez5-device.c
Expand Up @@ -1464,6 +1464,16 @@ static int init_profile(struct userdata *u) {

pa_assert(u->transport);

/* droid headset profiles don't have sink or source,
* as the reading and writing to headset is done through
* droid.sink and droid.source with sco ports enabled.
* this module is used only for setting up the transport.
*/
if (u->profile != PA_BLUETOOTH_PROFILE_A2DP_SINK &&
u->profile != PA_BLUETOOTH_PROFILE_A2DP_SOURCE &&
pa_bluetooth_droid_backend(u->discovery))
return r;

if (get_profile_direction (u->profile) & PA_DIRECTION_OUTPUT)
if (add_sink(u) < 0)
r = -1;
Expand Down Expand Up @@ -2175,7 +2185,17 @@ static int add_card(struct userdata *u) {

u->card->userdata = u;
u->card->set_profile = set_profile_cb;
pa_card_choose_initial_profile(u->card);
/* SFOS specific change:
* Instead of calling now
* pa_card_choose_initial_profile(u->card);
* we just set active profile to Off.
* When policy framework sees this new card
* it will then choose proper profile based
* on current system state.
*/
u->card->active_profile = cp; /* off */
u->card->save_profile = false;
pa_hook_fire(&u->card->core->hooks[PA_CORE_HOOK_CARD_CHOOSE_INITIAL_PROFILE], u->card);
pa_card_put(u->card);

p = PA_CARD_PROFILE_DATA(u->card->active_profile);
Expand Down Expand Up @@ -2301,6 +2321,9 @@ static pa_hook_result_t transport_speaker_gain_changed_cb(pa_bluetooth_discovery
if (t != u->transport)
return PA_HOOK_OK;

if (pa_bluetooth_droid_backend(y))
return PA_HOOK_OK;

gain = t->speaker_gain;
volume = (pa_volume_t) (gain * PA_VOLUME_NORM / HSP_MAX_GAIN);

Expand Down Expand Up @@ -2328,6 +2351,9 @@ static pa_hook_result_t transport_microphone_gain_changed_cb(pa_bluetooth_discov
if (t != u->transport)
return PA_HOOK_OK;

if (pa_bluetooth_droid_backend(y))
return PA_HOOK_OK;

gain = t->microphone_gain;
volume = (pa_volume_t) (gain * PA_VOLUME_NORM / HSP_MAX_GAIN);

Expand Down

0 comments on commit 9b8ba28

Please sign in to comment.