aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2017-03-27 10:59:33 -0400
committerJiri Kosina <jkosina@suse.cz>2017-04-06 08:36:38 -0400
commit9b9c519f1fe3ec9d2518a99c71c54f5c25eef345 (patch)
tree60ce5db17f6364e612145a9e9e5ea70f270d6ea8
parenta9525b80feb1b6ae40244b16b0558cbdc64f28cd (diff)
HID: logitech-hidpp: notify battery on connect
When a device reconnects, there is a high chance its power supply has been changed (for a battery replacement for instance). Just forward the battery state here. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Tested-by: Bastien Nocera <hadess@hadess.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-logitech-hidpp.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 22129ddac3ae..0781d2bb00d6 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -2463,6 +2463,13 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
2463 2463
2464 hidpp_initialize_battery(hidpp); 2464 hidpp_initialize_battery(hidpp);
2465 2465
2466 /* forward current battery state */
2467 if (hidpp->capabilities & HIDPP_CAPABILITY_HIDPP20_BATTERY) {
2468 hidpp20_query_battery_info(hidpp);
2469 if (hidpp->battery.ps)
2470 power_supply_changed(hidpp->battery.ps);
2471 }
2472
2466 if (!(hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT) || hidpp->delayed_input) 2473 if (!(hidpp->quirks & HIDPP_QUIRK_NO_HIDINPUT) || hidpp->delayed_input)
2467 /* if the input nodes are already created, we can stop now */ 2474 /* if the input nodes are already created, we can stop now */
2468 return; 2475 return;