All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Support to change set file via arg
@ 2017-06-30 17:29 C Shapiro
  2017-06-30 17:42 ` Marcel Holtmann
  0 siblings, 1 reply; 10+ messages in thread
From: C Shapiro @ 2017-06-30 17:29 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Glass, C Shapiro

Currently, there is an expectation of the main.conf file at a specific
location.  This prevents system builds that support more than one
platform.

This adds support so the main.conf file can be specified as a command
line arg instead, so systems can manage multiple conf files as necessary
and pass the appropriate conf file when the daemon is started.

Signed-off-by: C Shapiro <shapiroc@chromium.org>
---
 src/bluetoothd.8.in |  4 ++++
 src/main.c          | 12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
index 97ef3ec94..d61dcc5b3 100644
--- a/src/bluetoothd.8.in
+++ b/src/bluetoothd.8.in
@@ -27,6 +27,10 @@ Print bluetoothd options and exit.
 Enable logging in foreground. Directs log output to the controlling terminal \
 in addition to syslog.
 .TP
+.B -f, --configfile
+Specifies an explicit config file path instead of relying on the default path \
+(@CONFIGDIR@/main.conf) for the config file.
+.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 \
diff --git a/src/main.c b/src/main.c
index bcc1e6fae..87bdb66cb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -490,6 +490,7 @@ static guint setup_signalfd(void)
 static char *option_debug = NULL;
 static char *option_plugin = NULL;
 static char *option_noplugin = NULL;
+static char *option_configfile = NULL;
 static gboolean option_compat = FALSE;
 static gboolean option_detach = TRUE;
 static gboolean option_version = FALSE;
@@ -505,6 +506,9 @@ static void free_options(void)
 
 	g_free(option_noplugin);
 	option_noplugin = NULL;
+
+	g_free(option_configfile);
+	option_configfile = NULL;
 }
 
 static void disconnect_dbus(void)
@@ -577,6 +581,9 @@ static GOptionEntry options[] = {
 				"Specify plugins to load", "NAME,..," },
 	{ "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
 				"Specify plugins not to load", "NAME,..." },
+	{ "configfile", 'f', 0, G_OPTION_ARG_STRING, &option_configfile,
+				"Specify an explicit path to the config file",
+				"FILE"},
 	{ "compat", 'C', 0, G_OPTION_ARG_NONE, &option_compat,
 				"Provide deprecated command line interfaces" },
 	{ "experimental", 'E', 0, G_OPTION_ARG_NONE, &option_experimental,
@@ -636,7 +643,10 @@ int main(int argc, char *argv[])
 
 	sd_notify(0, "STATUS=Starting up");
 
-	main_conf = load_config(CONFIGDIR "/main.conf");
+	if (option_configfile)
+		main_conf = load_config(option_configfile);
+	else
+		main_conf = load_config(CONFIGDIR "/main.conf");
 
 	parse_config(main_conf);
 
-- 
2.13.2.725.g09c95d1e9-goog


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

* Re: [PATCH] Support to change set file via arg
  2017-06-30 17:29 [PATCH] Support to change set file via arg C Shapiro
@ 2017-06-30 17:42 ` Marcel Holtmann
  2017-06-30 17:52   ` Charles Shapiro
  2017-06-30 17:55   ` Charles Shapiro
  0 siblings, 2 replies; 10+ messages in thread
From: Marcel Holtmann @ 2017-06-30 17:42 UTC (permalink / raw)
  To: C Shapiro; +Cc: linux-bluetooth, Simon Glass, C Shapiro

Hi Shapiro,

> Currently, there is an expectation of the main.conf file at a specific
> location.  This prevents system builds that support more than one
> platform.
> 
> This adds support so the main.conf file can be specified as a command
> line arg instead, so systems can manage multiple conf files as necessary
> and pass the appropriate conf file when the daemon is started.
> 
> Signed-off-by: C Shapiro <shapiroc@chromium.org>
> ---
> src/bluetoothd.8.in |  4 ++++
> src/main.c          | 12 +++++++++++-
> 2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
> index 97ef3ec94..d61dcc5b3 100644
> --- a/src/bluetoothd.8.in
> +++ b/src/bluetoothd.8.in
> @@ -27,6 +27,10 @@ Print bluetoothd options and exit.
> Enable logging in foreground. Directs log output to the controlling terminal \
> in addition to syslog.
> .TP
> +.B -f, --configfile
> +Specifies an explicit config file path instead of relying on the default path \
> +(@CONFIGDIR@/main.conf) for the config file.
> +.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 \
> diff --git a/src/main.c b/src/main.c
> index bcc1e6fae..87bdb66cb 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -490,6 +490,7 @@ static guint setup_signalfd(void)
> static char *option_debug = NULL;
> static char *option_plugin = NULL;
> static char *option_noplugin = NULL;
> +static char *option_configfile = NULL;
> static gboolean option_compat = FALSE;
> static gboolean option_detach = TRUE;
> static gboolean option_version = FALSE;
> @@ -505,6 +506,9 @@ static void free_options(void)
> 
> 	g_free(option_noplugin);
> 	option_noplugin = NULL;
> +
> +	g_free(option_configfile);
> +	option_configfile = NULL;
> }
> 
> static void disconnect_dbus(void)
> @@ -577,6 +581,9 @@ static GOptionEntry options[] = {
> 				"Specify plugins to load", "NAME,..," },
> 	{ "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
> 				"Specify plugins not to load", "NAME,..." },
> +	{ "configfile", 'f', 0, G_OPTION_ARG_STRING, &option_configfile,
> +				"Specify an explicit path to the config file",
> +				"FILE”},

I am failing to understand why this is needed. What problem are you trying to solve here? Can you give an example.

Regards

Marcel


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

* Re: [PATCH] Support to change set file via arg
  2017-06-30 17:42 ` Marcel Holtmann
@ 2017-06-30 17:52   ` Charles Shapiro
  2017-06-30 17:55   ` Charles Shapiro
  1 sibling, 0 replies; 10+ messages in thread
From: Charles Shapiro @ 2017-06-30 17:52 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 3240 bytes --]

For ChromeOS, we're working towards having a single build/image based on a
reference board that then supports multiple models created by OEMs.

Some of the bluetooth config differs on a per model basis, so we need to
have multiple *.conf files ship on the actual image.

We then modify the init script to check the model at runtime and pass the
appropriate *.conf file to bluetoothd when it is started.

On Fri, Jun 30, 2017 at 11:42 AM, Marcel Holtmann <marcel@holtmann.org>
wrote:

> Hi Shapiro,
>
> > Currently, there is an expectation of the main.conf file at a specific
> > location.  This prevents system builds that support more than one
> > platform.
> >
> > This adds support so the main.conf file can be specified as a command
> > line arg instead, so systems can manage multiple conf files as necessary
> > and pass the appropriate conf file when the daemon is started.
> >
> > Signed-off-by: C Shapiro <shapiroc@chromium.org>
> > ---
> > src/bluetoothd.8.in |  4 ++++
> > src/main.c          | 12 +++++++++++-
> > 2 files changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
> > index 97ef3ec94..d61dcc5b3 100644
> > --- a/src/bluetoothd.8.in
> > +++ b/src/bluetoothd.8.in
> > @@ -27,6 +27,10 @@ Print bluetoothd options and exit.
> > Enable logging in foreground. Directs log output to the controlling
> terminal \
> > in addition to syslog.
> > .TP
> > +.B -f, --configfile
> > +Specifies an explicit config file path instead of relying on the
> default path \
> > +(@CONFIGDIR@/main.conf) for the config file.
> > +.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 \
> > diff --git a/src/main.c b/src/main.c
> > index bcc1e6fae..87bdb66cb 100644
> > --- a/src/main.c
> > +++ b/src/main.c
> > @@ -490,6 +490,7 @@ static guint setup_signalfd(void)
> > static char *option_debug = NULL;
> > static char *option_plugin = NULL;
> > static char *option_noplugin = NULL;
> > +static char *option_configfile = NULL;
> > static gboolean option_compat = FALSE;
> > static gboolean option_detach = TRUE;
> > static gboolean option_version = FALSE;
> > @@ -505,6 +506,9 @@ static void free_options(void)
> >
> >       g_free(option_noplugin);
> >       option_noplugin = NULL;
> > +
> > +     g_free(option_configfile);
> > +     option_configfile = NULL;
> > }
> >
> > static void disconnect_dbus(void)
> > @@ -577,6 +581,9 @@ static GOptionEntry options[] = {
> >                               "Specify plugins to load", "NAME,..," },
> >       { "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
> >                               "Specify plugins not to load", "NAME,..."
> },
> > +     { "configfile", 'f', 0, G_OPTION_ARG_STRING, &option_configfile,
> > +                             "Specify an explicit path to the config
> file",
> > +                             "FILE”},
>
> I am failing to understand why this is needed. What problem are you trying
> to solve here? Can you give an example.
>
> Regards
>
> Marcel
>
>

[-- Attachment #2: Type: text/html, Size: 4567 bytes --]

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

* Re: [PATCH] Support to change set file via arg
  2017-06-30 17:42 ` Marcel Holtmann
  2017-06-30 17:52   ` Charles Shapiro
@ 2017-06-30 17:55   ` Charles Shapiro
  2017-06-30 18:05     ` Marcel Holtmann
  2017-06-30 18:57     ` Luiz Augusto von Dentz
  1 sibling, 2 replies; 10+ messages in thread
From: Charles Shapiro @ 2017-06-30 17:55 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth, Simon Glass

(Removing HTML formatting on email thread so it doesn't get blocked).

For ChromeOS, we're working towards having a single build/image based
on a reference board that then supports multiple models created by
OEMs.

Some of the bluetooth config differs on a per model basis, so we need
to have multiple *.conf files ship on the actual image.

We then modify the init script to check the model at runtime and pass
the appropriate *.conf file to bluetoothd when it is started.

On Fri, Jun 30, 2017 at 11:42 AM, Marcel Holtmann <marcel@holtmann.org> wro=
te:
> Hi Shapiro,
>
>> Currently, there is an expectation of the main.conf file at a specific
>> location.  This prevents system builds that support more than one
>> platform.
>>
>> This adds support so the main.conf file can be specified as a command
>> line arg instead, so systems can manage multiple conf files as necessary
>> and pass the appropriate conf file when the daemon is started.
>>
>> Signed-off-by: C Shapiro <shapiroc@chromium.org>
>> ---
>> src/bluetoothd.8.in |  4 ++++
>> src/main.c          | 12 +++++++++++-
>> 2 files changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
>> index 97ef3ec94..d61dcc5b3 100644
>> --- a/src/bluetoothd.8.in
>> +++ b/src/bluetoothd.8.in
>> @@ -27,6 +27,10 @@ Print bluetoothd options and exit.
>> Enable logging in foreground. Directs log output to the controlling term=
inal \
>> in addition to syslog.
>> .TP
>> +.B -f, --configfile
>> +Specifies an explicit config file path instead of relying on the defaul=
t path \
>> +(@CONFIGDIR@/main.conf) for the config file.
>> +.TP
>> .B -d, --debug=3D<file1>:<file2>:...
>> Sets how much information bluetoothd sends to the log destination (usual=
ly \
>> syslog's "daemon" facility). If the file options are omitted, then debug=
ging \
>> diff --git a/src/main.c b/src/main.c
>> index bcc1e6fae..87bdb66cb 100644
>> --- a/src/main.c
>> +++ b/src/main.c
>> @@ -490,6 +490,7 @@ static guint setup_signalfd(void)
>> static char *option_debug =3D NULL;
>> static char *option_plugin =3D NULL;
>> static char *option_noplugin =3D NULL;
>> +static char *option_configfile =3D NULL;
>> static gboolean option_compat =3D FALSE;
>> static gboolean option_detach =3D TRUE;
>> static gboolean option_version =3D FALSE;
>> @@ -505,6 +506,9 @@ static void free_options(void)
>>
>>       g_free(option_noplugin);
>>       option_noplugin =3D NULL;
>> +
>> +     g_free(option_configfile);
>> +     option_configfile =3D NULL;
>> }
>>
>> static void disconnect_dbus(void)
>> @@ -577,6 +581,9 @@ static GOptionEntry options[] =3D {
>>                               "Specify plugins to load", "NAME,..," },
>>       { "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
>>                               "Specify plugins not to load", "NAME,..." =
},
>> +     { "configfile", 'f', 0, G_OPTION_ARG_STRING, &option_configfile,
>> +                             "Specify an explicit path to the config fi=
le",
>> +                             "FILE=E2=80=9D},
>
> I am failing to understand why this is needed. What problem are you tryin=
g to solve here? Can you give an example.
>
> Regards
>
> Marcel
>

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

* Re: [PATCH] Support to change set file via arg
  2017-06-30 17:55   ` Charles Shapiro
@ 2017-06-30 18:05     ` Marcel Holtmann
  2017-06-30 18:57     ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 10+ messages in thread
From: Marcel Holtmann @ 2017-06-30 18:05 UTC (permalink / raw)
  To: Charles Shapiro; +Cc: linux-bluetooth, Simon Glass

Hi Charles,

> For ChromeOS, we're working towards having a single build/image based
> on a reference board that then supports multiple models created by
> OEMs.
> 
> Some of the bluetooth config differs on a per model basis, so we need
> to have multiple *.conf files ship on the actual image.
> 
> We then modify the init script to check the model at runtime and pass
> the appropriate *.conf file to bluetoothd when it is started.

what are the difference in the config file? I am currently failing to see what you could change across different models. I like to understand this first before applying the everything is a nail approach here.

Regards

Marcel


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

* Re: [PATCH] Support to change set file via arg
  2017-06-30 17:55   ` Charles Shapiro
  2017-06-30 18:05     ` Marcel Holtmann
@ 2017-06-30 18:57     ` Luiz Augusto von Dentz
  2017-06-30 19:04       ` Charles Shapiro
  1 sibling, 1 reply; 10+ messages in thread
From: Luiz Augusto von Dentz @ 2017-06-30 18:57 UTC (permalink / raw)
  To: Charles Shapiro; +Cc: Marcel Holtmann, linux-bluetooth, Simon Glass

Hi Charles,

On Fri, Jun 30, 2017 at 8:55 PM, Charles Shapiro <shapiroc@google.com> wrot=
e:
> (Removing HTML formatting on email thread so it doesn't get blocked).
>
> For ChromeOS, we're working towards having a single build/image based
> on a reference board that then supports multiple models created by
> OEMs.
>
> Some of the bluetooth config differs on a per model basis, so we need
> to have multiple *.conf files ship on the actual image.
>
> We then modify the init script to check the model at runtime and pass
> the appropriate *.conf file to bluetoothd when it is started.
>
> On Fri, Jun 30, 2017 at 11:42 AM, Marcel Holtmann <marcel@holtmann.org> w=
rote:
>> Hi Shapiro,
>>
>>> Currently, there is an expectation of the main.conf file at a specific
>>> location.  This prevents system builds that support more than one
>>> platform.
>>>
>>> This adds support so the main.conf file can be specified as a command
>>> line arg instead, so systems can manage multiple conf files as necessar=
y
>>> and pass the appropriate conf file when the daemon is started.
>>>
>>> Signed-off-by: C Shapiro <shapiroc@chromium.org>
>>> ---
>>> src/bluetoothd.8.in |  4 ++++
>>> src/main.c          | 12 +++++++++++-
>>> 2 files changed, 15 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
>>> index 97ef3ec94..d61dcc5b3 100644
>>> --- a/src/bluetoothd.8.in
>>> +++ b/src/bluetoothd.8.in
>>> @@ -27,6 +27,10 @@ Print bluetoothd options and exit.
>>> Enable logging in foreground. Directs log output to the controlling ter=
minal \
>>> in addition to syslog.
>>> .TP
>>> +.B -f, --configfile
>>> +Specifies an explicit config file path instead of relying on the defau=
lt path \
>>> +(@CONFIGDIR@/main.conf) for the config file.
>>> +.TP
>>> .B -d, --debug=3D<file1>:<file2>:...
>>> Sets how much information bluetoothd sends to the log destination (usua=
lly \
>>> syslog's "daemon" facility). If the file options are omitted, then debu=
gging \
>>> diff --git a/src/main.c b/src/main.c
>>> index bcc1e6fae..87bdb66cb 100644
>>> --- a/src/main.c
>>> +++ b/src/main.c
>>> @@ -490,6 +490,7 @@ static guint setup_signalfd(void)
>>> static char *option_debug =3D NULL;
>>> static char *option_plugin =3D NULL;
>>> static char *option_noplugin =3D NULL;
>>> +static char *option_configfile =3D NULL;
>>> static gboolean option_compat =3D FALSE;
>>> static gboolean option_detach =3D TRUE;
>>> static gboolean option_version =3D FALSE;
>>> @@ -505,6 +506,9 @@ static void free_options(void)
>>>
>>>       g_free(option_noplugin);
>>>       option_noplugin =3D NULL;
>>> +
>>> +     g_free(option_configfile);
>>> +     option_configfile =3D NULL;
>>> }
>>>
>>> static void disconnect_dbus(void)
>>> @@ -577,6 +581,9 @@ static GOptionEntry options[] =3D {
>>>                               "Specify plugins to load", "NAME,..," },
>>>       { "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
>>>                               "Specify plugins not to load", "NAME,..."=
 },
>>> +     { "configfile", 'f', 0, G_OPTION_ARG_STRING, &option_configfile,
>>> +                             "Specify an explicit path to the config f=
ile",
>>> +                             "FILE=E2=80=9D},
>>
>> I am failing to understand why this is needed. What problem are you tryi=
ng to solve here? Can you give an example.
>>

Btw, can't you link the main.conf with the board specific config?
Still it would be good to know what is that needs changing, is this
related to ControllerMode?

--=20
Luiz Augusto von Dentz

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

* Re: [PATCH] Support to change set file via arg
  2017-06-30 18:57     ` Luiz Augusto von Dentz
@ 2017-06-30 19:04       ` Charles Shapiro
  2017-07-24 19:18         ` Charles Shapiro
  0 siblings, 1 reply; 10+ messages in thread
From: Charles Shapiro @ 2017-06-30 19:04 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: Marcel Holtmann, linux-bluetooth, Simon Glass

The product id varies in the DeviceID.

E.g.
https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+/m=
aster/overlay-pyro/chromeos-base/chromeos-bsp-pyro/files/main.conf
https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+/m=
aster/overlay-reef/chromeos-base/chromeos-bsp-reef/files/main.conf
https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+/m=
aster/overlay-snappy/chromeos-base/chromeos-bsp-snappy/files/main.conf

Linking is a possibility also, but being able to pass in the config
path via a flag seemed reasonable also.

On Fri, Jun 30, 2017 at 12:57 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi Charles,
>
> On Fri, Jun 30, 2017 at 8:55 PM, Charles Shapiro <shapiroc@google.com> wr=
ote:
>> (Removing HTML formatting on email thread so it doesn't get blocked).
>>
>> For ChromeOS, we're working towards having a single build/image based
>> on a reference board that then supports multiple models created by
>> OEMs.
>>
>> Some of the bluetooth config differs on a per model basis, so we need
>> to have multiple *.conf files ship on the actual image.
>>
>> We then modify the init script to check the model at runtime and pass
>> the appropriate *.conf file to bluetoothd when it is started.
>>
>> On Fri, Jun 30, 2017 at 11:42 AM, Marcel Holtmann <marcel@holtmann.org> =
wrote:
>>> Hi Shapiro,
>>>
>>>> Currently, there is an expectation of the main.conf file at a specific
>>>> location.  This prevents system builds that support more than one
>>>> platform.
>>>>
>>>> This adds support so the main.conf file can be specified as a command
>>>> line arg instead, so systems can manage multiple conf files as necessa=
ry
>>>> and pass the appropriate conf file when the daemon is started.
>>>>
>>>> Signed-off-by: C Shapiro <shapiroc@chromium.org>
>>>> ---
>>>> src/bluetoothd.8.in |  4 ++++
>>>> src/main.c          | 12 +++++++++++-
>>>> 2 files changed, 15 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
>>>> index 97ef3ec94..d61dcc5b3 100644
>>>> --- a/src/bluetoothd.8.in
>>>> +++ b/src/bluetoothd.8.in
>>>> @@ -27,6 +27,10 @@ Print bluetoothd options and exit.
>>>> Enable logging in foreground. Directs log output to the controlling te=
rminal \
>>>> in addition to syslog.
>>>> .TP
>>>> +.B -f, --configfile
>>>> +Specifies an explicit config file path instead of relying on the defa=
ult path \
>>>> +(@CONFIGDIR@/main.conf) for the config file.
>>>> +.TP
>>>> .B -d, --debug=3D<file1>:<file2>:...
>>>> Sets how much information bluetoothd sends to the log destination (usu=
ally \
>>>> syslog's "daemon" facility). If the file options are omitted, then deb=
ugging \
>>>> diff --git a/src/main.c b/src/main.c
>>>> index bcc1e6fae..87bdb66cb 100644
>>>> --- a/src/main.c
>>>> +++ b/src/main.c
>>>> @@ -490,6 +490,7 @@ static guint setup_signalfd(void)
>>>> static char *option_debug =3D NULL;
>>>> static char *option_plugin =3D NULL;
>>>> static char *option_noplugin =3D NULL;
>>>> +static char *option_configfile =3D NULL;
>>>> static gboolean option_compat =3D FALSE;
>>>> static gboolean option_detach =3D TRUE;
>>>> static gboolean option_version =3D FALSE;
>>>> @@ -505,6 +506,9 @@ static void free_options(void)
>>>>
>>>>       g_free(option_noplugin);
>>>>       option_noplugin =3D NULL;
>>>> +
>>>> +     g_free(option_configfile);
>>>> +     option_configfile =3D NULL;
>>>> }
>>>>
>>>> static void disconnect_dbus(void)
>>>> @@ -577,6 +581,9 @@ static GOptionEntry options[] =3D {
>>>>                               "Specify plugins to load", "NAME,..," },
>>>>       { "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
>>>>                               "Specify plugins not to load", "NAME,...=
" },
>>>> +     { "configfile", 'f', 0, G_OPTION_ARG_STRING, &option_configfile,
>>>> +                             "Specify an explicit path to the config =
file",
>>>> +                             "FILE=E2=80=9D},
>>>
>>> I am failing to understand why this is needed. What problem are you try=
ing to solve here? Can you give an example.
>>>
>
> Btw, can't you link the main.conf with the board specific config?
> Still it would be good to know what is that needs changing, is this
> related to ControllerMode?
>
> --
> Luiz Augusto von Dentz

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

* Re: [PATCH] Support to change set file via arg
  2017-06-30 19:04       ` Charles Shapiro
@ 2017-07-24 19:18         ` Charles Shapiro
  2017-07-25 18:46           ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 10+ messages in thread
From: Charles Shapiro @ 2017-07-24 19:18 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: Marcel Holtmann, linux-bluetooth, Simon Glass

The links above were invalid...sorry.

Here are the correct links:
E.g.
 - https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/m=
aster/overlay-pyro/chromeos-base/chromeos-bsp-pyro/files/main.conf
 - https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/m=
aster/overlay-reef/chromeos-base/chromeos-bsp-reef/files/main.conf
 - https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/m=
aster/overlay-snappy/chromeos-base/chromeos-bsp-snappy/files/main.conf

I also updated the commit with these links and a better explanation of
the usage.

Thanks,
Charles

On Fri, Jun 30, 2017 at 1:04 PM, Charles Shapiro <shapiroc@google.com> wrot=
e:
> The product id varies in the DeviceID.
>
> E.g.
> https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+=
/master/overlay-pyro/chromeos-base/chromeos-bsp-pyro/files/main.conf
> https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+=
/master/overlay-reef/chromeos-base/chromeos-bsp-reef/files/main.conf
> https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/+=
/master/overlay-snappy/chromeos-base/chromeos-bsp-snappy/files/main.conf
>
> Linking is a possibility also, but being able to pass in the config
> path via a flag seemed reasonable also.
>
> On Fri, Jun 30, 2017 at 12:57 PM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>> Hi Charles,
>>
>> On Fri, Jun 30, 2017 at 8:55 PM, Charles Shapiro <shapiroc@google.com> w=
rote:
>>> (Removing HTML formatting on email thread so it doesn't get blocked).
>>>
>>> For ChromeOS, we're working towards having a single build/image based
>>> on a reference board that then supports multiple models created by
>>> OEMs.
>>>
>>> Some of the bluetooth config differs on a per model basis, so we need
>>> to have multiple *.conf files ship on the actual image.
>>>
>>> We then modify the init script to check the model at runtime and pass
>>> the appropriate *.conf file to bluetoothd when it is started.
>>>
>>> On Fri, Jun 30, 2017 at 11:42 AM, Marcel Holtmann <marcel@holtmann.org>=
 wrote:
>>>> Hi Shapiro,
>>>>
>>>>> Currently, there is an expectation of the main.conf file at a specifi=
c
>>>>> location.  This prevents system builds that support more than one
>>>>> platform.
>>>>>
>>>>> This adds support so the main.conf file can be specified as a command
>>>>> line arg instead, so systems can manage multiple conf files as necess=
ary
>>>>> and pass the appropriate conf file when the daemon is started.
>>>>>
>>>>> Signed-off-by: C Shapiro <shapiroc@chromium.org>
>>>>> ---
>>>>> src/bluetoothd.8.in |  4 ++++
>>>>> src/main.c          | 12 +++++++++++-
>>>>> 2 files changed, 15 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
>>>>> index 97ef3ec94..d61dcc5b3 100644
>>>>> --- a/src/bluetoothd.8.in
>>>>> +++ b/src/bluetoothd.8.in
>>>>> @@ -27,6 +27,10 @@ Print bluetoothd options and exit.
>>>>> Enable logging in foreground. Directs log output to the controlling t=
erminal \
>>>>> in addition to syslog.
>>>>> .TP
>>>>> +.B -f, --configfile
>>>>> +Specifies an explicit config file path instead of relying on the def=
ault path \
>>>>> +(@CONFIGDIR@/main.conf) for the config file.
>>>>> +.TP
>>>>> .B -d, --debug=3D<file1>:<file2>:...
>>>>> Sets how much information bluetoothd sends to the log destination (us=
ually \
>>>>> syslog's "daemon" facility). If the file options are omitted, then de=
bugging \
>>>>> diff --git a/src/main.c b/src/main.c
>>>>> index bcc1e6fae..87bdb66cb 100644
>>>>> --- a/src/main.c
>>>>> +++ b/src/main.c
>>>>> @@ -490,6 +490,7 @@ static guint setup_signalfd(void)
>>>>> static char *option_debug =3D NULL;
>>>>> static char *option_plugin =3D NULL;
>>>>> static char *option_noplugin =3D NULL;
>>>>> +static char *option_configfile =3D NULL;
>>>>> static gboolean option_compat =3D FALSE;
>>>>> static gboolean option_detach =3D TRUE;
>>>>> static gboolean option_version =3D FALSE;
>>>>> @@ -505,6 +506,9 @@ static void free_options(void)
>>>>>
>>>>>       g_free(option_noplugin);
>>>>>       option_noplugin =3D NULL;
>>>>> +
>>>>> +     g_free(option_configfile);
>>>>> +     option_configfile =3D NULL;
>>>>> }
>>>>>
>>>>> static void disconnect_dbus(void)
>>>>> @@ -577,6 +581,9 @@ static GOptionEntry options[] =3D {
>>>>>                               "Specify plugins to load", "NAME,..," }=
,
>>>>>       { "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
>>>>>                               "Specify plugins not to load", "NAME,..=
." },
>>>>> +     { "configfile", 'f', 0, G_OPTION_ARG_STRING, &option_configfile=
,
>>>>> +                             "Specify an explicit path to the config=
 file",
>>>>> +                             "FILE=E2=80=9D},
>>>>
>>>> I am failing to understand why this is needed. What problem are you tr=
ying to solve here? Can you give an example.
>>>>
>>
>> Btw, can't you link the main.conf with the board specific config?
>> Still it would be good to know what is that needs changing, is this
>> related to ControllerMode?
>>
>> --
>> Luiz Augusto von Dentz

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

* Re: [PATCH] Support to change set file via arg
  2017-07-24 19:18         ` Charles Shapiro
@ 2017-07-25 18:46           ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 10+ messages in thread
From: Luiz Augusto von Dentz @ 2017-07-25 18:46 UTC (permalink / raw)
  To: Charles Shapiro; +Cc: Marcel Holtmann, linux-bluetooth, Simon Glass

Hi Charles,

On Mon, Jul 24, 2017 at 10:18 PM, Charles Shapiro <shapiroc@google.com> wro=
te:
> The links above were invalid...sorry.
>
> Here are the correct links:
> E.g.
>  - https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+=
/master/overlay-pyro/chromeos-base/chromeos-bsp-pyro/files/main.conf
>  - https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+=
/master/overlay-reef/chromeos-base/chromeos-bsp-reef/files/main.conf
>  - https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+=
/master/overlay-snappy/chromeos-base/chromeos-bsp-snappy/files/main.conf
>
> I also updated the commit with these links and a better explanation of
> the usage.

It might be useful to have such a thing if we can use to run directly
from source tree without having to install in some location just to
test some changes done in src/main.conf.

> Thanks,
> Charles
>
> On Fri, Jun 30, 2017 at 1:04 PM, Charles Shapiro <shapiroc@google.com> wr=
ote:
>> The product id varies in the DeviceID.
>>
>> E.g.
>> https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/=
+/master/overlay-pyro/chromeos-base/chromeos-bsp-pyro/files/main.conf
>> https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/=
+/master/overlay-reef/chromeos-base/chromeos-bsp-reef/files/main.conf
>> https://chromium.git.corp.google.com/chromiumos/overlays/board-overlays/=
+/master/overlay-snappy/chromeos-base/chromeos-bsp-snappy/files/main.conf
>>
>> Linking is a possibility also, but being able to pass in the config
>> path via a flag seemed reasonable also.
>>
>> On Fri, Jun 30, 2017 at 12:57 PM, Luiz Augusto von Dentz
>> <luiz.dentz@gmail.com> wrote:
>>> Hi Charles,
>>>
>>> On Fri, Jun 30, 2017 at 8:55 PM, Charles Shapiro <shapiroc@google.com> =
wrote:
>>>> (Removing HTML formatting on email thread so it doesn't get blocked).
>>>>
>>>> For ChromeOS, we're working towards having a single build/image based
>>>> on a reference board that then supports multiple models created by
>>>> OEMs.
>>>>
>>>> Some of the bluetooth config differs on a per model basis, so we need
>>>> to have multiple *.conf files ship on the actual image.
>>>>
>>>> We then modify the init script to check the model at runtime and pass
>>>> the appropriate *.conf file to bluetoothd when it is started.
>>>>
>>>> On Fri, Jun 30, 2017 at 11:42 AM, Marcel Holtmann <marcel@holtmann.org=
> wrote:
>>>>> Hi Shapiro,
>>>>>
>>>>>> Currently, there is an expectation of the main.conf file at a specif=
ic
>>>>>> location.  This prevents system builds that support more than one
>>>>>> platform.
>>>>>>
>>>>>> This adds support so the main.conf file can be specified as a comman=
d
>>>>>> line arg instead, so systems can manage multiple conf files as neces=
sary
>>>>>> and pass the appropriate conf file when the daemon is started.
>>>>>>
>>>>>> Signed-off-by: C Shapiro <shapiroc@chromium.org>
>>>>>> ---
>>>>>> src/bluetoothd.8.in |  4 ++++
>>>>>> src/main.c          | 12 +++++++++++-
>>>>>> 2 files changed, 15 insertions(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
>>>>>> index 97ef3ec94..d61dcc5b3 100644
>>>>>> --- a/src/bluetoothd.8.in
>>>>>> +++ b/src/bluetoothd.8.in
>>>>>> @@ -27,6 +27,10 @@ Print bluetoothd options and exit.
>>>>>> Enable logging in foreground. Directs log output to the controlling =
terminal \
>>>>>> in addition to syslog.
>>>>>> .TP
>>>>>> +.B -f, --configfile
>>>>>> +Specifies an explicit config file path instead of relying on the de=
fault path \
>>>>>> +(@CONFIGDIR@/main.conf) for the config file.
>>>>>> +.TP
>>>>>> .B -d, --debug=3D<file1>:<file2>:...
>>>>>> Sets how much information bluetoothd sends to the log destination (u=
sually \
>>>>>> syslog's "daemon" facility). If the file options are omitted, then d=
ebugging \
>>>>>> diff --git a/src/main.c b/src/main.c
>>>>>> index bcc1e6fae..87bdb66cb 100644
>>>>>> --- a/src/main.c
>>>>>> +++ b/src/main.c
>>>>>> @@ -490,6 +490,7 @@ static guint setup_signalfd(void)
>>>>>> static char *option_debug =3D NULL;
>>>>>> static char *option_plugin =3D NULL;
>>>>>> static char *option_noplugin =3D NULL;
>>>>>> +static char *option_configfile =3D NULL;
>>>>>> static gboolean option_compat =3D FALSE;
>>>>>> static gboolean option_detach =3D TRUE;
>>>>>> static gboolean option_version =3D FALSE;
>>>>>> @@ -505,6 +506,9 @@ static void free_options(void)
>>>>>>
>>>>>>       g_free(option_noplugin);
>>>>>>       option_noplugin =3D NULL;
>>>>>> +
>>>>>> +     g_free(option_configfile);
>>>>>> +     option_configfile =3D NULL;
>>>>>> }
>>>>>>
>>>>>> static void disconnect_dbus(void)
>>>>>> @@ -577,6 +581,9 @@ static GOptionEntry options[] =3D {
>>>>>>                               "Specify plugins to load", "NAME,..," =
},
>>>>>>       { "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
>>>>>>                               "Specify plugins not to load", "NAME,.=
.." },
>>>>>> +     { "configfile", 'f', 0, G_OPTION_ARG_STRING, &option_configfil=
e,
>>>>>> +                             "Specify an explicit path to the confi=
g file",
>>>>>> +                             "FILE=E2=80=9D},
>>>>>
>>>>> I am failing to understand why this is needed. What problem are you t=
rying to solve here? Can you give an example.
>>>>>
>>>
>>> Btw, can't you link the main.conf with the board specific config?
>>> Still it would be good to know what is that needs changing, is this
>>> related to ControllerMode?
>>>
>>> --
>>> Luiz Augusto von Dentz



--=20
Luiz Augusto von Dentz

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

* [PATCH] Support to change set file via arg
@ 2017-06-30 17:27 C Shapiro
  0 siblings, 0 replies; 10+ messages in thread
From: C Shapiro @ 2017-06-30 17:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Glass, C Shapiro

Currently, there is an expectation of the main.conf file at a specific
location.  This prevents system builds that support more than one
platform.

This adds support so the main.conf file can be specified as a command
line arg instead, so systems can manage multiple conf files as necessary
and pass the appropriate conf file when the daemon is started.

Signed-off-by: C Shapiro <shapiroc@chromium.com>
---
 src/bluetoothd.8.in |  4 ++++
 src/main.c          | 12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/bluetoothd.8.in b/src/bluetoothd.8.in
index 97ef3ec94..d61dcc5b3 100644
--- a/src/bluetoothd.8.in
+++ b/src/bluetoothd.8.in
@@ -27,6 +27,10 @@ Print bluetoothd options and exit.
 Enable logging in foreground. Directs log output to the controlling terminal \
 in addition to syslog.
 .TP
+.B -f, --configfile
+Specifies an explicit config file path instead of relying on the default path \
+(@CONFIGDIR@/main.conf) for the config file.
+.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 \
diff --git a/src/main.c b/src/main.c
index bcc1e6fae..87bdb66cb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -490,6 +490,7 @@ static guint setup_signalfd(void)
 static char *option_debug = NULL;
 static char *option_plugin = NULL;
 static char *option_noplugin = NULL;
+static char *option_configfile = NULL;
 static gboolean option_compat = FALSE;
 static gboolean option_detach = TRUE;
 static gboolean option_version = FALSE;
@@ -505,6 +506,9 @@ static void free_options(void)
 
 	g_free(option_noplugin);
 	option_noplugin = NULL;
+
+	g_free(option_configfile);
+	option_configfile = NULL;
 }
 
 static void disconnect_dbus(void)
@@ -577,6 +581,9 @@ static GOptionEntry options[] = {
 				"Specify plugins to load", "NAME,..," },
 	{ "noplugin", 'P', 0, G_OPTION_ARG_STRING, &option_noplugin,
 				"Specify plugins not to load", "NAME,..." },
+	{ "configfile", 'f', 0, G_OPTION_ARG_STRING, &option_configfile,
+				"Specify an explicit path to the config file",
+				"FILE"},
 	{ "compat", 'C', 0, G_OPTION_ARG_NONE, &option_compat,
 				"Provide deprecated command line interfaces" },
 	{ "experimental", 'E', 0, G_OPTION_ARG_NONE, &option_experimental,
@@ -636,7 +643,10 @@ int main(int argc, char *argv[])
 
 	sd_notify(0, "STATUS=Starting up");
 
-	main_conf = load_config(CONFIGDIR "/main.conf");
+	if (option_configfile)
+		main_conf = load_config(option_configfile);
+	else
+		main_conf = load_config(CONFIGDIR "/main.conf");
 
 	parse_config(main_conf);
 
-- 
2.13.2.725.g09c95d1e9-goog


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

end of thread, other threads:[~2017-07-25 18:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-30 17:29 [PATCH] Support to change set file via arg C Shapiro
2017-06-30 17:42 ` Marcel Holtmann
2017-06-30 17:52   ` Charles Shapiro
2017-06-30 17:55   ` Charles Shapiro
2017-06-30 18:05     ` Marcel Holtmann
2017-06-30 18:57     ` Luiz Augusto von Dentz
2017-06-30 19:04       ` Charles Shapiro
2017-07-24 19:18         ` Charles Shapiro
2017-07-25 18:46           ` Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2017-06-30 17:27 C Shapiro

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.