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

Generate the class given in class if not explicitly given #792

Closed
wants to merge 1 commit into from

Conversation

redstrate
Copy link
Contributor

@redstrate redstrate commented Oct 16, 2024

This is still a part of the API, and thus have required even new .tablet files to fill this out even though it's superseded by IntegratedIn. So let's generate them programmatically.

This turns devices that are IntegratedIn=Display to the Cintiq class, IntegratedIn=Display;System into the ISDV4 class, and everything else into the Bamboo class.

(This definitely needs more test cases)

@redstrate redstrate changed the title Generate the class given in class if not explicitly given (libwacom#790) Generate the class given in class if not explicitly given (linuxwacom#790) Oct 16, 2024
@redstrate redstrate changed the title Generate the class given in class if not explicitly given (linuxwacom#790) Generate the class given in class if not explicitly given (#790) Oct 16, 2024
@redstrate redstrate changed the title Generate the class given in class if not explicitly given (#790) Generate the class given in class if not explicitly given Oct 16, 2024
This is still a part of the API, and thus have required even new .tablet
files to fill this out even though it's superseded by IntegratedIn. So
let's generate them programmatically.

This turns devices that are IntegratedIn=Display to the Cintiq class,
IntegratedIn=Display;System into the ISDV4 class, and everything else
into the Bamboo class.
Copy link
Member

@whot whot left a comment

Choose a reason for hiding this comment

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

One minor style nitpick but this LGTM.

For the test cases - remove it from the .tablet files for the few other devices we hand-check in test-load and I think we'll be good there?

Comment on lines +1368 to +1374
if (device->integration_flags & WACOM_DEVICE_INTEGRATED_DISPLAY &&
device->integration_flags & WACOM_DEVICE_INTEGRATED_SYSTEM) {
return WCLASS_ISDV4;
}
if (device->integration_flags & WACOM_DEVICE_INTEGRATED_DISPLAY) {
return WCLASS_CINTIQ;
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (device->integration_flags & WACOM_DEVICE_INTEGRATED_DISPLAY &&
device->integration_flags & WACOM_DEVICE_INTEGRATED_SYSTEM) {
return WCLASS_ISDV4;
}
if (device->integration_flags & WACOM_DEVICE_INTEGRATED_DISPLAY) {
return WCLASS_CINTIQ;
}
unsigned int flags = device->integration_flags & (WACOM_DEVICE_INTEGRATED_DISPLAY|WACOM_DEVICE_INTEGRATED_SYSTEM);
if (flags == (WACOM_DEVICE_INTEGRATED_DISPLAY|WACOM_DEVICE_INTEGRATED_SYSTEM)) {
return WCLASS_ISDV4;
}
if (flags == WACOM_DEVICE_INTEGRATED_DISPLAY) {
return WCLASS_CINTIQ;
}

is i think a bit more readable.

(oh, and I always like to have () around any bitwise operations, it makes the code a bit more readable)

if (device->integration_flags & WACOM_DEVICE_INTEGRATED_DISPLAY) {
return WCLASS_CINTIQ;
}
return WCLASS_BAMBOO;
Copy link
Member

Choose a reason for hiding this comment

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

I think the Remote class is missing here, that will need handling, could go together with #779.

Then again there's so few of them that we can mark those in the .tablet file...

Copy link
Member

Choose a reason for hiding this comment

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

Oh, come to think of it: this is better as WCLASS_INTUOS5 - that's the most recent class and most devices are more like that than whatever the latest bamboo was like.

Copy link
Member

Choose a reason for hiding this comment

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

For the archives: WCLASS_BAMBOO is better here because bamboos arent' expected to have stylus ids/serials.

@whot
Copy link
Member

whot commented Oct 28, 2024

@redstrate ok if I take this one and push it over the line?

@redstrate
Copy link
Contributor Author

redstrate commented Oct 28, 2024 via email

@whot
Copy link
Member

whot commented Oct 29, 2024

Thanks, closing in favour of #814 now

@whot whot closed this Oct 29, 2024
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