Skip to contentSkip to conversation

core: Add option to list available plugins

PATCH In review Szymon Janc 3 participants 8 messages May 30, 2013 – Jun 13, 2013 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 core: Add option to list available plugins

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(+)
src/hcid.h +1 -0
index ea67cc2..ff4a3c5 100644
@@ -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);
src/main.c +8 -0
index dc0478e..aea3e3f 100644
@@ -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);
src/plugin.c +47 -0

50 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/5 man: Update bluetoothd manual

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

---
 src/bluetoothd.8.in |   48 +++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 37 insertions(+), 11 deletions(-)
src/bluetoothd.8.in +37 -11
index 09f7f47..1a64c1e 100644
@@ -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.
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH v2 2/5 man: Update bluetoothd manual

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(-)
src/bluetoothd.8.in +34 -11
index 09f7f47..0bf3914 100644
@@ -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.
Signature · 1 line
1.7.10.4
#3 lore raw

Re: [PATCH v2 2/5] man: Update bluetoothd manual

Hi Szymon,

Quoted 7 lines · 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(-)

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

Johan

#4 lore raw

PATCH 3/5 build: Fix generating bluetoothd manpage

In reply to Szymon Janc

CONFIGDIR was not properly substituted in bluetoothd.8 manpage.

---
 configure.ac |    1 +
 1 file changed, 1 insertion(+)
configure.ac +1 -0
index f3c58be..cdc9200 100644
@@ -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)
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 4/5 tools: Update rfcomm help

In reply to 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(-)
tools/rfcomm.c +9 -9
index ff164c8..b5bea38 100644
@@ -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");
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH 5/5 rfcomm: Remove bogus manual entry

In reply to 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(-)
tools/rfcomm.1 +3 -14
index 51df284..a108609 100644
@@ -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
Signature · 1 line
1.7.10.4
maintainer
#7 lore raw
In reply to Szymon Janc

Hi Szymon,

Quoted 34 lines

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(+)
src/hcid.h +1 -0
index ea67cc2..ff4a3c5 100644
@@ -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);
src/main.c +1 -0
index dc0478e..aea3e3f 100644
@@ -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;

src/main.c static GOptionEntry options[] = { · line 473

Quoted 5 lines
src/main.c +2 -0
@@ -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