From owner-freebsd-bluetooth@FreeBSD.ORG Thu Apr 6 04:25:01 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 941A016A401 for ; Thu, 6 Apr 2006 04:25:01 +0000 (UTC) (envelope-from anderson@centtech.com) Received: from mh1.centtech.com (moat3.centtech.com [207.200.51.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 115F743D45 for ; Thu, 6 Apr 2006 04:25:00 +0000 (GMT) (envelope-from anderson@centtech.com) Received: from [192.168.42.21] (andersonbox1.centtech.com [192.168.42.21]) by mh1.centtech.com (8.13.1/8.13.1) with ESMTP id k364OxZN059051; Wed, 5 Apr 2006 23:24:59 -0500 (CDT) (envelope-from anderson@centtech.com) Message-ID: <4434980E.8050202@centtech.com> Date: Wed, 05 Apr 2006 23:24:46 -0500 From: Eric Anderson User-Agent: Thunderbird 1.5 (X11/20060112) MIME-Version: 1.0 To: Maksim Yevmenkin References: <43F34314.7030606@centtech.com> <43F3688B.8060700@savvis.net> <43F4B7AA.5030000@centtech.com> <43F5229C.8050106@savvis.net> <43F5D186.7060302@centtech.com> <43F60A7B.2090206@savvis.net> <43F62314.1070101@centtech.com> <43F645BB.4070008@savvis.net> In-Reply-To: <43F645BB.4070008@savvis.net> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.87.1/1376/Wed Apr 5 00:51:25 2006 on mh1.centtech.com X-Virus-Status: Clean Cc: freebsd-bluetooth@freebsd.org Subject: Re: mouse battery status? 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: Thu, 06 Apr 2006 04:25:01 -0000 Maksim Yevmenkin wrote: > Eric Anderson wrote: > > [...] > >>>>>> I wonder where the right place to report the battery information is? >>>>> >>>>> like i said, right now it goes to /var/log/messages. info, notice >>>>> and warning levels are used for different battery states (ok, low, >>>>> very low). if this is not the right place, please let me know where >>>>> do you want it to be? >>>> >>>> I suppose if one wanted to make a tool to monitor the mouse battery >>>> (say, for an X window manager), you could poll/parse the output of >>>> bthidcontrol, right? Is there a better way to grab the info (a >>>> bthid library or something)? Sorry if this is a trivial question - >>>> I'm not a bluetooth hacker :) >>> >>> not quite. "battery report" is an input report, i.e. mouse should >>> send it periodically. bhtidd(8) already parses it. the question is >>> what should it do with this information? right now it just logs it. >>> it could send another message to another application (i.e. mouse >>> battery monitoring tool) so it can do whatever is required. >> >> I think either a sysctl entry that shows the value (0 - 3) would be >> nice. I guess ng_hci would create it? Then bthidd would just change >> the sysctl value when it gets the report from the mouse.. ? > > sysctl sounds like a good idea, but i'm not sure who would create such > sysctl. it most definitely does not belong at bluetooth hci, l2cap, > rfcomm and even socket layer. this information is strictly for hid. so, > i think, syslog is the best place for it right now. it is possible to > divert these messages into another file and have monitoring tool > look/parse the file periodically. What about a simple tiny kernel module that can maintain these and other tweaks related to bluetooth? Like a btmon.ko? Eric -- ------------------------------------------------------------------------ Eric Anderson Sr. Systems Administrator Centaur Technology Anything that works is better than anything that doesn't. ------------------------------------------------------------------------ From owner-freebsd-bluetooth@FreeBSD.ORG Thu Apr 6 07:51:25 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 24F6A16A401 for ; Thu, 6 Apr 2006 07:51:25 +0000 (UTC) (envelope-from plunky@rya-online.net) Received: from mail07.svc.cra.dublin.eircom.net (mail07.svc.cra.dublin.eircom.net [159.134.118.23]) by mx1.FreeBSD.org (Postfix) with SMTP id 4BEBB43D46 for ; Thu, 6 Apr 2006 07:51:23 +0000 (GMT) (envelope-from plunky@rya-online.net) Received: (qmail 4951 messnum 2896211 invoked from network[83.70.176.191/unknown]); 6 Apr 2006 07:51:22 -0000 Received: from unknown (HELO rya-online.net) (83.70.176.191) by mail07.svc.cra.dublin.eircom.net (qp 4951) with SMTP; 6 Apr 2006 07:51:22 -0000 Received: (nullmailer pid 1303 invoked by uid 1000); Thu, 06 Apr 2006 07:49:50 -0000 Date: Thu, 6 Apr 2006 08:49:50 +0100 (BST) To: Eric Anderson In-Reply-To: <4434980E.8050202@centtech.com> References: <43F34314.7030606@centtech.com> <43F3688B.8060700@savvis.net> <43F4B7AA.5030000@centtech.com> <43F5229C.8050106@savvis.net> <43F5D186.7060302@centtech.com> <43F60A7B.2090206@savvis.net> <43F62314.1070101@centtech.com> <43F645BB.4070008@savvis.net> <4434980E.8050202@centtech.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Message-Id: <1144309790.220711.1109.nullmailer@galant.ukfsn.org> From: Iain Hibbert Cc: freebsd-bluetooth@freebsd.org Subject: Re: mouse battery status? 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: Thu, 06 Apr 2006 07:51:25 -0000 On Wed, 5 Apr 2006, Eric Anderson wrote: > What about a simple tiny kernel module that can maintain these and other > tweaks related to bluetooth? Like a btmon.ko? This seems overly complex. Can you not just add an entry in your syslog.conf to filter messages from bthidd? I have not tried this, but syslog.conf(5) on appears to show that it is possible, eg: !bthidd *.* |/usr/bin/batmon though I'm not so sure what the 'batmon' program would do - it can extract the battery reports at least, but can't really do anything with them. Probably better to just feed bthidd output to a logfile and get a user program to parse it. You could add a commandline option to bthidd to make it do special logging of the battery information, eg add if (battery_log) syslog(LOG_LOCAL7, "%s %d", bt_ntoa(&s->bdaddr, NULL), val); to the battery report section which might make parsing easier, and use something like !bthidd user.local7 /var/log/bthidd.batlog so you dont have to worry about all the other stuff. Then, your user program will just have to open battery.log and sit in a read() loop to get what it needs. iain From owner-freebsd-bluetooth@FreeBSD.ORG Thu Apr 6 13:48:44 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 EF8D516A435 for ; Thu, 6 Apr 2006 13:48:44 +0000 (UTC) (envelope-from anderson@centtech.com) Received: from mh2.centtech.com (moat3.centtech.com [207.200.51.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 68E4343D6B for ; Thu, 6 Apr 2006 13:48:38 +0000 (GMT) (envelope-from anderson@centtech.com) Received: from [10.177.171.220] (neutrino.centtech.com [10.177.171.220]) by mh2.centtech.com (8.13.1/8.13.1) with ESMTP id k36DmZv1076669; Thu, 6 Apr 2006 08:48:36 -0500 (CDT) (envelope-from anderson@centtech.com) Message-ID: <44351C26.1060509@centtech.com> Date: Thu, 06 Apr 2006 08:48:22 -0500 From: Eric Anderson User-Agent: Thunderbird 1.5 (X11/20060112) MIME-Version: 1.0 To: Iain Hibbert References: <43F34314.7030606@centtech.com> <43F3688B.8060700@savvis.net> <43F4B7AA.5030000@centtech.com> <43F5229C.8050106@savvis.net> <43F5D186.7060302@centtech.com> <43F60A7B.2090206@savvis.net> <43F62314.1070101@centtech.com> <43F645BB.4070008@savvis.net> <4434980E.8050202@centtech.com> <1144309790.220711.1109.nullmailer@galant.ukfsn.org> In-Reply-To: <1144309790.220711.1109.nullmailer@galant.ukfsn.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.87.1/1377/Thu Apr 6 01:17:48 2006 on mh2.centtech.com X-Virus-Status: Clean Cc: freebsd-bluetooth@freebsd.org Subject: Re: mouse battery status? 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: Thu, 06 Apr 2006 13:48:45 -0000 Iain Hibbert wrote: > On Wed, 5 Apr 2006, Eric Anderson wrote: > >> What about a simple tiny kernel module that can maintain these and other >> tweaks related to bluetooth? Like a btmon.ko? > > This seems overly complex. Can you not just add an entry in your > syslog.conf to filter messages from bthidd? I have not tried this, but > syslog.conf(5) on appears to show that it is possible, eg: > > !bthidd > *.* |/usr/bin/batmon > > though I'm not so sure what the 'batmon' program would do - it can extract > the battery reports at least, but can't really do anything with them. > Probably better to just feed bthidd output to a logfile and get a user > program to parse it. You could add a commandline option to bthidd to make > it do special logging of the battery information, eg add > > if (battery_log) > syslog(LOG_LOCAL7, "%s %d", bt_ntoa(&s->bdaddr, NULL), val); > > to the battery report section which might make parsing easier, and use > something like > > !bthidd > user.local7 /var/log/bthidd.batlog > > so you dont have to worry about all the other stuff. Then, your user > program will just have to open battery.log and sit in a read() loop to get > what it needs. I suppose logging it, and having a monitoring daemon read the log is ok, but for tools that want to just probe every X minutes and report the level, it isn't as slick. The idea of a module would be more generic, so it could monitor all kinds of bluetooth related things, and allow a simple control interface to flip knobs if needed, very much like ACPI battery status is. I was thinking of a sysctl tree like: bluetooth.mouse.battery_level bluetooth.keyboard.battery_level etc.. Eric -- ------------------------------------------------------------------------ Eric Anderson Sr. Systems Administrator Centaur Technology Anything that works is better than anything that doesn't. ------------------------------------------------------------------------ From owner-freebsd-bluetooth@FreeBSD.ORG Thu Apr 6 19:10:30 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 450BF16A5F6 for ; Thu, 6 Apr 2006 19:10:30 +0000 (UTC) (envelope-from maksim.yevmenkin@savvis.net) Received: from mailgate1b.savvis.net (mailgate1b.savvis.net [216.91.182.6]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B826452DC for ; Thu, 6 Apr 2006 16:59:54 +0000 (GMT) (envelope-from maksim.yevmenkin@savvis.net) Received: from localhost (localhost.localdomain [127.0.0.1]) by mailgate1b.savvis.net (Postfix) with ESMTP id 9EED53BE83; Thu, 6 Apr 2006 11:59:53 -0500 (CDT) Received: from mailgate1b.savvis.net ([127.0.0.1]) by localhost (mailgate1b.savvis.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06684-02-19; Thu, 6 Apr 2006 11:59:53 -0500 (CDT) Received: from [10.254.186.111] (sntc04ep01.savvis.net [64.14.1.106]) by mailgate1b.savvis.net (Postfix) with ESMTP id E42783BE7E; Thu, 6 Apr 2006 11:59:52 -0500 (CDT) Message-ID: <44354908.9030505@savvis.net> Date: Thu, 06 Apr 2006 09:59:52 -0700 From: Maksim Yevmenkin User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050404) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Eric Anderson References: <43F34314.7030606@centtech.com> <43F3688B.8060700@savvis.net> <43F4B7AA.5030000@centtech.com> <43F5229C.8050106@savvis.net> <43F5D186.7060302@centtech.com> <43F60A7B.2090206@savvis.net> <43F62314.1070101@centtech.com> <43F645BB.4070008@savvis.net> <4434980E.8050202@centtech.com> <1144309790.220711.1109.nullmailer@galant.ukfsn.org> <44351C26.1060509@centtech.com> In-Reply-To: <44351C26.1060509@centtech.com> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at savvis.net Cc: freebsd-bluetooth@freebsd.org Subject: Re: mouse battery status? 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: Thu, 06 Apr 2006 19:10:30 -0000 Eric, >>> What about a simple tiny kernel module that can maintain these and other >>> tweaks related to bluetooth? Like a btmon.ko? >> >> This seems overly complex. Can you not just add an entry in your >> syslog.conf to filter messages from bthidd? I have not tried this, but >> syslog.conf(5) on appears to show that it is possible, eg: >> >> !bthidd >> *.* |/usr/bin/batmon >> >> though I'm not so sure what the 'batmon' program would do - it can >> extract >> the battery reports at least, but can't really do anything with them. >> Probably better to just feed bthidd output to a logfile and get a user >> program to parse it. You could add a commandline option to bthidd to make >> it do special logging of the battery information, eg add >> >> if (battery_log) >> syslog(LOG_LOCAL7, "%s %d", bt_ntoa(&s->bdaddr, NULL), val); >> >> to the battery report section which might make parsing easier, and use >> something like >> >> !bthidd >> user.local7 /var/log/bthidd.batlog >> >> so you dont have to worry about all the other stuff. Then, your user >> program will just have to open battery.log and sit in a read() loop to >> get > > I suppose logging it, and having a monitoring daemon read the log is ok, > but for tools that want to just probe every X minutes and report the > level, it isn't as slick. well, you could use kqueue(2) and get notification when log file is changed. this way you do not have to poll the file. > The idea of a module would be more generic, so it could monitor all > kinds of bluetooth related things, and allow a simple control interface > to flip knobs if needed, very much like ACPI battery status is. I was > thinking of a sysctl tree like: > > bluetooth.mouse.battery_level > bluetooth.keyboard.battery_level > etc.. perhaps i'm missing something here, but wouldn't the sysctl's have to be polled as well? thanks, max From owner-freebsd-bluetooth@FreeBSD.ORG Thu Apr 6 19:46:36 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 95B2416A40A for ; Thu, 6 Apr 2006 19:46:36 +0000 (UTC) (envelope-from anderson@centtech.com) Received: from mh1.centtech.com (moat3.centtech.com [207.200.51.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 083AD43E08 for ; Thu, 6 Apr 2006 19:43:10 +0000 (GMT) (envelope-from anderson@centtech.com) Received: from [10.177.171.220] (neutrino.centtech.com [10.177.171.220]) by mh1.centtech.com (8.13.1/8.13.1) with ESMTP id k36Jh8kE098423; Thu, 6 Apr 2006 14:43:08 -0500 (CDT) (envelope-from anderson@centtech.com) Message-ID: <44356F3C.1090508@centtech.com> Date: Thu, 06 Apr 2006 14:42:52 -0500 From: Eric Anderson User-Agent: Thunderbird 1.5 (X11/20060112) MIME-Version: 1.0 To: Maksim Yevmenkin References: <43F34314.7030606@centtech.com> <43F3688B.8060700@savvis.net> <43F4B7AA.5030000@centtech.com> <43F5229C.8050106@savvis.net> <43F5D186.7060302@centtech.com> <43F60A7B.2090206@savvis.net> <43F62314.1070101@centtech.com> <43F645BB.4070008@savvis.net> <4434980E.8050202@centtech.com> <1144309790.220711.1109.nullmailer@galant.ukfsn.org> <44351C26.1060509@centtech.com> <44354908.9030505@savvis.net> In-Reply-To: <44354908.9030505@savvis.net> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.87.1/1377/Thu Apr 6 01:17:48 2006 on mh1.centtech.com X-Virus-Status: Clean Cc: freebsd-bluetooth@freebsd.org Subject: Re: mouse battery status? 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: Thu, 06 Apr 2006 19:46:37 -0000 Maksim Yevmenkin wrote: > Eric, > >>>> What about a simple tiny kernel module that can maintain these and >>>> other >>>> tweaks related to bluetooth? Like a btmon.ko? >>> >>> This seems overly complex. Can you not just add an entry in your >>> syslog.conf to filter messages from bthidd? I have not tried this, but >>> syslog.conf(5) on appears to show that it is possible, eg: >>> >>> !bthidd >>> *.* |/usr/bin/batmon >>> >>> though I'm not so sure what the 'batmon' program would do - it can >>> extract >>> the battery reports at least, but can't really do anything with them. >>> Probably better to just feed bthidd output to a logfile and get a user >>> program to parse it. You could add a commandline option to bthidd to >>> make >>> it do special logging of the battery information, eg add >>> >>> if (battery_log) >>> syslog(LOG_LOCAL7, "%s %d", bt_ntoa(&s->bdaddr, NULL), val); >>> >>> to the battery report section which might make parsing easier, and use >>> something like >>> >>> !bthidd >>> user.local7 /var/log/bthidd.batlog >>> >>> so you dont have to worry about all the other stuff. Then, your user >>> program will just have to open battery.log and sit in a read() loop >>> to get >> >> I suppose logging it, and having a monitoring daemon read the log is >> ok, but for tools that want to just probe every X minutes and report >> the level, it isn't as slick. > > well, you could use kqueue(2) and get notification when log file is > changed. this way you do not have to poll the file. > >> The idea of a module would be more generic, so it could monitor all >> kinds of bluetooth related things, and allow a simple control >> interface to flip knobs if needed, very much like ACPI battery status >> is. I was thinking of a sysctl tree like: >> >> bluetooth.mouse.battery_level >> bluetooth.keyboard.battery_level >> etc.. > > perhaps i'm missing something here, but wouldn't the sysctl's have to be > polled as well? Yea, I suppose I was thinking it would be easier for a small binary program (or several different kinds) to be able to snag the latest information from the sysctl, rather than having them dig through log files and such. I guess in the end, I don't care how it's done, but digging through logs seems a little like a kludge and less robust.. Since nobody else seems to care too much, I guess I'll cobble up a perl script to just munge together what I want... :) Eric -- ------------------------------------------------------------------------ Eric Anderson Sr. Systems Administrator Centaur Technology Anything that works is better than anything that doesn't. ------------------------------------------------------------------------