Skip to content

Commit

Permalink
Merge branch 'bluez5HspDirection' into 'master'
Browse files Browse the repository at this point in the history
droid HSP/HFP profile can have input and output

See merge request !16
  • Loading branch information
Juho Hamalainen committed Dec 1, 2017
2 parents 16108be + 558d100 commit 3dd77ef
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/modules/bluetooth/module-bluez5-device.c
Expand Up @@ -1298,8 +1298,8 @@ static pa_direction_t get_profile_direction(pa_bluetooth_profile_t p) {
[PA_BLUETOOTH_PROFILE_A2DP_SOURCE] = PA_DIRECTION_INPUT,
[PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT] = PA_DIRECTION_INPUT | PA_DIRECTION_OUTPUT,
[PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY] = PA_DIRECTION_INPUT | PA_DIRECTION_OUTPUT,
[PA_BLUETOOTH_PROFILE_DROID_HEADSET_HFP] = 0,
[PA_BLUETOOTH_PROFILE_DROID_HEADSET_HSP] = 0,
[PA_BLUETOOTH_PROFILE_DROID_HEADSET_HFP] = PA_DIRECTION_INPUT | PA_DIRECTION_OUTPUT,
[PA_BLUETOOTH_PROFILE_DROID_HEADSET_HSP] = PA_DIRECTION_INPUT | PA_DIRECTION_OUTPUT,
[PA_BLUETOOTH_PROFILE_OFF] = 0
};

Expand All @@ -1312,11 +1312,20 @@ static int init_profile(struct userdata *u) {
pa_assert(u);
pa_assert(u->profile != PA_BLUETOOTH_PROFILE_OFF);

if (setup_transport(u) < 0)
return -1;
if ((r = setup_transport(u)) < 0)
goto done;

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_DROID_HEADSET_HFP ||
u->profile == PA_BLUETOOTH_PROFILE_DROID_HEADSET_HSP)
goto done;

if (get_profile_direction (u->profile) & PA_DIRECTION_OUTPUT)
if (add_sink(u) < 0)
r = -1;
Expand All @@ -1325,6 +1334,7 @@ static int init_profile(struct userdata *u) {
if (add_source(u) < 0)
r = -1;

done:
return r;
}

Expand Down

0 comments on commit 3dd77ef

Please sign in to comment.