profile: Add support for experimental flag
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 15 May 2023 20:22:51 +0000 (13:22 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 5 Jan 2024 10:41:35 +0000 (16:11 +0530)
This adds experimental field to btd_profile so the plugin can indicate
drivers that depends on experimental to be enabled.

src/profile.c
src/profile.h

index 3c699a8..192d7bd 100644 (file)
@@ -1086,6 +1086,12 @@ static struct btd_profile *btd_profile_find_uuid(const char *uuid)
 
 int btd_profile_register(struct btd_profile *profile)
 {
+       if (profile->experimental && !(g_dbus_get_flags() &
+                                       G_DBUS_FLAG_ENABLE_EXPERIMENTAL)) {
+               DBG("D-Bus experimental not enabled");
+               return -ENOTSUP;
+       }
+
        profiles = g_slist_append(profiles, profile);
        return 0;
 }
index 42e434d..02291c1 100644 (file)
@@ -28,6 +28,11 @@ struct btd_profile {
         */
        bool external;
 
+       /* Indicates the profile is experimental and shall only be registered
+        * when experimental has been enabled (see: main.conf:Experimental).
+        */
+       bool experimental;
+
        int (*device_probe) (struct btd_service *service);
        void (*device_remove) (struct btd_service *service);