2015-07-16 10:30:06

by dogan yazar

[permalink] [raw]
Subject: Advertising API, possible to set LE only?

In the Advertising API, org.bluez.LEAdvertisement1 has Type field
which can be "broadcast" or "peripheral".
When I set it to be peripheral, the outgoing advertisement packets has
the advertisement flags:
0x02 (BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE) and I guess that is why
when I try to connect the peripheral from my Android, I get a pairing
request back.

Is there a way to set BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED on the
flags as well to show I only support LE and so I can also skip the
pairing requests.


2015-07-22 10:53:38

by dogan yazar

[permalink] [raw]
Subject: Re: Advertising API, possible to set LE only?

On Fri, Jul 17, 2015 at 5:30 PM, Johan Hedberg <[email protected]> wrote:
> Hi dogan,
>
> On Fri, Jul 17, 2015, dogan yazar wrote:
>> Thanks! This worked well. Any hints for me to track down why
>> "ControllerMode=le in the [General] section of
>> /etc/bluetooth/main.conf" did not work fine? Running a shell command
>> from our software is not a very neat solution.
>
> Enable bluetoothd debug logs (-d command line switch) and check if
> there's anything suspicious when you start bluetoothd. Btw, which BlueZ
> version do you have? The ControllerMode option was first introduced in
> BlueZ 5.25.

Thanks! Apparently it was a cheap mistake on my side. Since I wanted
to test latest bluez, I have installed from the source files with
default configuration, the conf file I should have updated was under
/usr/local. So it works great now!

2015-07-17 15:30:00

by Johan Hedberg

[permalink] [raw]
Subject: Re: Advertising API, possible to set LE only?

Hi dogan,

On Fri, Jul 17, 2015, dogan yazar wrote:
> Thanks! This worked well. Any hints for me to track down why
> "ControllerMode=le in the [General] section of
> /etc/bluetooth/main.conf" did not work fine? Running a shell command
> from our software is not a very neat solution.

Enable bluetoothd debug logs (-d command line switch) and check if
there's anything suspicious when you start bluetoothd. Btw, which BlueZ
version do you have? The ControllerMode option was first introduced in
BlueZ 5.25.

Johan

2015-07-17 15:03:33

by dogan yazar

[permalink] [raw]
Subject: Re: Advertising API, possible to set LE only?

On Thu, Jul 16, 2015 at 10:39 PM, Marcel Holtmann <[email protected]> wrote:
> Hi Johan,
>
>>> Thanks a lot for the answer. That is exactly what I need. However
>>> putting in the main.conf did not really make any reference and trying
>>> the btmgmt returns "Rejected"
>>> [mgmt]# bredr off
>>> Set BR/EDR for hci0 failed with status 0x0b (Rejected)
>>>
>>> Any idea why? Is it controller related?
>>
>> First of all, please don't top-post on this list. I think you need to
>> power off the adapter before you can disable BR/EDR, i.e. "btmgmt power
>> off".

Thanks! This worked well. Any hints for me to track down why
"ControllerMode=le in the [General] section of
/etc/bluetooth/main.conf" did not work fine? Running a shell command
from our software is not a very neat solution.


>
> actually you need to power off the controller, enable LE and only then you can turn off BR/EDR. Of course you require a dual-mode BR/EDR + LE controller in the first place to do this.

This is also good to know. Thanks! LE was enabled by default so did
not need it this time.

>
> Regards
>
> Marcel
>

2015-07-16 20:39:25

by Marcel Holtmann

[permalink] [raw]
Subject: Re: Advertising API, possible to set LE only?

Hi Johan,

>> Thanks a lot for the answer. That is exactly what I need. However
>> putting in the main.conf did not really make any reference and trying
>> the btmgmt returns "Rejected"
>> [mgmt]# bredr off
>> Set BR/EDR for hci0 failed with status 0x0b (Rejected)
>>
>> Any idea why? Is it controller related?
>
> First of all, please don't top-post on this list. I think you need to
> power off the adapter before you can disable BR/EDR, i.e. "btmgmt power
> off".

actually you need to power off the controller, enable LE and only then you can turn off BR/EDR. Of course you require a dual-mode BR/EDR + LE controller in the first place to do this.

Regards

Marcel


2015-07-16 13:10:04

by Johan Hedberg

[permalink] [raw]
Subject: Re: Advertising API, possible to set LE only?

Hi dogan,

On Thu, Jul 16, 2015, dogan yazar wrote:
> Thanks a lot for the answer. That is exactly what I need. However
> putting in the main.conf did not really make any reference and trying
> the btmgmt returns "Rejected"
> [mgmt]# bredr off
> Set BR/EDR for hci0 failed with status 0x0b (Rejected)
>
> Any idea why? Is it controller related?

First of all, please don't top-post on this list. I think you need to
power off the adapter before you can disable BR/EDR, i.e. "btmgmt power
off".

Johan

2015-07-16 12:49:09

by dogan yazar

[permalink] [raw]
Subject: Re: Advertising API, possible to set LE only?

Thanks a lot for the answer. That is exactly what I need. However
putting in the main.conf did not really make any reference and trying
the btmgmt returns "Rejected"
[mgmt]# bredr off
Set BR/EDR for hci0 failed with status 0x0b (Rejected)

Any idea why? Is it controller related?

On Thu, Jul 16, 2015 at 12:59 PM, Johan Hedberg <[email protected]> wrote:
> Hi dogan,
>
> On Thu, Jul 16, 2015, dogan yazar wrote:
>> In the Advertising API, org.bluez.LEAdvertisement1 has Type field
>> which can be "broadcast" or "peripheral".
>> When I set it to be peripheral, the outgoing advertisement packets has
>> the advertisement flags:
>> 0x02 (BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE) and I guess that is why
>> when I try to connect the peripheral from my Android, I get a pairing
>> request back.
>>
>> Is there a way to set BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED on the
>> flags as well to show I only support LE and so I can also skip the
>> pairing requests.
>
> You could try setting ControllerMode=le in the [General] section of
> /etc/bluetooth/main.conf and restart bluetoothd. Another option is to
> disable BR/EDR manually with btmgmt ("btmgmt bredr off").
>
> Johan

2015-07-16 10:59:37

by Johan Hedberg

[permalink] [raw]
Subject: Re: Advertising API, possible to set LE only?

Hi dogan,

On Thu, Jul 16, 2015, dogan yazar wrote:
> In the Advertising API, org.bluez.LEAdvertisement1 has Type field
> which can be "broadcast" or "peripheral".
> When I set it to be peripheral, the outgoing advertisement packets has
> the advertisement flags:
> 0x02 (BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE) and I guess that is why
> when I try to connect the peripheral from my Android, I get a pairing
> request back.
>
> Is there a way to set BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED on the
> flags as well to show I only support LE and so I can also skip the
> pairing requests.

You could try setting ControllerMode=le in the [General] section of
/etc/bluetooth/main.conf and restart bluetoothd. Another option is to
disable BR/EDR manually with btmgmt ("btmgmt bredr off").

Johan