]> git.baikalelectronics.ru Git - kernel.git/commit
HID: hid-input: add support for HID devices reporting Battery Strength
authorJeremy Fitzhardinge <jeremy@goop.org>
Wed, 23 Nov 2011 08:49:14 +0000 (00:49 -0800)
committerJiri Kosina <jkosina@suse.cz>
Mon, 28 Nov 2011 10:10:22 +0000 (11:10 +0100)
commitf36f5571bdcb3a48ee2a1e41d0775f5fdc1329c6
tree37c1c2ba43fdcadac3e7627b57999ebb0c71bee4
parentc44c189f6321ff28db7c0efead0d4c747b594f77
HID: hid-input: add support for HID devices reporting Battery Strength

Some HID devices, such as my Bluetooth mouse, report their battery
strength as an event.  Rather than passing it through as a strange
absolute input event, this patch registers it with the power_supply
subsystem as a battery, so that the device's Battery Strength can be
reported to usermode.

The battery appears in sysfs names
/sys/class/power_supply/hid-<UNIQ>-battery, and it is a child of the
battery-containing device, so it should be clear what it's the battery of.

Unfortunately on my current Fedora 16 system, while the battery does
appear in the UI, it is listed as a Laptop Battery with 0% charge (since
it ignores the "capacity" property of the battery and instead computes
it from the "energy*" fields, which we can't supply given the limited
information contained within the HID Report).

Still, this patch is the first step.

Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/Kconfig
drivers/hid/hid-input.c
include/linux/hid.h