From 8b865a9d6445e3bce6c991224f373d71c67e87e5 Mon Sep 17 00:00:00 2001 From: Stefan Kerkmann Date: Tue, 14 Dec 2021 19:40:18 +0100 Subject: [Core] Don't send keyboard reports that propagate no changes to the host (#14065) --- quantum/action_util.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'quantum') diff --git a/quantum/action_util.c b/quantum/action_util.c index 78e02aec18..7e30593fb1 100644 --- a/quantum/action_util.c +++ b/quantum/action_util.c @@ -21,6 +21,7 @@ along with this program. If not, see . #include "action_layer.h" #include "timer.h" #include "keycode_config.h" +#include extern keymap_config_t keymap_config; @@ -247,7 +248,13 @@ void send_keyboard_report(void) { keyboard_report->mods |= weak_override_mods; #endif - host_keyboard_send(keyboard_report); + static report_keyboard_t last_report; + + /* Only send the report if there are changes to propagate to the host. */ + if (memcmp(keyboard_report, &last_report, sizeof(report_keyboard_t)) != 0) { + memcpy(&last_report, keyboard_report, sizeof(report_keyboard_t)); + host_keyboard_send(keyboard_report); + } } /** \brief Get mods -- cgit v1.2.3