From 593fbe48b16a5714dd4b95b59758722a82221059 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Thu, 7 Dec 2023 00:37:31 +0000 Subject: [PATCH] feat(pm): Clear HID data before soft off. * Make sure the connected host has no held HID usages before we sleep. --- app/src/pm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/pm.c b/app/src/pm.c index af12623918f0..5ede6b2eaab6 100644 --- a/app/src/pm.c +++ b/app/src/pm.c @@ -13,6 +13,8 @@ #include LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); +#include + #define HAS_WAKERS DT_HAS_COMPAT_STATUS_OKAY(zmk_soft_off_wakeup_sources) #if HAS_WAKERS @@ -29,6 +31,8 @@ int zmk_pm_soft_off(void) { size_t device_count; const struct device *devs; + zmk_endpoints_clear_current(); + device_count = z_device_get_all_static(&devs); // There may be some matrix/direct kscan devices that would be used for wakeup