2013-02-28 19:51:58

by Scott James Remnant

[permalink] [raw]
Subject: Bluez 5.2 A2DP: "Unable to select SEP"

Hey,

I'm having some difficulties connecting up A2DP in BlueZ 5.2, and I'm
sure I'm just missing something obvious so would appreciate a second
set of eyes.

I had thought that to send to an A2DP Sink on a device, I needed an
A2DP Source endpoint at my end, but when I try and register that
endpoint I just get org.bluez.Error.NotSupported

I can register an A2DP Sink endpoint no problem, but then when I call
org.bluez.Device1.Connect the connection fails with "Unable to select
SEP" in the logs.

Any ideas?

Scott
--
Scott James Remnant | Chrome OS Systems | [email protected] | Google


2013-02-28 21:25:10

by Scott James Remnant

[permalink] [raw]
Subject: Re: Bluez 5.2 A2DP: "Unable to select SEP"

I guess I spoke too soon, I can get the endpoint connected with this
config change, but it just fails a little later now with
"avdtp_set_configuration: Transport endpoint is not connected"

Here's the log of the connect call; note that I see the
SelectConfiguration and reply to it on the endpoint side - but never
receive a SetConfiguration call:

bluetoothd[24139]: src/device.c:connect_profiles()
/org/bluez/hci0/dev_10_B7_F6_01_31_ED (all), client :1.389
bluetoothd[24139]: profiles/audio/manager.c:a2dp_sink_connect() path
/org/bluez/hci0/dev_10_B7_F6_01_31_ED
bluetoothd[24139]: profiles/audio/avdtp.c:avdtp_ref() 0x7f68d07c8790: ref=2
bluetoothd[24139]: profiles/audio/sink.c:sink_connect() stream
creation in progress
bluetoothd[24139]: profiles/audio/sink.c:discovery_complete() Discovery complete
bluetoothd[24139]: profiles/audio/a2dp.c:setup_ref() 0x7f68d079aff0: ref=2
bluetoothd[24139]: profiles/audio/media.c:media_endpoint_async_call()
Calling SelectConfiguration: name = :1.398 path
= /org/chromium/Cras/Bluetooth/A2DPSource
bluetoothd[24139]: profiles/audio/a2dp.c:a2dp_config() a2dp_config:
selected SEP 0x7f68d07d9640
bluetoothd[24139]: profiles/audio/a2dp.c:setup_ref() 0x7f68d079aff0: ref=3
bluetoothd[24139]: avdtp_set_configuration: Transport endpoint is not connected
bluetoothd[24139]: profiles/audio/a2dp.c:setup_unref() 0x7f68d079aff0: ref=2
bluetoothd[24139]: src/device.c:device_profile_connected() audio-sink
Input/output error (5)
bluetoothd[24139]: profiles/audio/manager.c:avrcp_control_connect()
path /org/bluez/hci0/dev_10_B7_F6_01_31_ED
bluetoothd[24139]: Failed to connect audio-avrcp: Operation not supported
bluetoothd[24139]: src/device.c:device_profile_connected() returning
response to :1.389
bluetoothd[24139]: profiles/audio/avdtp.c:avdtp_unref() 0x7f68d07c8790: ref=1
bluetoothd[24139]: profiles/audio/a2dp.c:setup_unref() 0x7f68d079aff0: ref=1

Scott

On Thu, Feb 28, 2013 at 11:51 AM, Scott James Remnant <[email protected]> wrote:
> Hey,
>
> I'm having some difficulties connecting up A2DP in BlueZ 5.2, and I'm
> sure I'm just missing something obvious so would appreciate a second
> set of eyes.
>
> I had thought that to send to an A2DP Sink on a device, I needed an
> A2DP Source endpoint at my end, but when I try and register that
> endpoint I just get org.bluez.Error.NotSupported
>
> I can register an A2DP Sink endpoint no problem, but then when I call
> org.bluez.Device1.Connect the connection fails with "Unable to select
> SEP" in the logs.
>
> Any ideas?
>
> Scott
> --
> Scott James Remnant | Chrome OS Systems | [email protected] | Google



--
Scott James Remnant | Chrome OS Systems | [email protected] | Google

2013-02-28 21:15:39

by Scott James Remnant

[permalink] [raw]
Subject: Re: Bluez 5.2 A2DP: "Unable to select SEP"

Enabling both works for me; and leave it up to the audio manager to
actually provide the Endpoints it wants to support.

Scott

On Thu, Feb 28, 2013 at 1:14 PM, Von Dentz, Luiz
<[email protected]> wrote:

> Hi Marcel, Scott,
>
> On Thu, Feb 28, 2013 at 10:49 PM, Marcel Holtmann <[email protected]> wrote:
>> Hi Scott,
>>
>>
>>>> On Thu, Feb 28, 2013 at 9:51 PM, Scott James Remnant <[email protected]> wrote:
>>>>> I'm having some difficulties connecting up A2DP in BlueZ 5.2, and I'm
>>>>> sure I'm just missing something obvious so would appreciate a second
>>>>> set of eyes.
>>>>>
>>>>> I had thought that to send to an A2DP Sink on a device, I needed an
>>>>> A2DP Source endpoint at my end, but when I try and register that
>>>>> endpoint I just get org.bluez.Error.NotSupported
>>>>
>>>> Check your /etc/bluetooth/audio.conf, you must have disabled it for some reason.
>>>>
>>>
>>> There isn't an audio.conf shipped with BlueZ 5.2; checking
>>> profiles/audio/manager.c it has:
>>>
>>> static struct enabled_interfaces enabled = {
>>> .sink = TRUE,
>>> .source = FALSE,
>>> .control = TRUE,
>>> };
>>>
>>> This seems bizarre that registering audio sinks (which I read as
>>> sending A2DP from the device to the host) is enabled by default, but
>>> not the more usual registering of an audio source (to send to an A2DP
>>> sink on the device).
>
> Yep, it was the result of changing the roles, I guess we should enable
> them both by default and if the distro don't want one of them just
> disable in the config file.
>
>> we want to move to a state where BlueZ works out-of-the-box with no extra config files needed. So I think we should just fix this and always have at least one sink and one source present.
>>
>> Or if that causes issues, then at least have this depend on PA (or some other audio manager) making that call for us. The default behaviour needs to just work.
>
> By default I would enable them both as nowadays both should work, well
> I guess this is valid for every profile that is not market as
> experimental it should be enabled by default, so how about the
> following patch:
>
> diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
> index 934227e..163fcba 100644
> --- a/profiles/audio/manager.c
> +++ b/profiles/audio/manager.c
> @@ -72,7 +72,7 @@ static GSList *devices = NULL;
>
> static struct enabled_interfaces enabled = {
> .sink = TRUE,
> - .source = FALSE,
> + .source = TRUE,
> .control = TRUE,
> };
>
> Or maybe I just remove the whole enabled thing and have the core to handle this.



--
Scott James Remnant | Chrome OS Systems | [email protected] | Google

2013-02-28 21:14:03

by Von Dentz, Luiz

[permalink] [raw]
Subject: Re: Bluez 5.2 A2DP: "Unable to select SEP"

Hi Marcel, Scott,

On Thu, Feb 28, 2013 at 10:49 PM, Marcel Holtmann <[email protected]> wrote:
> Hi Scott,
>
>
>>> On Thu, Feb 28, 2013 at 9:51 PM, Scott James Remnant <[email protected]> wrote:
>>>> I'm having some difficulties connecting up A2DP in BlueZ 5.2, and I'm
>>>> sure I'm just missing something obvious so would appreciate a second
>>>> set of eyes.
>>>>
>>>> I had thought that to send to an A2DP Sink on a device, I needed an
>>>> A2DP Source endpoint at my end, but when I try and register that
>>>> endpoint I just get org.bluez.Error.NotSupported
>>>
>>> Check your /etc/bluetooth/audio.conf, you must have disabled it for some reason.
>>>
>>
>> There isn't an audio.conf shipped with BlueZ 5.2; checking
>> profiles/audio/manager.c it has:
>>
>> static struct enabled_interfaces enabled = {
>> .sink = TRUE,
>> .source = FALSE,
>> .control = TRUE,
>> };
>>
>> This seems bizarre that registering audio sinks (which I read as
>> sending A2DP from the device to the host) is enabled by default, but
>> not the more usual registering of an audio source (to send to an A2DP
>> sink on the device).

Yep, it was the result of changing the roles, I guess we should enable
them both by default and if the distro don't want one of them just
disable in the config file.

> we want to move to a state where BlueZ works out-of-the-box with no extra config files needed. So I think we should just fix this and always have at least one sink and one source present.
>
> Or if that causes issues, then at least have this depend on PA (or some other audio manager) making that call for us. The default behaviour needs to just work.

By default I would enable them both as nowadays both should work, well
I guess this is valid for every profile that is not market as
experimental it should be enabled by default, so how about the
following patch:

diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
index 934227e..163fcba 100644
--- a/profiles/audio/manager.c
+++ b/profiles/audio/manager.c
@@ -72,7 +72,7 @@ static GSList *devices = NULL;

static struct enabled_interfaces enabled = {
.sink = TRUE,
- .source = FALSE,
+ .source = TRUE,
.control = TRUE,
};

Or maybe I just remove the whole enabled thing and have the core to handle this.

2013-02-28 20:49:29

by Marcel Holtmann

[permalink] [raw]
Subject: Re: Bluez 5.2 A2DP: "Unable to select SEP"

Hi Scott,


>> On Thu, Feb 28, 2013 at 9:51 PM, Scott James Remnant <[email protected]> wrote:
>>> I'm having some difficulties connecting up A2DP in BlueZ 5.2, and I'm
>>> sure I'm just missing something obvious so would appreciate a second
>>> set of eyes.
>>>
>>> I had thought that to send to an A2DP Sink on a device, I needed an
>>> A2DP Source endpoint at my end, but when I try and register that
>>> endpoint I just get org.bluez.Error.NotSupported
>>
>> Check your /etc/bluetooth/audio.conf, you must have disabled it for some reason.
>>
>
> There isn't an audio.conf shipped with BlueZ 5.2; checking
> profiles/audio/manager.c it has:
>
> static struct enabled_interfaces enabled = {
> .sink = TRUE,
> .source = FALSE,
> .control = TRUE,
> };
>
> This seems bizarre that registering audio sinks (which I read as
> sending A2DP from the device to the host) is enabled by default, but
> not the more usual registering of an audio source (to send to an A2DP
> sink on the device).

we want to move to a state where BlueZ works out-of-the-box with no extra config files needed. So I think we should just fix this and always have at least one sink and one source present.

Or if that causes issues, then at least have this depend on PA (or some other audio manager) making that call for us. The default behaviour needs to just work.

Regards

Marcel


2013-02-28 20:32:21

by Scott James Remnant

[permalink] [raw]
Subject: Re: Bluez 5.2 A2DP: "Unable to select SEP"

On Thu, Feb 28, 2013 at 12:23 PM, Von Dentz, Luiz
<[email protected]> wrote:

> On Thu, Feb 28, 2013 at 9:51 PM, Scott James Remnant <[email protected]> wrote:
>> I'm having some difficulties connecting up A2DP in BlueZ 5.2, and I'm
>> sure I'm just missing something obvious so would appreciate a second
>> set of eyes.
>>
>> I had thought that to send to an A2DP Sink on a device, I needed an
>> A2DP Source endpoint at my end, but when I try and register that
>> endpoint I just get org.bluez.Error.NotSupported
>
> Check your /etc/bluetooth/audio.conf, you must have disabled it for some reason.
>

There isn't an audio.conf shipped with BlueZ 5.2; checking
profiles/audio/manager.c it has:

static struct enabled_interfaces enabled = {
.sink = TRUE,
.source = FALSE,
.control = TRUE,
};

This seems bizarre that registering audio sinks (which I read as
sending A2DP from the device to the host) is enabled by default, but
not the more usual registering of an audio source (to send to an A2DP
sink on the device).

>> I can register an A2DP Sink endpoint no problem, but then when I call
>> org.bluez.Device1.Connect the connection fails with "Unable to select
>> SEP" in the logs.
>
> You need to register a A2DP Source endpoint in case you want to send
> to a Sink, maybe what happened is that we change the roles in the
> audio.conf, it used to be the remote role/interface but I think commit
> 3a45f6e39fb89da3e518c43aa1bde5f41209c07d has changed that probably by
> mistake since it doesn't mention anything in the description of the
> patch.
>

Looking at this patch, it looks like the behavior before was that you
could register both if either Source or Sink were enabled, and since
Sink was enabled, you could enable Sources.

> Now the question is, shall we bring the old behavior back? In the long
> term I think we will move away of plugin specific config file such as
> audio.conf and have something in main.conf to disable the
> plugins/profiles.

I guess, but I think the basic problem here is just that the defaults
are wrong? It looks like they're flipped compared to the sensible
default? ie.

diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
index 934227e..dfff565 100644
--- a/profiles/audio/manager.c
+++ b/profiles/audio/manager.c
@@ -71,8 +71,8 @@ static GKeyFile *config = NULL;
static GSList *devices = NULL;

static struct enabled_interfaces enabled = {
- .sink = TRUE,
- .source = FALSE,
+ .sink = FALSE,
+ .source = TRUE,
.control = TRUE,
};


Would be what we actually want by default?

Scott
--
Scott James Remnant | Chrome OS Systems | [email protected] | Google

2013-02-28 20:23:57

by Von Dentz, Luiz

[permalink] [raw]
Subject: Re: Bluez 5.2 A2DP: "Unable to select SEP"

Hi Scott,

On Thu, Feb 28, 2013 at 9:51 PM, Scott James Remnant <[email protected]> wrote:
> Hey,
>
> I'm having some difficulties connecting up A2DP in BlueZ 5.2, and I'm
> sure I'm just missing something obvious so would appreciate a second
> set of eyes.
>
> I had thought that to send to an A2DP Sink on a device, I needed an
> A2DP Source endpoint at my end, but when I try and register that
> endpoint I just get org.bluez.Error.NotSupported

Check your /etc/bluetooth/audio.conf, you must have disabled it for some reason.

> I can register an A2DP Sink endpoint no problem, but then when I call
> org.bluez.Device1.Connect the connection fails with "Unable to select
> SEP" in the logs.

You need to register a A2DP Source endpoint in case you want to send
to a Sink, maybe what happened is that we change the roles in the
audio.conf, it used to be the remote role/interface but I think commit
3a45f6e39fb89da3e518c43aa1bde5f41209c07d has changed that probably by
mistake since it doesn't mention anything in the description of the
patch.

Now the question is, shall we bring the old behavior back? In the long
term I think we will move away of plugin specific config file such as
audio.conf and have something in main.conf to disable the
plugins/profiles.

2013-03-01 13:20:39

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: Bluez 5.2 A2DP: "Unable to select SEP"

HI Mikel,

On Fri, Mar 1, 2013 at 12:47 PM, Mikel Astiz <[email protected]> wrote:
> Hi,
>
> On Thu, Feb 28, 2013 at 10:15 PM, Scott James Remnant <[email protected]> wrote:
>> Enabling both works for me; and leave it up to the audio manager to
>> actually provide the Endpoints it wants to support.
>>
>> Scott
>>
>> On Thu, Feb 28, 2013 at 1:14 PM, Von Dentz, Luiz
>> <[email protected]> wrote:
>>
>>> Hi Marcel, Scott,
>>>
>>> On Thu, Feb 28, 2013 at 10:49 PM, Marcel Holtmann <[email protected]> wrote:
>>>> Hi Scott,
>>>>
>>>>
>>>>>> On Thu, Feb 28, 2013 at 9:51 PM, Scott James Remnant <[email protected]> wrote:
>>>>>>> I'm having some difficulties connecting up A2DP in BlueZ 5.2, and I'm
>>>>>>> sure I'm just missing something obvious so would appreciate a second
>>>>>>> set of eyes.
>>>>>>>
>>>>>>> I had thought that to send to an A2DP Sink on a device, I needed an
>>>>>>> A2DP Source endpoint at my end, but when I try and register that
>>>>>>> endpoint I just get org.bluez.Error.NotSupported
>>>>>>
>>>>>> Check your /etc/bluetooth/audio.conf, you must have disabled it for some reason.
>>>>>>
>>>>>
>>>>> There isn't an audio.conf shipped with BlueZ 5.2; checking
>>>>> profiles/audio/manager.c it has:
>>>>>
>>>>> static struct enabled_interfaces enabled = {
>>>>> .sink = TRUE,
>>>>> .source = FALSE,
>>>>> .control = TRUE,
>>>>> };
>>>>>
>>>>> This seems bizarre that registering audio sinks (which I read as
>>>>> sending A2DP from the device to the host) is enabled by default, but
>>>>> not the more usual registering of an audio source (to send to an A2DP
>>>>> sink on the device).
>>>
>>> Yep, it was the result of changing the roles, I guess we should enable
>>> them both by default and if the distro don't want one of them just
>>> disable in the config file.
>>>
>>>> we want to move to a state where BlueZ works out-of-the-box with no extra config files needed. So I think we should just fix this and always have at least one sink and one source present.
>>>>
>>>> Or if that causes issues, then at least have this depend on PA (or some other audio manager) making that call for us. The default behaviour needs to just work.
>>>
>>> By default I would enable them both as nowadays both should work, well
>>> I guess this is valid for every profile that is not market as
>>> experimental it should be enabled by default, so how about the
>>> following patch:
>>>
>>> diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
>>> index 934227e..163fcba 100644
>>> --- a/profiles/audio/manager.c
>>> +++ b/profiles/audio/manager.c
>>> @@ -72,7 +72,7 @@ static GSList *devices = NULL;
>>>
>>> static struct enabled_interfaces enabled = {
>>> .sink = TRUE,
>>> - .source = FALSE,
>>> + .source = TRUE,
>>> .control = TRUE,
>>> };
>>>
>>> Or maybe I just remove the whole enabled thing and have the core to handle this.
>
> I agree enabling all is the best choice.
>
> In fact, I've seen that distros like Ubuntu have patched BlueZ (4.101)
> to enable them by default (in the source code), and nobody seemed to
> complain about this so far.

Ive send a set removing this from audio plugin, let me know if you
have some comments.

--
Luiz Augusto von Dentz

2013-03-01 10:47:10

by Mikel Astiz

[permalink] [raw]
Subject: Re: Bluez 5.2 A2DP: "Unable to select SEP"

Hi,

On Thu, Feb 28, 2013 at 10:15 PM, Scott James Remnant <[email protected]> wrote:
> Enabling both works for me; and leave it up to the audio manager to
> actually provide the Endpoints it wants to support.
>
> Scott
>
> On Thu, Feb 28, 2013 at 1:14 PM, Von Dentz, Luiz
> <[email protected]> wrote:
>
>> Hi Marcel, Scott,
>>
>> On Thu, Feb 28, 2013 at 10:49 PM, Marcel Holtmann <[email protected]> wrote:
>>> Hi Scott,
>>>
>>>
>>>>> On Thu, Feb 28, 2013 at 9:51 PM, Scott James Remnant <[email protected]> wrote:
>>>>>> I'm having some difficulties connecting up A2DP in BlueZ 5.2, and I'm
>>>>>> sure I'm just missing something obvious so would appreciate a second
>>>>>> set of eyes.
>>>>>>
>>>>>> I had thought that to send to an A2DP Sink on a device, I needed an
>>>>>> A2DP Source endpoint at my end, but when I try and register that
>>>>>> endpoint I just get org.bluez.Error.NotSupported
>>>>>
>>>>> Check your /etc/bluetooth/audio.conf, you must have disabled it for some reason.
>>>>>
>>>>
>>>> There isn't an audio.conf shipped with BlueZ 5.2; checking
>>>> profiles/audio/manager.c it has:
>>>>
>>>> static struct enabled_interfaces enabled = {
>>>> .sink = TRUE,
>>>> .source = FALSE,
>>>> .control = TRUE,
>>>> };
>>>>
>>>> This seems bizarre that registering audio sinks (which I read as
>>>> sending A2DP from the device to the host) is enabled by default, but
>>>> not the more usual registering of an audio source (to send to an A2DP
>>>> sink on the device).
>>
>> Yep, it was the result of changing the roles, I guess we should enable
>> them both by default and if the distro don't want one of them just
>> disable in the config file.
>>
>>> we want to move to a state where BlueZ works out-of-the-box with no extra config files needed. So I think we should just fix this and always have at least one sink and one source present.
>>>
>>> Or if that causes issues, then at least have this depend on PA (or some other audio manager) making that call for us. The default behaviour needs to just work.
>>
>> By default I would enable them both as nowadays both should work, well
>> I guess this is valid for every profile that is not market as
>> experimental it should be enabled by default, so how about the
>> following patch:
>>
>> diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
>> index 934227e..163fcba 100644
>> --- a/profiles/audio/manager.c
>> +++ b/profiles/audio/manager.c
>> @@ -72,7 +72,7 @@ static GSList *devices = NULL;
>>
>> static struct enabled_interfaces enabled = {
>> .sink = TRUE,
>> - .source = FALSE,
>> + .source = TRUE,
>> .control = TRUE,
>> };
>>
>> Or maybe I just remove the whole enabled thing and have the core to handle this.

I agree enabling all is the best choice.

In fact, I've seen that distros like Ubuntu have patched BlueZ (4.101)
to enable them by default (in the source code), and nobody seemed to
complain about this so far.

Cheers,
Mikel

2013-03-01 09:17:08

by Von Dentz, Luiz

[permalink] [raw]
Subject: Re: Bluez 5.2 A2DP: "Unable to select SEP"

Hi Scott,

On Thu, Feb 28, 2013 at 11:25 PM, Scott James Remnant <[email protected]> wrote:
> I guess I spoke too soon, I can get the endpoint connected with this
> config change, but it just fails a little later now with
> "avdtp_set_configuration: Transport endpoint is not connected"
>
> Here's the log of the connect call; note that I see the
> SelectConfiguration and reply to it on the endpoint side - but never
> receive a SetConfiguration call:
>
> bluetoothd[24139]: src/device.c:connect_profiles()
> /org/bluez/hci0/dev_10_B7_F6_01_31_ED (all), client :1.389
> bluetoothd[24139]: profiles/audio/manager.c:a2dp_sink_connect() path
> /org/bluez/hci0/dev_10_B7_F6_01_31_ED
> bluetoothd[24139]: profiles/audio/avdtp.c:avdtp_ref() 0x7f68d07c8790: ref=2
> bluetoothd[24139]: profiles/audio/sink.c:sink_connect() stream
> creation in progress
> bluetoothd[24139]: profiles/audio/sink.c:discovery_complete() Discovery complete

There is something off in this log, you should be getting at least the
following:

bluetoothd[27965]: profiles/audio/avdtp.c:avdtp_connect_cb() AVDTP:
connected signaling channel to 58:17:0C:EB:F1:D6
bluetoothd[27965]: profiles/audio/avdtp.c:avdtp_connect_cb() AVDTP
imtu=672, omtu=339

Otherwise there is no chance that discovery would complete without an
error, anyway I wasn't able to reproduce with current upstream code
which btw have some regression fixes when using PulseAudio BlueZ 5
testing tree but apparently that is not the case here.