summaryrefslogtreecommitdiff
path: root/quantum/action_util.c
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2021-12-14 19:40:18 +0100
committerGitHub <noreply@github.com>2021-12-14 10:40:18 -0800
commit8b865a9d6445e3bce6c991224f373d71c67e87e5 (patch)
tree3e78e95b1f6ecc59833ceed1ee6418c93758bab5 /quantum/action_util.c
parentce5a2a736792dc6e3e9957a013821374d01fb6d6 (diff)
[Core] Don't send keyboard reports that propagate no changes to the host (#14065)
Diffstat (limited to 'quantum/action_util.c')
-rw-r--r--quantum/action_util.c9
1 files changed, 8 insertions, 1 deletions
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 <http://www.gnu.org/licenses/>.
#include "action_layer.h"
#include "timer.h"
#include "keycode_config.h"
+#include <string.h>
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