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

Add libwacom_new_from_builder() #676

Merged
merged 1 commit into from
May 8, 2024
Merged

Conversation

whot
Copy link
Member

@whot whot commented May 3, 2024

This adds a new (and hopefully final) libwacom_new_from... call. This one takes a match WacomBuilder object which can now be constructed and filled by the user. In the future if we need to add further fields we can extend the WacomBuilder with a setter and have this function still work for us.

Notably, see #676 (comment) the builder differentiates between the device name and the match name since those two may not be the same. The behaviour of the builder approach matches the existing approaches we have so the various libwacom_new_from_ functions can be emulated with the new builder approach.

Prime motivation here is to be able to test better, I don't think any of our callers will switch since they all use new_from_path. In particular for the correct loading behaviour in #659.

Closes #670

@whot
Copy link
Member Author

whot commented May 3, 2024

One difficulty I just realised: wacom_match_get_name() returns the name string from the match but in this version I'm using wacom_match_set_name() as if it was the WacomDevice->name. That works for some tablets but won't work for all the Huion and derivatives which have different kernel names than we set in the .tablet files.

Might need to introduce a new struct other than WacomMatch that can take a device_name and a match_name.

@whot whot force-pushed the wip/new_from_match branch from 1abef5c to 7ad6a3c Compare May 7, 2024 03:32
@whot whot marked this pull request as ready for review May 7, 2024 03:42
@whot whot changed the title Add libwacom_new_from_match() Add libwacom_new_from_builder() May 7, 2024
@whot whot force-pushed the wip/new_from_match branch 2 times, most recently from 6d92529 to 00e23a5 Compare May 8, 2024 07:54
This is a finer-grained solution than the current libwacom_new_from,
particularly for testing.

The existing functions are emulated in the behavior depending whether
values are set or not.
@whot whot force-pushed the wip/new_from_match branch from 00e23a5 to fe14169 Compare May 8, 2024 07:57
@whot
Copy link
Member Author

whot commented May 8, 2024

Going to merge this, I think it's a useful (and extensible) API and it makes testing a lot easier.

@whot whot merged commit 61907bb into linuxwacom:master May 8, 2024
14 checks passed
whot added a commit to whot/libwacom that referenced this pull request May 13, 2024
Fixes: 61907bb ("Add libwacom_new_from_builder to construct a new device (linuxwacom#676)")
whot added a commit that referenced this pull request May 13, 2024
Fixes: 61907bb ("Add libwacom_new_from_builder to construct a new device (#676)")
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.

Debugging functions needed for creating tablets from matches
1 participant