config files
Maksim Yevmenkin
maksim.yevmenkin at savvis.net
Tue Mar 14 00:19:00 UTC 2006
Iain Hibbert wrote:
>>i do not like this idea. having one huge config file for every possible
>>bluetooth application seems like a bad thing to me. i agree, parser code can
>>be moved in libbluetooth (or whatever), but config files should stay separate.
>
> well, yes - one massive file could be bad though not sure how many remote
> bluetooth devices would be in it anyway?
i can only speak for myself. i have about 15 devices myself.
> Its just that to add a mouse to the system, I needed to enter details in 3
> files (and, details are held in two more) which could be considered a bit
> much just for a mouse :)
3 files, i assume, are: /etc/bluetooth/hosts, /etc/bluetooth/hcsecd.conf
and /etc/bluetooth/bthidd.conf. entry in /etc/bluetooth/hosts file is
optional.
i'm not sure which other 2 files you are talking about.
> vaguely related to this, would the attached patch work to reload
> bthidd.conf on SIGHUP? It seems that it should, though I'm not sure if the
> fact that the new_device field is set would be an issue (maybe not, if the
> session already exists?)
there is one problem with this particular patch. please see my comments
inline
> ------------------------------------------------------------------------
>
> --- bthidd.c.orig 2004-11-18 18:05:15.000000000 +0000
> +++ bthidd.c 2006-03-12 20:10:02.000000000 +0000
> @@ -55,7 +55,8 @@
> * bthidd
> */
>
> -static int done = 0; /* are we done? */
> +static int done = 0; /* are we done? */
> +static int reload = 0; /* reload config file */
>
> int
> main(int argc, char *argv[])
> @@ -169,6 +170,11 @@
>
> if (server_do(&srv) < 0)
> break;
> +
> + if (reload && read_config_file() < 0)
> + break;
here we probably want to write_hids_file(), reload_config_file() and
then read_hids_file(). this should address your concern about
'new_device' field.
> +
> + reload = 0;
> }
this probably should be moved inside if (reload) .. statement
> server_shutdown(&srv);
> @@ -249,6 +255,9 @@
> {
> syslog(LOG_NOTICE, "Got signal %d, total number of signals %d",
> s, ++ done);
> +
> + if (s == SIGHUP)
> + reload = 1;
> }
everything above will never work correctly because of '++ done'. even
though bthidd(8) might reload config, it will still exit on next
iteration (because done > 0).
also, i would prefer to have separate handler for SIGHUP.
thanks,
max
>
> /*
More information about the freebsd-bluetooth
mailing list