Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: allow kscan-composite to wake up device. #2682

Merged
merged 3 commits into from
Dec 11, 2024

Conversation

svek1
Copy link
Contributor

@svek1 svek1 commented Dec 1, 2024

The kscan-composite driver does not respect the wakeup capabilities of its child kscans.
This branch fixes that by checking for their capabilities and whether the composite kscan is a wakeup source, before disabling them.

Relates to #2654 and #2673

PR check-list

  • Branch has a clean commit history
  • Additional tests are included, if changing behaviors/core code that is testable.
  • Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited)
  • Pre-commit used to check formatting of files, commit messages, etc.

svek1 added 2 commits December 1, 2024 19:09
include kscan.yaml so we can set kscan-composite as a wakeup source
modify enable and disable callback to check for wakeup capabilities of
composite and children
@svek1 svek1 requested review from a team as code owners December 1, 2024 18:16
@caksoylar caksoylar added the core Core functionality/behavior of ZMK label Dec 1, 2024
Copy link
Contributor

@petejohanson petejohanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! One comment on the code change.

Comment on lines 73 to 75
if (pm_device_wakeup_is_enabled(dev) && pm_device_wakeup_is_enabled(child_cfg->child)) {
continue;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect this to disable wakeup on the child device when the composite is getting disabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct I think: the disable function is only called when the composite is not an enabled wakeup source. In that case the children should also not be an enabled wakeup source, so they can get suspended.

The disable function is only called
when the composite is not an enabled wakeup source.
In that case the children should also not be an enabled
wakeup source, so they can get suspended
Copy link
Contributor

@petejohanson petejohanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be disabling, not enabling here.

app/module/drivers/kscan/kscan_composite.c Show resolved Hide resolved
Copy link
Contributor

@petejohanson petejohanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@petejohanson petejohanson merged commit a8f5ab6 into zmkfirmware:main Dec 11, 2024
24 checks passed
@svek1 svek1 deleted the composite-wakeup-fix branch December 11, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core functionality/behavior of ZMK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants