HID: input: map battery system charging
authorJosé Expósito <jose.exposito89@gmail.com>
Thu, 24 Nov 2022 17:59:37 +0000 (18:59 +0100)
committerJiri Kosina <jkosina@suse.cz>
Tue, 20 Dec 2022 14:30:35 +0000 (15:30 +0100)
commita608dc1c06397dc50ab773498433432fb5938f92
treeb66a9dc160a4ea233539d501020196a19d27ab55
parent2043f9a37d163ef4f572992bec7cdcdf54d965de
HID: input: map battery system charging

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>
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