From owner-freebsd-bluetooth@FreeBSD.ORG Tue Mar 14 00:19:00 2006 Return-Path: X-Original-To: freebsd-bluetooth@freebsd.org Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A141816A400 for ; Tue, 14 Mar 2006 00:19:00 +0000 (UTC) (envelope-from maksim.yevmenkin@savvis.net) Received: from ismybrain.com (ismybrain.com [64.246.42.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3958843D49 for ; Tue, 14 Mar 2006 00:19:00 +0000 (GMT) (envelope-from maksim.yevmenkin@savvis.net) Received: from [10.254.186.111] (localhost.localdomain [127.0.0.1]) by ismybrain.com (8.11.6/8.11.6) with ESMTP id k2E0IpM24759; Mon, 13 Mar 2006 19:18:52 -0500 Message-ID: <44160BE9.9020306@savvis.net> Date: Mon, 13 Mar 2006 16:18:49 -0800 From: Maksim Yevmenkin User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Iain Hibbert References: <1141918855.418446.1437.nullmailer@galant.ukfsn.org> <44107678.1080206@savvis.net> <1142195365.759631.5369.nullmailer@galant.ukfsn.org> In-Reply-To: <1142195365.759631.5369.nullmailer@galant.ukfsn.org> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-bluetooth@freebsd.org Subject: Re: config files X-BeenThere: freebsd-bluetooth@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Using Bluetooth in FreeBSD environments List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Mar 2006 00:19:00 -0000 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 > > /*