2019-05-28 20:56:40

by David Frey

[permalink] [raw]
Subject: bluetoothctl "advertise on" fails

Hi,

I have an embedded system running Yocto Linux and a desktop using Arch
Linux. Bluez is 5.50 in both cases. I'm using the same Cypress CYW20719
Bluetooth chipset connected via a UART. On the embedded system, running
"advertise on" in bluetoothctl fails with the error message:

"Failed to register advertisement: org.bluez.Error.NotPermitted"

I dug into the source code a bit and I suspect that the error is being
produced in register_advertisement() from advertising.c:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/src/advertising.c?h=5.50#n1135

On my Linux PC, running "advertise on" is successful.

The error message in the code is "Maximum advertisements reached", so I
decided to pursue that. I ran the command "dbus-send --system
--print-reply --type=method_call --dest=org.bluez /
org.freedesktop.DBus.ObjectManager.GetManagedObjects" on both the
embedded system and the PC.

This is the snippet from the embedded system that I think is pertinent:
dict entry(
string "org.bluez.LEAdvertisingManager1"
array [
dict entry(
string "ActiveInstances"
variant byte 0
)
dict entry(
string "SupportedInstances"
variant byte 0
)
dict entry(
string "SupportedIncludes"
variant array [
string "local-name"
]
)
]
)

And the corresponding snippet from the PC:
dict entry(
string "org.bluez.LEAdvertisingManager1"
array [
dict entry(
string "ActiveInstances"
variant byte 0
)
dict entry(
string "SupportedInstances"
variant byte 5
)
dict entry(
string "SupportedIncludes"
variant array [
string "tx-power"
string "appearance"
string "local-name"
]
)
]
)

I'm not sure what "SupportedIncludes" really means, but I immediately
noticed that the value for "SupportedInstances" on the embedded system
is 0 while the on the PC it's 5.

Why are these values different? Please let me know if there is any
other information that would be useful.

Thanks,
David