linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Supporting Battery Strength from my Bluetooth Mouse
@ 2011-11-19  6:52 Jeremy Fitzhardinge
  2011-11-19 11:18 ` Jiri Kosina
  0 siblings, 1 reply; 45+ messages in thread
From: Jeremy Fitzhardinge @ 2011-11-19  6:52 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input, vojtech

My Bluetooth mouse (HP branded, but some generic Taiwanese innards)
supports reporting its battery level.

The data appears in its HID descriptor as:

  INPUT(3)[INPUT]
    Field(0)
      Usage(1)
        0006.0020
      Logical Minimum(0)
      Logical Maximum(255)
      Report Size(8)
      Report Count(1)
      Report Offset(0)
      Flags( Variable Absolute )

which is consistent with the USB HID Usage Tables 1.12 spec, which lists
Usage Page 6 as Generic Device Controls and Usage ID 0x20 as Battery
Strength.  I'm assuming that this is commonplace on battery-powered
mice, but I only have one to check.

I've written an (untested) patch to display this correctly in debugfs.
(below)

My real question is how to get this out to somewhere useful, where
(ultimately) some GUI could show the battery information if its available?

Is the next step to define a new ABS_BATTERY_STRENGTH type for it (and
likewise for the other values, though I have no idea what the Security
stuff is about)?  Then at least it will appear in evdev in a useful way,
and becomes usermode's problem to deal with it.

(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.)

Any guidance?

Thanks,
    J

Subject: [PATCH] hid: decode Generic Device Controls Usage Page

The USB HID Usage Tables spec defines page 6 for Generic Device
Controls, the most useful of which (to me) is Battery Strength.

Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>

diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index ee80d73..01dd9a7 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -114,6 +114,14 @@ static const struct hid_usage_entry hid_usage_table[] = {
       {0, 0xbd, "FlareRelease"},
       {0, 0xbe, "LandingGear"},
       {0, 0xbf, "ToeBrake"},
+  {  6, 0, "GenericDeviceControls" },
+      {0, 0x20, "BatteryStrength" },
+      {0, 0x21, "WirelessChannel" },
+      {0, 0x22, "WirelessID" },
+      {0, 0x23, "DiscoverWirelessControl" },
+      {0, 0x24, "SecurityCodeCharacterEntered" },
+      {0, 0x25, "SecurityCodeCharactedErased" },
+      {0, 0x26, "SecurityCodeCleared" },
   {  7, 0, "Keyboard" },
   {  8, 0, "LED" },
       {0, 0x01, "NumLock"},



^ permalink raw reply related	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2012-05-19  4:10 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).