-
Notifications
You must be signed in to change notification settings - Fork 51
MPP v2+, Slim Pen 2, Surface Pro 9 improvements #156
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
Merged
StollD
merged 14 commits into
linux-surface:master
from
iwanders:slim-pen2-surface-pro-9-button-glitch-fix
Mar 3, 2024
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1202ab8
core: config: Add pen protocol version to config
iwanders b844a07
ipts: Handle MPP v2 button detection.
iwanders c80f1f5
etc: presets: Add Surface Pro 9 preset
iwanders c8cfcec
ipts: Fix eraser for MPP v2, change button threshold.
iwanders b4b466a
core: linux: Improve configuration logging
iwanders 3fad801
ipts: Add more reliable contact detection for MPP v2
iwanders 1f8d6bf
core: Prefix MPP version with stylus
iwanders 772fbaf
core: Eliminate specifying pen version
iwanders 9aee2cd
core, ipts: Incorporate minor PR feedback.
iwanders b4ef3bd
presets: Remove surface pro 9 config
iwanders 1623671
core: linux: Add info when no configuration files are loaded
iwanders 5f399fe
core: Incorporate PR feedback around mppv2
iwanders 2d49ff7
core: generic: Allow eraser state on mppv2 button state
iwanders 4895549
core: Remove unused variable from configuration
iwanders File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From your notes I gather that this can't be used with MPP v1 pens because it contains garbage?
Is there any way to detect if the data inside is usable, and adjust the behaviour of the DFT parser accordingly? Dropping the need for a config option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, yeah, I'm not a fan of it either, because it means you can't use a mpp v1 pen without changing the config.
It may actually be possible... if a v1 pen is present, the magnitudes for the
0x0a
frame are very small (100s). So what we could do I guess is check if the signal in the0x0a
frame is above a threshold (50000); if so, it trumps the button detection from the button frame.Let me do a bit more exploration around this to see if I can make it work without explicit configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I think this is possible, we can use a
std::optional<bool>
to specify whether the v2 signal has been detected.I do think it is a good idea to allow different minimum magnitudes for the v2 button vs the v1 button detection though, the scales are completely different;
If we use the same threshold, I can only detect my
m1
pen's button when it is super close to the screen.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this is now implemented under 772fbaf.
I'll need to give it a bit more thorough testing, but from the data I see no reason why this shouldn't work. And brief tests with all four pens show that this works, it does allow me to just switch between the SP, M1, M2 and CN pens without any problems in regards to button detection.
Great idea to just detect this, I did add different magnitude detection for the v2 signals to the configuration, because they do have a very different amplitude from the v1 button signal, but that's still a lot better than having to set a boolean.