Skip to content

Commit

Permalink
feat(pm): Clear HID data before soft off.
Browse files Browse the repository at this point in the history
* Make sure the connected host has no held HID usages before we sleep.
  • Loading branch information
petejohanson committed Dec 7, 2023
1 parent 5dfab86 commit 593fbe4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/src/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 593fbe4

Please sign in to comment.