All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/4 v2] audio: Remove profile enabling/disabling logic
@ 2013-03-04 13:58 Luiz Augusto von Dentz
  2013-03-04 13:58 ` [PATCH BlueZ 2/4 v2] core: Add DisableProfiles entry to main.conf Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2013-03-04 13:58 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This should be handle by the core for all profiles
---
v2: Don't use main_opts for storing disabled profiles list and cleanup hcid.h

 profiles/audio/audio.conf |  4 ---
 profiles/audio/manager.c  | 62 ++++++-----------------------------------------
 2 files changed, 8 insertions(+), 58 deletions(-)

diff --git a/profiles/audio/audio.conf b/profiles/audio/audio.conf
index f556610..067b3fc 100644
--- a/profiles/audio/audio.conf
+++ b/profiles/audio/audio.conf
@@ -6,7 +6,3 @@
 
 # Switch to master role for incoming connections (defaults to true)
 #Master=true
-
-# If we want to disable support for specific services
-# Defaults to supporting the services: Sink, Control
-#Disable=Source
diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
index 934227e..42a2b58 100644
--- a/profiles/audio/manager.c
+++ b/profiles/audio/manager.c
@@ -70,12 +70,6 @@
 static GKeyFile *config = NULL;
 static GSList *devices = NULL;
 
-static struct enabled_interfaces enabled = {
-	.sink		= TRUE,
-	.source		= FALSE,
-	.control	= TRUE,
-};
-
 static struct audio_device *get_audio_dev(struct btd_device *device)
 {
 	return manager_get_audio_device(device, TRUE);
@@ -410,47 +404,12 @@ void audio_control_disconnected(struct btd_device *dev, int err)
 
 int audio_manager_init(GKeyFile *conf)
 {
-	char **list;
-	int i;
-
-	if (!conf)
-		goto proceed;
-
-	config = conf;
-
-	list = g_key_file_get_string_list(config, "General", "Enable",
-						NULL, NULL);
-	for (i = 0; list && list[i] != NULL; i++) {
-		if (g_str_equal(list[i], "Sink"))
-			enabled.sink = TRUE;
-		else if (g_str_equal(list[i], "Source"))
-			enabled.source = TRUE;
-		else if (g_str_equal(list[i], "Control"))
-			enabled.control = TRUE;
-	}
-	g_strfreev(list);
-
-	list = g_key_file_get_string_list(config, "General", "Disable",
-						NULL, NULL);
-	for (i = 0; list && list[i] != NULL; i++) {
-		if (g_str_equal(list[i], "Sink"))
-			enabled.sink = FALSE;
-		else if (g_str_equal(list[i], "Source"))
-			enabled.source = FALSE;
-		else if (g_str_equal(list[i], "Control"))
-			enabled.control = FALSE;
-	}
-	g_strfreev(list);
+	if (conf)
+		config = conf;
 
-proceed:
-	if (enabled.source)
-		btd_profile_register(&a2dp_source_profile);
-
-	if (enabled.sink)
-		btd_profile_register(&a2dp_sink_profile);
-
-	if (enabled.control)
-		btd_profile_register(&avrcp_profile);
+	btd_profile_register(&a2dp_source_profile);
+	btd_profile_register(&a2dp_sink_profile);
+	btd_profile_register(&avrcp_profile);
 
 	btd_register_adapter_driver(&media_driver);
 
@@ -464,14 +423,9 @@ void audio_manager_exit(void)
 		config = NULL;
 	}
 
-	if (enabled.source)
-		btd_profile_unregister(&a2dp_source_profile);
-
-	if (enabled.sink)
-		btd_profile_unregister(&a2dp_sink_profile);
-
-	if (enabled.control)
-		btd_profile_unregister(&avrcp_profile);
+	btd_profile_unregister(&a2dp_source_profile);
+	btd_profile_unregister(&a2dp_sink_profile);
+	btd_profile_unregister(&avrcp_profile);
 
 	btd_unregister_adapter_driver(&media_driver);
 }
-- 
1.8.1.2


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

* [PATCH BlueZ 2/4 v2] core: Add DisableProfiles entry to main.conf
  2013-03-04 13:58 [PATCH BlueZ 1/4 v2] audio: Remove profile enabling/disabling logic Luiz Augusto von Dentz
@ 2013-03-04 13:58 ` Luiz Augusto von Dentz
  2013-03-05  1:12   ` Anderson Lizardo
  2013-03-04 13:58 ` [PATCH BlueZ 3/4] core: Move plugin_init and plugin_cleanup to plugin.h Luiz Augusto von Dentz
  2013-03-04 13:58 ` [PATCH BlueZ 4/4] core: Move rfkill_init and rfkill_cleanup to rfkill.h Luiz Augusto von Dentz
  2 siblings, 1 reply; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2013-03-04 13:58 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This entry can be used to globally disable profiles, this is specially
useful for qualification purposes where some platforms may decide to
only qualify a subset of the supported profiles.
---
 src/main.c    | 17 +++++++++++++++--
 src/main.conf |  4 ++++
 src/profile.c | 26 +++++++++++++++++++++++++-
 src/profile.h |  2 +-
 4 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/src/main.c b/src/main.c
index 1e40ebc..62a88cd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -65,6 +65,7 @@
 #define SHUTDOWN_GRACE_SECONDS 10
 
 struct main_opts main_opts;
+static char **disabled_profiles = NULL;
 
 static const char * const supported_options[] = {
 	"Name",
@@ -76,6 +77,7 @@ static const char * const supported_options[] = {
 	"ReverseServiceDiscovery",
 	"NameResolving",
 	"DebugKeys",
+	"DisableProfiles"
 };
 
 static GKeyFile *load_config(const char *file)
@@ -263,6 +265,15 @@ static void parse_config(GKeyFile *config)
 		g_clear_error(&err);
 	else
 		main_opts.debug_keys = boolean;
+
+	str = g_key_file_get_string(config, "General", "DisableProfiles", &err);
+	if (err) {
+		DBG("%s", err->message);
+		g_clear_error(&err);
+	} else {
+		disabled_profiles = g_strsplit(str, " ", -1);
+		g_free(str);
+	}
 }
 
 static void init_defaults(void)
@@ -538,7 +549,7 @@ int main(int argc, char *argv[])
 
 	btd_device_init();
 	btd_agent_init();
-	btd_profile_init();
+	btd_profile_init(disabled_profiles);
 
 	if (option_experimental)
 		gdbus_flags = G_DBUS_FLAG_ENABLE_EXPERIMENTAL;
@@ -600,8 +611,10 @@ int main(int argc, char *argv[])
 
 	g_main_loop_unref(event_loop);
 
-	if (config)
+	if (config) {
 		g_key_file_free(config);
+		g_strfreev(disabled_profiles);
+	}
 
 	disconnect_dbus();
 
diff --git a/src/main.conf b/src/main.conf
index a94274a..5c648bf 100644
--- a/src/main.conf
+++ b/src/main.conf
@@ -46,3 +46,7 @@
 # makes debug link keys valid only for the duration of the connection
 # that they were created for.
 #DebugKeys = false
+
+# Disable Profile, both driver name and 128 bits UUIDs can be used.
+# By default all profiles are enabled.
+#DisableProfiles = <profile1> <profile2> ...
diff --git a/src/profile.c b/src/profile.c
index 656506a..6d39a41 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -585,6 +585,7 @@ static GSList *custom_props = NULL;
 
 static GSList *profiles = NULL;
 static GSList *ext_profiles = NULL;
+static char **blacklist = NULL;
 
 void btd_profile_foreach(void (*func)(struct btd_profile *p, void *data),
 								void *data)
@@ -610,6 +611,27 @@ void btd_profile_foreach(void (*func)(struct btd_profile *p, void *data),
 
 int btd_profile_register(struct btd_profile *profile)
 {
+	int i;
+
+	if (blacklist == NULL)
+		goto done;
+
+	for (i = 0; blacklist[i]; i++) {
+		if (g_pattern_match_simple(blacklist[i], profile->name) == 0)
+			return -EPROTONOSUPPORT;
+
+		if (profile->local_uuid != NULL && strcasecmp(blacklist[i],
+						profile->local_uuid) == 0)
+			return -EPROTONOSUPPORT;
+
+		if (profile->remote_uuids == NULL)
+			continue;
+
+		if (strcasecmp(blacklist[i], profile->remote_uuids[0]) == 0)
+			return -EPROTONOSUPPORT;
+	}
+
+done:
 	profiles = g_slist_append(profiles, profile);
 	return 0;
 }
@@ -2335,8 +2357,10 @@ bool btd_profile_remove_custom_prop(const char *uuid, const char *name)
 	return false;
 }
 
-void btd_profile_init(void)
+void btd_profile_init(char **disabled_profiles)
 {
+	blacklist = disabled_profiles;
+
 	g_dbus_register_interface(btd_get_dbus_connection(),
 				"/org/bluez", "org.bluez.ProfileManager1",
 				methods, NULL, NULL, NULL, NULL);
diff --git a/src/profile.h b/src/profile.h
index d858925..75b40fb 100644
--- a/src/profile.h
+++ b/src/profile.h
@@ -74,5 +74,5 @@ bool btd_profile_add_custom_prop(const char *uuid, const char *type,
 					void *user_data);
 bool btd_profile_remove_custom_prop(const char *uuid, const char *name);
 
-void btd_profile_init(void);
+void btd_profile_init(char **disabled_profiles);
 void btd_profile_cleanup(void);
-- 
1.8.1.2


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

* [PATCH BlueZ 3/4] core: Move plugin_init and plugin_cleanup to plugin.h
  2013-03-04 13:58 [PATCH BlueZ 1/4 v2] audio: Remove profile enabling/disabling logic Luiz Augusto von Dentz
  2013-03-04 13:58 ` [PATCH BlueZ 2/4 v2] core: Add DisableProfiles entry to main.conf Luiz Augusto von Dentz
@ 2013-03-04 13:58 ` Luiz Augusto von Dentz
  2013-03-04 18:50   ` Marcel Holtmann
  2013-03-04 13:58 ` [PATCH BlueZ 4/4] core: Move rfkill_init and rfkill_cleanup to rfkill.h Luiz Augusto von Dentz
  2 siblings, 1 reply; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2013-03-04 13:58 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 profiles/input/manager.c  | 2 ++
 profiles/scanparam/scan.c | 2 ++
 src/hcid.h                | 3 ---
 src/main.c                | 1 +
 src/plugin.h              | 2 ++
 5 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/profiles/input/manager.c b/profiles/input/manager.c
index 6ed12ee..e1e1057 100644
--- a/profiles/input/manager.c
+++ b/profiles/input/manager.c
@@ -32,6 +32,8 @@
 #include <bluetooth/sdp.h>
 #include <bluetooth/sdp_lib.h>
 
+#include <glib.h>
+
 #include "log.h"
 #include "plugin.h"
 
diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c
index 268bdc8..8428816 100644
--- a/profiles/scanparam/scan.c
+++ b/profiles/scanparam/scan.c
@@ -31,6 +31,8 @@
 
 #include <bluetooth/bluetooth.h>
 
+#include <glib.h>
+
 #include "lib/uuid.h"
 #include "log.h"
 #include "plugin.h"
diff --git a/src/hcid.h b/src/hcid.h
index ea67cc2..294e844 100644
--- a/src/hcid.h
+++ b/src/hcid.h
@@ -41,9 +41,6 @@ struct main_opts {
 
 extern struct main_opts main_opts;
 
-gboolean plugin_init(const char *enable, const char *disable);
-void plugin_cleanup(void);
-
 void rfkill_init(void);
 void rfkill_exit(void);
 
diff --git a/src/main.c b/src/main.c
index 62a88cd..23d598f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -56,6 +56,7 @@
 #include "agent.h"
 #include "profile.h"
 #include "systemd.h"
+#include "plugin.h"
 
 #define BLUEZ_NAME "org.bluez"
 
diff --git a/src/plugin.h b/src/plugin.h
index 89c7b85..f281cd9 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -39,6 +39,8 @@ struct bluetooth_plugin_desc {
 		struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \
 			#name, version, priority, init, exit \
 		};
+gboolean plugin_init(const char *enable, const char *disable);
+void plugin_cleanup(void);
 #else
 #define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \
 		extern struct btd_debug_desc __start___debug[] \
-- 
1.8.1.2


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

* [PATCH BlueZ 4/4] core: Move rfkill_init and rfkill_cleanup to rfkill.h
  2013-03-04 13:58 [PATCH BlueZ 1/4 v2] audio: Remove profile enabling/disabling logic Luiz Augusto von Dentz
  2013-03-04 13:58 ` [PATCH BlueZ 2/4 v2] core: Add DisableProfiles entry to main.conf Luiz Augusto von Dentz
  2013-03-04 13:58 ` [PATCH BlueZ 3/4] core: Move plugin_init and plugin_cleanup to plugin.h Luiz Augusto von Dentz
@ 2013-03-04 13:58 ` Luiz Augusto von Dentz
  2 siblings, 0 replies; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2013-03-04 13:58 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

---
 Makefile.am  |  3 ++-
 src/hcid.h   |  3 ---
 src/main.c   |  1 +
 src/rfkill.c |  2 +-
 src/rfkill.h | 24 ++++++++++++++++++++++++
 5 files changed, 28 insertions(+), 5 deletions(-)
 create mode 100644 src/rfkill.h

diff --git a/Makefile.am b/Makefile.am
index f75b8d6..0451ff8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -127,7 +127,8 @@ src_bluetoothd_SOURCES = $(gdbus_sources) $(builtin_sources) \
 			src/bluetooth.ver \
 			src/main.c src/log.h src/log.c \
 			src/systemd.h src/systemd.c \
-			src/rfkill.c src/hcid.h src/sdpd.h \
+			src/rfkill.c src/rfkill.h \
+			src/hcid.h src/sdpd.h \
 			src/sdpd-server.c src/sdpd-request.c \
 			src/sdpd-service.c src/sdpd-database.c \
 			src/attrib-server.h src/attrib-server.c \
diff --git a/src/hcid.h b/src/hcid.h
index 294e844..ae478e7 100644
--- a/src/hcid.h
+++ b/src/hcid.h
@@ -41,7 +41,4 @@ struct main_opts {
 
 extern struct main_opts main_opts;
 
-void rfkill_init(void);
-void rfkill_exit(void);
-
 void btd_exit(void);
diff --git a/src/main.c b/src/main.c
index 23d598f..f2d0983 100644
--- a/src/main.c
+++ b/src/main.c
@@ -57,6 +57,7 @@
 #include "profile.h"
 #include "systemd.h"
 #include "plugin.h"
+#include "rfkill.h"
 
 #define BLUEZ_NAME "org.bluez"
 
diff --git a/src/rfkill.c b/src/rfkill.c
index 70588c0..583400b 100644
--- a/src/rfkill.c
+++ b/src/rfkill.c
@@ -37,7 +37,7 @@
 
 #include "log.h"
 #include "adapter.h"
-#include "hcid.h"
+#include "rfkill.h"
 
 enum rfkill_type {
 	RFKILL_TYPE_ALL = 0,
diff --git a/src/rfkill.h b/src/rfkill.h
new file mode 100644
index 0000000..b1d50a7
--- /dev/null
+++ b/src/rfkill.h
@@ -0,0 +1,24 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2013 Intel Corporation
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+void rfkill_init(void);
+void rfkill_exit(void);
-- 
1.8.1.2


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

* Re: [PATCH BlueZ 3/4] core: Move plugin_init and plugin_cleanup to plugin.h
  2013-03-04 13:58 ` [PATCH BlueZ 3/4] core: Move plugin_init and plugin_cleanup to plugin.h Luiz Augusto von Dentz
@ 2013-03-04 18:50   ` Marcel Holtmann
  2013-03-04 20:15     ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 8+ messages in thread
From: Marcel Holtmann @ 2013-03-04 18:50 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

> profiles/input/manager.c  | 2 ++
> profiles/scanparam/scan.c | 2 ++
> src/hcid.h                | 3 ---
> src/main.c                | 1 +
> src/plugin.h              | 2 ++
> 5 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/profiles/input/manager.c b/profiles/input/manager.c
> index 6ed12ee..e1e1057 100644
> --- a/profiles/input/manager.c
> +++ b/profiles/input/manager.c
> @@ -32,6 +32,8 @@
> #include <bluetooth/sdp.h>
> #include <bluetooth/sdp_lib.h>
> 
> +#include <glib.h>
> +
> #include "log.h"
> #include "plugin.h"
> 
> diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c
> index 268bdc8..8428816 100644
> --- a/profiles/scanparam/scan.c
> +++ b/profiles/scanparam/scan.c
> @@ -31,6 +31,8 @@
> 
> #include <bluetooth/bluetooth.h>
> 
> +#include <glib.h>
> +
> #include "lib/uuid.h"
> #include "log.h"
> #include "plugin.h"
> diff --git a/src/hcid.h b/src/hcid.h
> index ea67cc2..294e844 100644
> --- a/src/hcid.h
> +++ b/src/hcid.h
> @@ -41,9 +41,6 @@ struct main_opts {
> 
> extern struct main_opts main_opts;
> 
> -gboolean plugin_init(const char *enable, const char *disable);
> -void plugin_cleanup(void);
> -
> void rfkill_init(void);
> void rfkill_exit(void);
> 
> diff --git a/src/main.c b/src/main.c
> index 62a88cd..23d598f 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -56,6 +56,7 @@
> #include "agent.h"
> #include "profile.h"
> #include "systemd.h"
> +#include "plugin.h"
> 
> #define BLUEZ_NAME "org.bluez"
> 
> diff --git a/src/plugin.h b/src/plugin.h
> index 89c7b85..f281cd9 100644
> --- a/src/plugin.h
> +++ b/src/plugin.h
> @@ -39,6 +39,8 @@ struct bluetooth_plugin_desc {
> 		struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \
> 			#name, version, priority, init, exit \
> 		};
> +gboolean plugin_init(const char *enable, const char *disable);
> +void plugin_cleanup(void);
> #else
> #define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \
> 		extern struct btd_debug_desc __start___debug[] \\

why are we doing this?

Regards

Marcel


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

* Re: [PATCH BlueZ 3/4] core: Move plugin_init and plugin_cleanup to plugin.h
  2013-03-04 18:50   ` Marcel Holtmann
@ 2013-03-04 20:15     ` Luiz Augusto von Dentz
  2013-03-04 22:05       ` Marcel Holtmann
  0 siblings, 1 reply; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2013-03-04 20:15 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Mon, Mar 4, 2013 at 8:50 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Luiz,
>
>> profiles/input/manager.c  | 2 ++
>> profiles/scanparam/scan.c | 2 ++
>> src/hcid.h                | 3 ---
>> src/main.c                | 1 +
>> src/plugin.h              | 2 ++
>> 5 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/profiles/input/manager.c b/profiles/input/manager.c
>> index 6ed12ee..e1e1057 100644
>> --- a/profiles/input/manager.c
>> +++ b/profiles/input/manager.c
>> @@ -32,6 +32,8 @@
>> #include <bluetooth/sdp.h>
>> #include <bluetooth/sdp_lib.h>
>>
>> +#include <glib.h>
>> +
>> #include "log.h"
>> #include "plugin.h"
>>
>> diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c
>> index 268bdc8..8428816 100644
>> --- a/profiles/scanparam/scan.c
>> +++ b/profiles/scanparam/scan.c
>> @@ -31,6 +31,8 @@
>>
>> #include <bluetooth/bluetooth.h>
>>
>> +#include <glib.h>
>> +
>> #include "lib/uuid.h"
>> #include "log.h"
>> #include "plugin.h"
>> diff --git a/src/hcid.h b/src/hcid.h
>> index ea67cc2..294e844 100644
>> --- a/src/hcid.h
>> +++ b/src/hcid.h
>> @@ -41,9 +41,6 @@ struct main_opts {
>>
>> extern struct main_opts main_opts;
>>
>> -gboolean plugin_init(const char *enable, const char *disable);
>> -void plugin_cleanup(void);
>> -
>> void rfkill_init(void);
>> void rfkill_exit(void);
>>
>> diff --git a/src/main.c b/src/main.c
>> index 62a88cd..23d598f 100644
>> --- a/src/main.c
>> +++ b/src/main.c
>> @@ -56,6 +56,7 @@
>> #include "agent.h"
>> #include "profile.h"
>> #include "systemd.h"
>> +#include "plugin.h"
>>
>> #define BLUEZ_NAME "org.bluez"
>>
>> diff --git a/src/plugin.h b/src/plugin.h
>> index 89c7b85..f281cd9 100644
>> --- a/src/plugin.h
>> +++ b/src/plugin.h
>> @@ -39,6 +39,8 @@ struct bluetooth_plugin_desc {
>>               struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \
>>                       #name, version, priority, init, exit \
>>               };
>> +gboolean plugin_init(const char *enable, const char *disable);
>> +void plugin_cleanup(void);
>> #else
>> #define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \
>>               extern struct btd_debug_desc __start___debug[] \\
>
> why are we doing this?

Didn't you want to cleanup hcid.h to minimize the usage of it, or you
are referring to the declarations being inside the #ifdef for built-in
plugins? If you have the declarations outside the ifdef then the
external plugins would have those functions undefined. Perhaps you
change your mind after seeing what it actually mean, perhaps we should
leave as it is? But IMO the main header should follow the binary name
of the daemon as is done for obexd and you got me scared when I look
into connman.h and ofono.h, 800+ lines in a header? You change those
files you basically have to recompile the whole thing.


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH BlueZ 3/4] core: Move plugin_init and plugin_cleanup to plugin.h
  2013-03-04 20:15     ` Luiz Augusto von Dentz
@ 2013-03-04 22:05       ` Marcel Holtmann
  0 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2013-03-04 22:05 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

>>> profiles/input/manager.c  | 2 ++
>>> profiles/scanparam/scan.c | 2 ++
>>> src/hcid.h                | 3 ---
>>> src/main.c                | 1 +
>>> src/plugin.h              | 2 ++
>>> 5 files changed, 7 insertions(+), 3 deletions(-)
>>> 
>>> diff --git a/profiles/input/manager.c b/profiles/input/manager.c
>>> index 6ed12ee..e1e1057 100644
>>> --- a/profiles/input/manager.c
>>> +++ b/profiles/input/manager.c
>>> @@ -32,6 +32,8 @@
>>> #include <bluetooth/sdp.h>
>>> #include <bluetooth/sdp_lib.h>
>>> 
>>> +#include <glib.h>
>>> +
>>> #include "log.h"
>>> #include "plugin.h"
>>> 
>>> diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c
>>> index 268bdc8..8428816 100644
>>> --- a/profiles/scanparam/scan.c
>>> +++ b/profiles/scanparam/scan.c
>>> @@ -31,6 +31,8 @@
>>> 
>>> #include <bluetooth/bluetooth.h>
>>> 
>>> +#include <glib.h>
>>> +
>>> #include "lib/uuid.h"
>>> #include "log.h"
>>> #include "plugin.h"
>>> diff --git a/src/hcid.h b/src/hcid.h
>>> index ea67cc2..294e844 100644
>>> --- a/src/hcid.h
>>> +++ b/src/hcid.h
>>> @@ -41,9 +41,6 @@ struct main_opts {
>>> 
>>> extern struct main_opts main_opts;
>>> 
>>> -gboolean plugin_init(const char *enable, const char *disable);
>>> -void plugin_cleanup(void);
>>> -
>>> void rfkill_init(void);
>>> void rfkill_exit(void);
>>> 
>>> diff --git a/src/main.c b/src/main.c
>>> index 62a88cd..23d598f 100644
>>> --- a/src/main.c
>>> +++ b/src/main.c
>>> @@ -56,6 +56,7 @@
>>> #include "agent.h"
>>> #include "profile.h"
>>> #include "systemd.h"
>>> +#include "plugin.h"
>>> 
>>> #define BLUEZ_NAME "org.bluez"
>>> 
>>> diff --git a/src/plugin.h b/src/plugin.h
>>> index 89c7b85..f281cd9 100644
>>> --- a/src/plugin.h
>>> +++ b/src/plugin.h
>>> @@ -39,6 +39,8 @@ struct bluetooth_plugin_desc {
>>>              struct bluetooth_plugin_desc __bluetooth_builtin_ ## name = { \
>>>                      #name, version, priority, init, exit \
>>>              };
>>> +gboolean plugin_init(const char *enable, const char *disable);
>>> +void plugin_cleanup(void);
>>> #else
>>> #define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \
>>>              extern struct btd_debug_desc __start___debug[] \\
>> 
>> why are we doing this?
> 
> Didn't you want to cleanup hcid.h to minimize the usage of it, or you
> are referring to the declarations being inside the #ifdef for built-in
> plugins? If you have the declarations outside the ifdef then the
> external plugins would have those functions undefined. Perhaps you
> change your mind after seeing what it actually mean, perhaps we should
> leave as it is? But IMO the main header should follow the binary name
> of the daemon as is done for obexd and you got me scared when I look
> into connman.h and ofono.h, 800+ lines in a header? You change those
> files you basically have to recompile the whole thing.

yes, this is mainly about the declaration inside the ifdef. I have no idea what you are trying to achieve. Why does a plugin now need these? If it does, we are doing something wrong.

There are headers that are for including from plugins (aka public headers) and there are some for internal to the daemon. So BlueZ has a pretty much loose definition of this and never had a clean include directory to separate them. However this does not mean, you should be messing that up.

Everything in plugin.h is for plugins and not for putting internal function declaration that are only used inside the daemon. If you mix these up, we will never get to the stage to allow moving over to ELL. Inside ELL, I have nicely separated this since ELL will deal with the plugin part so we do not have to copy it over into every single project.

So my advise here is to not start with the this one. Try to minimize the rest of hcid.h that does not have an impact on plugins and is purely internal to bluetoothd and obexd.

Regards

Marcel


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

* Re: [PATCH BlueZ 2/4 v2] core: Add DisableProfiles entry to main.conf
  2013-03-04 13:58 ` [PATCH BlueZ 2/4 v2] core: Add DisableProfiles entry to main.conf Luiz Augusto von Dentz
@ 2013-03-05  1:12   ` Anderson Lizardo
  0 siblings, 0 replies; 8+ messages in thread
From: Anderson Lizardo @ 2013-03-05  1:12 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On Mon, Mar 4, 2013 at 9:58 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> +               if (g_pattern_match_simple(blacklist[i], profile->name) == 0)
> +                       return -EPROTONOSUPPORT;

g_pattern_match_simple() returns gboolean so IMHO it is more readable
if you use "== FALSE" or simply "if (!g_pattern_match_simple(...))"
above.

> +
> +               if (profile->local_uuid != NULL && strcasecmp(blacklist[i],
> +                                               profile->local_uuid) == 0)
> +                       return -EPROTONOSUPPORT;
> +
> +               if (profile->remote_uuids == NULL)
> +                       continue;
> +
> +               if (strcasecmp(blacklist[i], profile->remote_uuids[0]) == 0)
> +                       return -EPROTONOSUPPORT;
> +       }
> +
> +done:
>         profiles = g_slist_append(profiles, profile);
>         return 0;
>  }

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

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

end of thread, other threads:[~2013-03-05  1:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-04 13:58 [PATCH BlueZ 1/4 v2] audio: Remove profile enabling/disabling logic Luiz Augusto von Dentz
2013-03-04 13:58 ` [PATCH BlueZ 2/4 v2] core: Add DisableProfiles entry to main.conf Luiz Augusto von Dentz
2013-03-05  1:12   ` Anderson Lizardo
2013-03-04 13:58 ` [PATCH BlueZ 3/4] core: Move plugin_init and plugin_cleanup to plugin.h Luiz Augusto von Dentz
2013-03-04 18:50   ` Marcel Holtmann
2013-03-04 20:15     ` Luiz Augusto von Dentz
2013-03-04 22:05       ` Marcel Holtmann
2013-03-04 13:58 ` [PATCH BlueZ 4/4] core: Move rfkill_init and rfkill_cleanup to rfkill.h Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.