Date: Fri, 17 Feb 2006 07:37:10 -0600 From: Eric Anderson <anderson@centtech.com> To: Maksim Yevmenkin <maksim.yevmenkin@savvis.net> Cc: freebsd-bluetooth@freebsd.org Subject: Re: mouse battery status? Message-ID: <43F5D186.7060302@centtech.com> In-Reply-To: <43F5229C.8050106@savvis.net> References: <43F34314.7030606@centtech.com> <43F3688B.8060700@savvis.net> <43F4B7AA.5030000@centtech.com> <43F5229C.8050106@savvis.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Maksim Yevmenkin wrote: > Eric, > >>>> Is there a way to find the current battery power on a bluetooth >>>> mouse? Here's a bthidcontrol dump of my Logitech mx900: >>> >>> with this patch bthidd(8) should properly detect battery operated >>> devices. that is one piece of the puzzle >>> >>> another piece is that the device should send hid report about its >>> battery status, i.e. bthidd(8) will use syslog(3) facility to log >>> such events. >>> >>> bthidd(8) understand battery report if page is HUP_MICROSOFT and >>> usage is 0xfe01 (please see /usr/src/usr.sbin/bluetooth/bthidd/hid.c >>> for details). >>> >>> i do not see page == microsoft and usage == 0xfe01 in the hid >>> descriptor you have posted. so it seems like your mouse will not >>> send battery report. >> >> Ahh - so only MS mice send the output, or that's just a Microsoft >> add-in that others use too? > > do not know. this code in bthidd(8) was written by looking at msdn > docs (i think). > >> I have a microsoft bluetooth mouse at home that I'll try to get the >> info from. > > ok. let us know about the results. Here's a bthidcontrol dump from a microsoft mouse: Collection page=Generic_Desktop usage=Mouse Collection page=Generic_Desktop usage=Pointer Input id=2 size=1 count=1 page=Button usage=Button_1 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Button usage=Button_2 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Button usage=Button_3 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Button usage=Button_4 Variable, logical range 0..1 Input id=2 size=1 count=1 page=Button usage=Button_5 Variable, logical range 0..1 Input id=2 size=3 count=1 page=0x0000 usage=0x0000 Const, logical range 0..1 Input id=2 size=8 count=1 page=Generic_Desktop usage=X Variable Relative, logical range -127..127 Input id=2 size=8 count=1 page=Generic_Desktop usage=Y Variable Relative, logical range -127..127 Input id=2 size=8 count=1 page=Generic_Desktop usage=Wheel Variable Relative, logical range -127..127 Input id=2 size=8 count=1 page=Consumer usage=AC_Pan Variable Relative, logical range -127..127 End collection Feature id=2 size=1 count=1 page=Generic_Desktop usage=0x004b Variable, logical range 0..1 Feature id=2 size=7 count=1 page=0x0000 usage=0x0000 Const, logical range 0..1 End collection Collection page=Consumer usage=Consumer_Control Collection page=Generic_Desktop usage=Mouse Input id=3 size=2 count=1 page=Microsoft usage=0xfe01 Variable, logical range 0..3 Input id=3 size=1 count=1 page=Microsoft usage=0xfe00 Variable, logical range 0..1 Input id=3 size=5 count=1 page=0x0000 usage=0x0000 Const, logical range 0..1 End collection End collection Collection page=Consumer usage=Consumer_Control Collection page=Generic_Desktop usage=Mouse Input id=4 size=8 count=1 page=Consumer usage=AC_Pan Variable Relative, logical range -127..127 Feature id=4 size=1 count=1 page=Microsoft usage=0xff04 Variable, logical range 0..1 Feature id=4 size=1 count=1 page=Microsoft usage=0xff06 Variable, logical range 0..1 Feature id=4 size=1 count=6 page=0x0000 usage=0x0000 Const, logical range 0..1 End collection End collection I also noticed that a query shows this line: battery_power true; What is that telling me? That it is currently on battery power? I suppose if that's the case, then some devices may report false for AC power and true for battery.. >> 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? > > thanks, > max 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 :) Thanks! Eric -- ------------------------------------------------------------------------ Eric Anderson Sr. Systems Administrator Centaur Technology Anything that works is better than anything that doesn't. ------------------------------------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43F5D186.7060302>