AnalogueKeyboard: support reports interleaving with other apps #146
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using AnalogSense with any app that interacts with your keyboard at the same time, an app that was using the
universal-analog-plugin
crashes. This is especially true with any RGB software where you would ideally want to control the lighting of your keyboard at the same time when you play an analog-enabled game.To solve this problem, we should only consider receiving reports that are actually meant for us (while skipping everything else). Since every report in QMK mirrors its command id and value id, we can you that info to determine which of the received reports is really answering our request.
I've tested on Lemokey P1 HE in cyberpunk and midi app. This approach works reliably and doesn't add any delay. We could probably use
safeReceiveReport
in other places for other keyboards, but I don't have the devices to test them, so I decided not to change anything there.Here is a compiled version to test it out: universal-analog-plugin.zip