From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Jiri Kosina <jkosina@suse.cz>
Cc: linux-input@vger.kernel.org, vojtech@ucw.cz
Subject: Re: Supporting Battery Strength from my Bluetooth Mouse
Date: Sat, 19 Nov 2011 13:34:48 -0800 [thread overview]
Message-ID: <4EC820F8.4070900@goop.org> (raw)
In-Reply-To: <alpine.LNX.2.00.1111191212140.15187@pobox.suse.cz>
On 11/19/2011 03:18 AM, Jiri Kosina wrote:
> the debugfs patch is obviously correct(tm), so I will be queuing it,
> thanks.
Thanks.
>> My real question is how to get this out to somewhere useful, where
>> (ultimately) some GUI could show the battery information if its
>> available?
> Actually the proper way to do this is using power_supply class.
>
> There alreasy is a HID driver that does this properly, and it's rather
> easy. Check drivers/hid/hid-wacom.c, especially all the code which is
> #ifdef CONFIG_HID_WACOM_POWER_SUPPLY
Hm, OK. I wonder what the descriptor for that device looks like; I
wonder if it already uses Battery Strength, but just hard-coded?
Given that this is a generic HID thing, where should it go? Should
hid-core.c go around trying to create new power supplies?
Seems to me that there's a good chance that random devices will claim to
supply Battery Strength info even if they don't have batteries because
they happen to share firmware with a device that does (similarly, its
amazing how many keys my keyboard is missing according to the
descriptor). I guess the best way to handle it is have a hid-core
helper function which will register a power_supply if the driver asks it
to (and the descriptor contains Battery Strength). Bluetooth, for
example, has a separate descriptor entry about whether the device is
battery powered which is much more likely to be accurate than the
generic HID descriptor, and it can call the power supply helper as part
of the HID setup.
Does that sound reasonable?
>> (Hm, and I wonder what makes the mouse actually report the battery
>> level; I guess I'll only ever see a report if it actually changes.)
> I'd expect that as a "default" behavior, yes. Unfortunately it might also
> be possible that there is some vendor-specific way to actually query the
> battery state, but it'd be difficult to find out without actually snooping
> the behavior in some other OS.
>
> But as long as it contains proper entry in report descriptor, I'd expect
> it to send the report on its own.
My reading of the evdev documentation is that it would suppress
duplicate reports to usermode, so my little program wouldn't see any
events from /dev/input/eventX unless there were a change anyway, is that
right?
Thanks,
J
next prev parent reply other threads:[~2011-11-19 21:34 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-19 6:52 Supporting Battery Strength from my Bluetooth Mouse Jeremy Fitzhardinge
2011-11-19 11:18 ` Jiri Kosina
2011-11-19 21:34 ` Jeremy Fitzhardinge [this message]
2011-11-20 10:26 ` Jiri Kosina
2011-11-21 16:38 ` Jeremy Fitzhardinge
2011-11-21 17:36 ` Dmitry Torokhov
2011-11-21 17:49 ` Jeremy Fitzhardinge
2011-11-21 23:29 ` Jiri Kosina
2011-11-21 23:34 ` Jeremy Fitzhardinge
2011-11-22 0:03 ` Jiri Kosina
2011-11-23 8:49 ` [PATCH RFC] hid-input: add support for HID devices reporting Battery Strength Jeremy Fitzhardinge
2011-11-23 16:36 ` Chase Douglas
2011-11-23 21:07 ` Jeremy Fitzhardinge
2011-11-23 21:52 ` Przemo Firszt
2011-11-28 21:33 ` Jiri Kosina
2011-12-02 5:52 ` Daniel Nicoletti
2011-12-02 17:44 ` Jeremy Fitzhardinge
2011-12-02 18:29 ` Daniel Nicoletti
2011-12-03 6:09 ` Jeremy Fitzhardinge
2011-12-03 6:13 ` [GIT PULL RFC] directly poll battery strength when reading power_supply Jeremy Fitzhardinge
2011-12-06 9:17 ` Jiri Kosina
2011-12-08 1:56 ` Jeremy Fitzhardinge
2012-05-19 4:10 ` Daniel Nicoletti
2011-12-06 9:56 ` Richard Hughes
2011-12-06 17:10 ` Jeremy Fitzhardinge
2011-12-07 12:51 ` Richard Hughes
2011-12-07 17:25 ` Jeremy Fitzhardinge
2011-12-07 17:29 ` Richard Hughes
2011-12-07 17:36 ` Jeremy Fitzhardinge
2011-12-07 17:41 ` Richard Hughes
2011-12-08 1:41 ` [GIT PULL] power_supply: add power supply scope Jeremy Fitzhardinge
2011-12-08 1:41 ` Jeremy Fitzhardinge
2011-12-08 10:02 ` Anton Vorontsov
2011-12-08 10:05 ` Richard Hughes
2011-12-08 10:42 ` Anton Vorontsov
2011-12-08 10:41 ` Anton Vorontsov
2011-12-08 16:53 ` Jeremy Fitzhardinge
2011-12-08 23:36 ` Anton Vorontsov
2011-12-09 8:18 ` Jeremy Fitzhardinge
2011-12-09 9:59 ` Anton Vorontsov
2011-12-09 16:58 ` Jeremy Fitzhardinge
2011-12-09 10:17 ` Anton Vorontsov
2011-12-09 17:49 ` Jeremy Fitzhardinge
2011-12-09 20:00 ` Daniel Nicoletti
2011-12-09 20:36 ` Jeremy Fitzhardinge
2011-12-02 17:58 ` [PATCH RFC] hid-input: add support for HID devices reporting Battery Strength Jeremy Fitzhardinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EC820F8.4070900@goop.org \
--to=jeremy@goop.org \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=vojtech@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.