Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Mar 2006 16:18:49 -0800
From:      Maksim Yevmenkin <maksim.yevmenkin@savvis.net>
To:        Iain Hibbert <plunky@rya-online.net>
Cc:        freebsd-bluetooth@freebsd.org
Subject:   Re: config files
Message-ID:  <44160BE9.9020306@savvis.net>
In-Reply-To: <1142195365.759631.5369.nullmailer@galant.ukfsn.org>
References:  <1141918855.418446.1437.nullmailer@galant.ukfsn.org> <44107678.1080206@savvis.net> <1142195365.759631.5369.nullmailer@galant.ukfsn.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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

>  
>  /*




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44160BE9.9020306>