diff mbox series

[v2,08/10] adapter: Add support for experimental flag

Message ID 20230516205924.1040506-8-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 28917a3c7a4ec1078e5cb4adf2652e36f65f6034
Headers show
Series [v2,01/10] profile: Add support for experimental flag | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Luiz Augusto von Dentz May 16, 2023, 8:59 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds experimental field to btd_adapter_driver so the plugin can
indicate drivers that depends on experimental to be enabled.
---
 src/adapter.c | 6 ++++++
 src/adapter.h | 5 +++++
 2 files changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/src/adapter.c b/src/adapter.c
index cc7f891d96d9..74ed52468b81 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -7447,6 +7447,12 @@  static void adapter_stop(struct btd_adapter *adapter)
 
 int btd_register_adapter_driver(struct btd_adapter_driver *driver)
 {
+	if (driver->experimental && !(g_dbus_get_flags() &
+					G_DBUS_FLAG_ENABLE_EXPERIMENTAL)) {
+		DBG("D-Bus experimental not enabled");
+		return -ENOTSUP;
+	}
+
 	adapter_drivers = g_slist_append(adapter_drivers, driver);
 
 	if (driver->probe == NULL)
diff --git a/src/adapter.h b/src/adapter.h
index a45ac1bab00e..32e49a933b13 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -127,6 +127,11 @@  struct btd_adapter_driver {
 						struct btd_device *device);
 	void (*device_resolved)(struct btd_adapter *adapter,
 						struct btd_device *device);
+
+	/* Indicates the driver is experimental and shall only be registered
+	 * when experimental has been enabled (see: main.conf:Experimental).
+	 */
+	bool experimental;
 };
 
 void device_resolved_drivers(struct btd_adapter *adapter,