All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] core: Add option to list available plugins
@ 2013-05-30 22:01 Szymon Janc
  2013-05-30 22:01 ` [PATCH 2/5] man: Update bluetoothd manual Szymon Janc
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Szymon Janc @ 2013-05-30 22:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This allows to list plugins names that can be passed with -p/-P
options. This is usefull with binary provided by distribution to easily
determine what plugins are supported.
---
 src/hcid.h   |    1 +
 src/main.c   |    8 ++++++++
 src/plugin.c |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+)

diff --git a/src/hcid.h b/src/hcid.h
index ea67cc2..ff4a3c5 100644
--- a/src/hcid.h
+++ b/src/hcid.h
@@ -43,6 +43,7 @@ extern struct main_opts main_opts;
 
 gboolean plugin_init(const char *enable, const char *disable);
 void plugin_cleanup(void);
+void plugin_list(void);
 
 void rfkill_init(void);
 void rfkill_exit(void);
diff --git a/src/main.c b/src/main.c
index dc0478e..aea3e3f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -381,6 +381,7 @@ static guint setup_signalfd(void)
 static char *option_debug = NULL;
 static char *option_plugin = NULL;
 static char *option_noplugin = NULL;
+static gboolean option_listplugins = FALSE;
 static gboolean option_compat = FALSE;
 static gboolean option_detach = TRUE;
 static gboolean option_version = FALSE;
@@ -468,6 +469,8 @@ static GOptionEntry options[] = {
 				"Specify plugins to load", "NAME,..," },
 	{ "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
 				"Specify plugins not to load", "NAME,..." },
+	{ "list-plugins", 'l', 0, G_OPTION_ARG_NONE, &option_listplugins,
+				"List available plugins", },
 	{ "compat", 'C', 0, G_OPTION_ARG_NONE, &option_compat,
 				"Provide deprecated command line interfaces" },
 	{ "experimental", 'E', 0, G_OPTION_ARG_NONE, &option_experimental,
@@ -512,6 +515,11 @@ int main(int argc, char *argv[])
 		exit(0);
 	}
 
+	if (option_listplugins == TRUE) {
+		plugin_list();
+		exit(0);
+	}
+
 	umask(0077);
 
 	event_loop = g_main_loop_new(NULL, FALSE);
diff --git a/src/plugin.c b/src/plugin.c
index 51c98bc..b6e0ad7 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -230,3 +230,50 @@ void plugin_cleanup(void)
 
 	g_slist_free(plugins);
 }
+
+void plugin_list(void)
+{
+	int i;
+	GDir *dir;
+	const char *file;
+
+	printf("builtin plugins:\n");
+
+	for (i = 0; __bluetooth_builtin[i]; i++) {
+		printf("  %s\n", __bluetooth_builtin[i]->name);
+	}
+
+	dir = g_dir_open(PLUGINDIR, 0, NULL);
+	if (!dir)
+		return;
+
+	printf("\nplugins from '%s':\n", PLUGINDIR);
+
+	while ((file = g_dir_read_name(dir)) != NULL) {
+		struct bluetooth_plugin_desc *desc;
+		void *handle;
+		char *filename;
+
+		if (g_str_has_prefix(file, "lib") == TRUE ||
+				g_str_has_suffix(file, ".so") == FALSE)
+			continue;
+
+		filename = g_build_filename(PLUGINDIR, file, NULL);
+
+		handle = dlopen(filename, RTLD_NOW);
+		if (handle == NULL) {
+			g_free(filename);
+			continue;
+		}
+
+		g_free(filename);
+
+		desc = dlsym(handle, "bluetooth_plugin_desc");
+		if (desc && strcmp(desc->version, VERSION) == 0)
+			printf("  %s\n", desc->name);
+
+		dlclose(handle);
+	}
+
+	g_dir_close(dir);
+}
-- 
1.7.10.4


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

* [PATCH 2/5] man: Update bluetoothd manual
  2013-05-30 22:01 [PATCH 1/5] core: Add option to list available plugins Szymon Janc
@ 2013-05-30 22:01 ` Szymon Janc
  2013-05-31 20:40   ` [PATCH v2 " Szymon Janc
  2013-05-30 22:01 ` [PATCH 3/5] build: Fix generating bluetoothd manpage Szymon Janc
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Szymon Janc @ 2013-05-30 22:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This puts manual up-to-date with bluetoothd options.
---
 src/bluetoothd.8.in |   48 +++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 37 insertions(+), 11 deletions(-)

diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
index 09f7f47..1a64c1e 100644
--- a/src/bluetoothd.8.in
+++ b/src/bluetoothd.8.in
@@ -4,10 +4,9 @@
 bluetoothd \- Bluetooth daemon
 
 .SH "SYNOPSIS"
-.B bluetoothd
-[
-.B \-n
-]
+.B bluetoothd [--version] | [--help] | [--list-plugins]
+
+.B bluetoothd [--nodetach] [--compat] [--experimental] [--debug=<files>] [--plugin=<plugins>] [--noplugin=<plugins>]
 
 .SH "DESCRIPTION"
 This manual page documents briefly the
@@ -18,19 +17,46 @@ can also provide a number of services via the D-Bus message bus
 system.
 .SH "OPTIONS"
 .TP
-.BI \-n
-Don't run as daemon in background.
+.B -v, --version
+Print bluetoothd version and exit.
+.TP
+.B -h, --help
+Print bluetoothd options and exit.
+.TP
+.B -l, --list-plugins
+Print available plugins and exit. 
 .TP
-.BI \-d
-Enable debug information output.
+.B -n, --nodetach
+Enable logging in foreground. Directs log output to the controlling terminal \
+in addition to syslog.
 .TP
-.BI \-m\ mtu\-size
-Use specific MTU size for SDP server.
+.B -d, --debug=<file1>:<file2>:...
+Sets how much information bluetoothd sends to the log destination (usually \
+syslog's "daemon" facility). If the file options are omitted, then debugging \
+information from all the source files are printed. If file options are \
+present, then only debug prints from that source file are printed. The option \
+can be a pattern containing "*" and "?" characters.
 
+Example: --debug=src/adapter.c:src/agent.c
+.TP
+.B -p, --plugin=<plugin1>,<plugin2>,..
+Load these plugins only. The option can be a pattern containing "*" and "?" \
+characters.
+.TP
+.B -P, --noplugin=<plugin1>,<plugin2>,..
+Never load these plugins. The option can be a pattern containing "*" and "?" \
+characters.
+.TP
+.B -C, --compat
+Provide deprecated command line interfaces.
+.TP
+.B -E, -experimental
+Enable experimental interfaces. Those interfaces are not guaranteed to be
+compatible or present in future releases.
 .SH "FILES"
 .TP
 .I @CONFIGDIR@/main.conf
-Default location of the global configuration file.
+Location of the global configuration file.
 
 .SH "AUTHOR"
 This manual page was written by Marcel Holtmann, Philipp Matthias Hahn and Fredrik Noring.
-- 
1.7.10.4


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

* [PATCH 3/5] build: Fix generating bluetoothd manpage
  2013-05-30 22:01 [PATCH 1/5] core: Add option to list available plugins Szymon Janc
  2013-05-30 22:01 ` [PATCH 2/5] man: Update bluetoothd manual Szymon Janc
@ 2013-05-30 22:01 ` Szymon Janc
  2013-05-30 22:01 ` [PATCH 4/5] tools: Update rfcomm help Szymon Janc
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Szymon Janc @ 2013-05-30 22:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

CONFIGDIR was not properly substituted in bluetoothd.8 manpage.
---
 configure.ac |    1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index f3c58be..cdc9200 100644
--- a/configure.ac
+++ b/configure.ac
@@ -253,5 +253,6 @@ else
 fi
 AC_DEFINE_UNQUOTED(CONFIGDIR, "${configdir}",
 			[Directory for the configuration files])
+AC_SUBST(CONFIGDIR, "${configdir}")
 
 AC_OUTPUT(Makefile src/bluetoothd.8 lib/bluez.pc)
-- 
1.7.10.4


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

* [PATCH 4/5] tools: Update rfcomm help
  2013-05-30 22:01 [PATCH 1/5] core: Add option to list available plugins Szymon Janc
  2013-05-30 22:01 ` [PATCH 2/5] man: Update bluetoothd manual Szymon Janc
  2013-05-30 22:01 ` [PATCH 3/5] build: Fix generating bluetoothd manpage Szymon Janc
@ 2013-05-30 22:01 ` Szymon Janc
  2013-05-30 22:01 ` [PATCH 5/5] rfcomm: Remove bogus manual entry Szymon Janc
  2013-05-30 22:13 ` [PATCH 1/5] core: Add option to list available plugins Marcel Holtmann
  4 siblings, 0 replies; 8+ messages in thread
From: Szymon Janc @ 2013-05-30 22:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This includes:
remove describtion of non-existing option '-f'
add missing description of '-L' option
add missing long version of '-i' option
---
 tools/rfcomm.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/rfcomm.c b/tools/rfcomm.c
index ff164c8..b5bea38 100644
--- a/tools/rfcomm.c
+++ b/tools/rfcomm.c
@@ -652,15 +652,15 @@ static void usage(void)
 		"\n");
 
 	printf("Options:\n"
-		"\t-i [hciX|bdaddr]      Local HCI device or BD Address\n"
-		"\t-h, --help            Display help\n"
-		"\t-r, --raw             Switch TTY into raw mode\n"
-		"\t-A, --auth            Enable authentication\n"
-		"\t-E, --encrypt         Enable encryption\n"
-		"\t-S, --secure          Secure connection\n"
-		"\t-M, --master          Become the master of a piconet\n"
-		"\t-f, --config [file]   Specify alternate config file\n"
-		"\t-a                    Show all devices (default)\n"
+		"\t-i, --device [hciX|bdaddr]     Local HCI device or BD Address\n"
+		"\t-h, --help                     Display help\n"
+		"\t-r, --raw                      Switch TTY into raw mode\n"
+		"\t-A, --auth                     Enable authentication\n"
+		"\t-E, --encrypt                  Enable encryption\n"
+		"\t-S, --secure                   Secure connection\n"
+		"\t-M, --master                   Become the master of a piconet\n"
+		"\t-L, --linger [seconds]         Set linger timeout\n"
+		"\t-a                             Show all devices (default)\n"
 		"\n");
 
 	printf("Commands:\n");
-- 
1.7.10.4


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

* [PATCH 5/5] rfcomm: Remove bogus manual entry
  2013-05-30 22:01 [PATCH 1/5] core: Add option to list available plugins Szymon Janc
                   ` (2 preceding siblings ...)
  2013-05-30 22:01 ` [PATCH 4/5] tools: Update rfcomm help Szymon Janc
@ 2013-05-30 22:01 ` Szymon Janc
  2013-05-30 22:13 ` [PATCH 1/5] core: Add option to list available plugins Marcel Holtmann
  4 siblings, 0 replies; 8+ messages in thread
From: Szymon Janc @ 2013-05-30 22:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This was introduced in commit b1b5f09d40 "Include security parameters"
back in 2007. Those options are already descibed few lines below.
---
 tools/rfcomm.1 |   17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/tools/rfcomm.1 b/tools/rfcomm.1
index 51df284..a108609 100644
--- a/tools/rfcomm.1
+++ b/tools/rfcomm.1
@@ -49,20 +49,9 @@ Prints information about all configured RFCOMM devices.
 Switch TTY into raw mode (doesn't work with "bind").
 .TP
 .BI -i " <hciX> | <bdaddr>"
-The command is applied to device
-.BI -A
-Enable authentication.
-.BI -E
-Enable encryption.
-.BI -S
-Secure connection.
-.BI -M
-Become the master of a piconet.
-.I
-hciX
-, which must be the name or the address of an installed Bluetooth
-device. If not specified, the command will be use the first
-available Bluetooth device.
+The command is applied to device hciX, which must be the name or the address of
+an installed Bluetooth device. If not specified, the command will be use the
+first available Bluetooth device.
 .TP
 .BI -A
 Enable authentification
-- 
1.7.10.4


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

* Re: [PATCH 1/5] core: Add option to list available plugins
  2013-05-30 22:01 [PATCH 1/5] core: Add option to list available plugins Szymon Janc
                   ` (3 preceding siblings ...)
  2013-05-30 22:01 ` [PATCH 5/5] rfcomm: Remove bogus manual entry Szymon Janc
@ 2013-05-30 22:13 ` Marcel Holtmann
  4 siblings, 0 replies; 8+ messages in thread
From: Marcel Holtmann @ 2013-05-30 22:13 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

> This allows to list plugins names that can be passed with -p/-P
> options. This is usefull with binary provided by distribution to easily
> determine what plugins are supported.
> ---
> src/hcid.h   |    1 +
> src/main.c   |    8 ++++++++
> src/plugin.c |   47 +++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 56 insertions(+)
> 
> diff --git a/src/hcid.h b/src/hcid.h
> index ea67cc2..ff4a3c5 100644
> --- a/src/hcid.h
> +++ b/src/hcid.h
> @@ -43,6 +43,7 @@ extern struct main_opts main_opts;
> 
> gboolean plugin_init(const char *enable, const char *disable);
> void plugin_cleanup(void);
> +void plugin_list(void);
> 
> void rfkill_init(void);
> void rfkill_exit(void);
> diff --git a/src/main.c b/src/main.c
> index dc0478e..aea3e3f 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -381,6 +381,7 @@ static guint setup_signalfd(void)
> static char *option_debug = NULL;
> static char *option_plugin = NULL;
> static char *option_noplugin = NULL;
> +static gboolean option_listplugins = FALSE;
> static gboolean option_compat = FALSE;
> static gboolean option_detach = TRUE;
> static gboolean option_version = FALSE;
> @@ -468,6 +469,8 @@ static GOptionEntry options[] = {
> 				"Specify plugins to load", "NAME,..," },
> 	{ "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
> 				"Specify plugins not to load", "NAME,..." },
> +	{ "list-plugins", 'l', 0, G_OPTION_ARG_NONE, &option_listplugins,
> +				"List available plugins", },

I am not in favor of doing this. Distributions should build it with the plugins that are useful for that distro and they should be enabled all the time. The disabling of plugins for for developers only.

Regards

Marcel


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

* [PATCH v2 2/5] man: Update bluetoothd manual
  2013-05-30 22:01 ` [PATCH 2/5] man: Update bluetoothd manual Szymon Janc
@ 2013-05-31 20:40   ` Szymon Janc
  2013-06-13 13:20     ` Johan Hedberg
  0 siblings, 1 reply; 8+ messages in thread
From: Szymon Janc @ 2013-05-31 20:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This puts manual up-to-date with bluetoothd options.
---

V2: Removed list-plugins option description

 src/bluetoothd.8.in |   45 ++++++++++++++++++++++++++++++++++-----------
 1 file changed, 34 insertions(+), 11 deletions(-)

diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
index 09f7f47..0bf3914 100644
--- a/src/bluetoothd.8.in
+++ b/src/bluetoothd.8.in
@@ -4,10 +4,9 @@
 bluetoothd \- Bluetooth daemon
 
 .SH "SYNOPSIS"
-.B bluetoothd
-[
-.B \-n
-]
+.B bluetoothd [--version] | [--help]
+
+.B bluetoothd [--nodetach] [--compat] [--experimental] [--debug=<files>] [--plugin=<plugins>] [--noplugin=<plugins>]
 
 .SH "DESCRIPTION"
 This manual page documents briefly the
@@ -18,19 +17,43 @@ can also provide a number of services via the D-Bus message bus
 system.
 .SH "OPTIONS"
 .TP
-.BI \-n
-Don't run as daemon in background.
+.B -v, --version
+Print bluetoothd version and exit.
 .TP
-.BI \-d
-Enable debug information output.
+.B -h, --help
+Print bluetoothd options and exit.
 .TP
-.BI \-m\ mtu\-size
-Use specific MTU size for SDP server.
+.B -n, --nodetach
+Enable logging in foreground. Directs log output to the controlling terminal \
+in addition to syslog.
+.TP
+.B -d, --debug=<file1>:<file2>:...
+Sets how much information bluetoothd sends to the log destination (usually \
+syslog's "daemon" facility). If the file options are omitted, then debugging \
+information from all the source files are printed. If file options are \
+present, then only debug prints from that source file are printed. The option \
+can be a pattern containing "*" and "?" characters.
 
+Example: --debug=src/adapter.c:src/agent.c
+.TP
+.B -p, --plugin=<plugin1>,<plugin2>,..
+Load these plugins only. The option can be a pattern containing "*" and "?" \
+characters.
+.TP
+.B -P, --noplugin=<plugin1>,<plugin2>,..
+Never load these plugins. The option can be a pattern containing "*" and "?" \
+characters.
+.TP
+.B -C, --compat
+Provide deprecated command line interfaces.
+.TP
+.B -E, -experimental
+Enable experimental interfaces. Those interfaces are not guaranteed to be
+compatible or present in future releases.
 .SH "FILES"
 .TP
 .I @CONFIGDIR@/main.conf
-Default location of the global configuration file.
+Location of the global configuration file.
 
 .SH "AUTHOR"
 This manual page was written by Marcel Holtmann, Philipp Matthias Hahn and Fredrik Noring.
-- 
1.7.10.4


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

* Re: [PATCH v2 2/5] man: Update bluetoothd manual
  2013-05-31 20:40   ` [PATCH v2 " Szymon Janc
@ 2013-06-13 13:20     ` Johan Hedberg
  0 siblings, 0 replies; 8+ messages in thread
From: Johan Hedberg @ 2013-06-13 13:20 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

On Fri, May 31, 2013, Szymon Janc wrote:
> This puts manual up-to-date with bluetoothd options.
> ---
> 
> V2: Removed list-plugins option description
> 
>  src/bluetoothd.8.in |   45 ++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 34 insertions(+), 11 deletions(-)

This v2 of patch 2/5 as well as patches 3/5 - 5/5 have been applied.
Thanks.

Johan

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

end of thread, other threads:[~2013-06-13 13:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-30 22:01 [PATCH 1/5] core: Add option to list available plugins Szymon Janc
2013-05-30 22:01 ` [PATCH 2/5] man: Update bluetoothd manual Szymon Janc
2013-05-31 20:40   ` [PATCH v2 " Szymon Janc
2013-06-13 13:20     ` Johan Hedberg
2013-05-30 22:01 ` [PATCH 3/5] build: Fix generating bluetoothd manpage Szymon Janc
2013-05-30 22:01 ` [PATCH 4/5] tools: Update rfcomm help Szymon Janc
2013-05-30 22:01 ` [PATCH 5/5] rfcomm: Remove bogus manual entry Szymon Janc
2013-05-30 22:13 ` [PATCH 1/5] core: Add option to list available plugins Marcel Holtmann

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.