Skip to content

fix(pointing): Support multiple temp layer instances#3241

Open
nobyk wants to merge 2 commits intozmkfirmware:mainfrom
nobyk:v0.3-multiple-temp-layers
Open

fix(pointing): Support multiple temp layer instances#3241
nobyk wants to merge 2 commits intozmkfirmware:mainfrom
nobyk:v0.3-multiple-temp-layers

Conversation

@nobyk
Copy link
Copy Markdown

@nobyk nobyk commented Feb 15, 2026

Previously, the input-processor-temp-layer driver failed to support multiple instances because the background work queue callback (layer_action_work_cb) was hardcoded to operate only on the first driver instance (instance 0). This caused actions from secondary instances to either be ignored or incorrectly apply state changes to the first instance.

This commit fixes the issue by:

  • Adding a dev pointer to the layer_state_action struct to identify the originating device instance for each event.
  • Updating the work callback to use the specific device instance from the action payload.
  • Implementing a lookup mechanism for timeout-based deactivation to find and update the correct active instance managing the expiring layer.
  • Fixing macro expansion errors in DT_INST_FOREACH_STATUS_OKAY usage.

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.
  • Includes any necessary documentation changes.

Previously, the `input-processor-temp-layer` driver failed to support
multiple instances because the background work queue callback
(`layer_action_work_cb`) was hardcoded to operate only on the first
driver instance (instance 0). This caused actions from secondary
instances to either be ignored or incorrectly apply state changes to
the first instance.

This commit fixes the issue by:
- Adding a `dev` pointer to the `layer_state_action` struct to identify
  the originating device instance for each event.
- updating the work callback to use the specific device instance from
  the action payload.
- Implementing a lookup mechanism for timeout-based deactivation to
  find and update the correct active instance managing the expiring layer.
- Fixing macro expansion errors in `DT_INST_FOREACH_STATUS_OKAY` usage.
@nobyk nobyk marked this pull request as ready for review February 15, 2026 08:09
@nobyk nobyk requested a review from a team as a code owner February 15, 2026 08:09
Copy link
Copy Markdown
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.

Generally seems reasonable, just one minor comment on the mutex use. Thanks!

Comment thread app/src/pointing/input_processor_temp_layer.c Outdated
Add return check and logging for k_mutex_lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants