]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
HID: input: map battery system charging
authorJosé Expósito <jose.exposito89@gmail.com>
Thu, 24 Nov 2022 17:59:37 +0000 (18:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Oct 2023 10:03:14 +0000 (12:03 +0200)
commit59aa39697fc2bd05f53e9b588ef842ff9e6d0bb3
tree0965030bdaab2c0c08b56406528784008dfe274c
parentea0e0473093fe7b154392ba99b1293471de12c73
HID: input: map battery system charging

commit a608dc1c06397dc50ab773498433432fb5938f92 upstream.

HID descriptors with Battery System (0x85) Charging (0x44) usage are
ignored and POWER_SUPPLY_STATUS_DISCHARGING is always reported to user
space, even when the device is charging.

Map this usage and when it is reported set the right charging status.

In addition, add KUnit tests to make sure that the charging status is
correctly set and reported. They can be run with the usual command:

    $ ./tools/testing/kunit/kunit.py run --kunitconfig=drivers/hid

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/.kunitconfig
drivers/hid/Kconfig
drivers/hid/hid-input-test.c [new file with mode: 0644]
drivers/hid/hid-input.c
include/linux/hid.h