aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPeter Johanson <[email protected]>2023-12-07 00:37:31 +0000
committerPete Johanson <[email protected]>2024-03-27 20:59:26 -0700
commit0d4d4fb2b5bdfd2b259febe14a9b1dfbf991872d (patch)
tree5cfe45f68e5565c6b103a10915e7c3429d1aece9
parent860e53b33ac3b09b233a0ec4c6cb0621895fb16c (diff)
downloadzmk-0d4d4fb2b5bdfd2b259febe14a9b1dfbf991872d.tar.gz
zmk-0d4d4fb2b5bdfd2b259febe14a9b1dfbf991872d.zip
feat(pm): Clear HID data before soft off.
* Make sure the connected host has no held HID usages before we sleep.
-rw-r--r--app/src/pm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/src/pm.c b/app/src/pm.c
index af12623918..a78b6ae53c 100644
--- a/app/src/pm.c
+++ b/app/src/pm.c
@@ -13,6 +13,8 @@
#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
+#include <zmk/endpoints.h>
+
#define HAS_WAKERS DT_HAS_COMPAT_STATUS_OKAY(zmk_soft_off_wakeup_sources)
#if HAS_WAKERS
@@ -29,6 +31,10 @@ int zmk_pm_soft_off(void) {
size_t device_count;
const struct device *devs;
+#if !IS_ENABLED(CONFIG_ZMK_SPLIT) || IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
+ zmk_endpoints_clear_current();
+#endif
+
device_count = z_device_get_all_static(&devs);
// There may be some matrix/direct kscan devices that would be used for wakeup