public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] advertising: Fix reporting advertising properties
@ 2021-12-15 18:05 Claudio Takahasi
  2021-12-15 18:42 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 7+ messages in thread
From: Claudio Takahasi @ 2021-12-15 18:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

InterfacesAdded signal for LEAdvertisingManager1 might be emitted
containing initial/default properties values and property changed is
not emitted after reading advertising features. This patch registers
the interface (LEAdvertisingManager1) after reading advertising features
from kernel.
---
 src/advertising.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/advertising.c b/src/advertising.c
index 41b818650..2110f17c9 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -1786,6 +1786,13 @@ static void read_adv_features_callback(uint8_t status, uint16_t length,
 	manager->max_ads = feat->max_instances;
 	manager->supported_flags |= feat->supported_flags;
 
+	/* Registering interface after querying properties */
+	if (!g_dbus_register_interface(btd_get_dbus_connection(),
+				       adapter_get_path(manager->adapter),
+				       LE_ADVERTISING_MGR_IFACE, methods,
+				       NULL, properties, manager, NULL))
+		error("Failed to register " LE_ADVERTISING_MGR_IFACE);
+
 	if (manager->max_ads == 0)
 		return;
 
@@ -1861,14 +1868,6 @@ static struct btd_adv_manager *manager_create(struct btd_adapter *adapter,
 	manager->min_tx_power = ADV_TX_POWER_NO_PREFERENCE;
 	manager->max_tx_power = ADV_TX_POWER_NO_PREFERENCE;
 
-	if (!g_dbus_register_interface(btd_get_dbus_connection(),
-					adapter_get_path(manager->adapter),
-					LE_ADVERTISING_MGR_IFACE, methods,
-					NULL, properties, manager, NULL)) {
-		error("Failed to register " LE_ADVERTISING_MGR_IFACE);
-		goto fail;
-	}
-
 	if (!mgmt_send(manager->mgmt, MGMT_OP_READ_ADV_FEATURES,
 				manager->mgmt_index, 0, NULL,
 				read_adv_features_callback, manager, NULL)) {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-02-04 15:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-15 18:05 [PATCH BlueZ] advertising: Fix reporting advertising properties Claudio Takahasi
2021-12-15 18:42 ` [BlueZ] " bluez.test.bot
2021-12-15 22:53   ` Luiz Augusto von Dentz
2022-02-03 23:04     ` Marijn Suijten
2022-02-04  1:06       ` Luiz Augusto von Dentz
2022-02-04  1:43         ` Luiz Augusto von Dentz
2022-02-04 15:41           ` Marijn Suijten

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox