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

tools: de-duplicate and regroup identical hwdb entries #695

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

whot
Copy link
Member

@whot whot commented May 15, 2024

This sit on top of #694, only the last commit matters.

This should have no functional effect but it reduces the hwdb file from
~10k lines to under 700 non-comment lines.

Entries with identical properties are now grouped together into one
list of fallthrough-match strings with the property assignments once the
VID changes.

Entries with identical match strings (Huion, Gaomon, etc.) are grouped
together into one list of tablet name comments followed by the match
string.

Entries are now visually separated by VID too to make it easier to spot
the grouping, and the entries are now in this form:

  libwacom:name:*:input:b0003v056Ap5222*                       # ISDv4 5222
  libwacom:name:*:input:b0003v056Ap5229*                       # ISDv4 5229
  libwacom:name:*:input:b0003v056Ap522A*                       # ISDv4 5229
   ID_INPUT=1
   ID_INPUT_TABLET=1
   ID_INPUT_JOYSTICK=0

Or for where multiple tablets share the same hwdb match:

  #                                                             TM156W
  #                                                             U16 TP(4K)
  #                                                             U16(4K)
  #                                                             WH850
  libwacom:name:*:input:b0003v256Cp0064*                       # WH851
  libwacom:name:*:input:b0003v256Cp0066*                       # Inspiroy 2 S
  libwacom:name:*:input:b0003v256Cp0067*                       # Inspiroy 2 M - H951P
  libwacom:name:*:input:b0003v256Cp0068*                       # Inspiroy 2 L - H1061P

whot added 4 commits May 15, 2024 09:02
Previously we ran system-hwdb update but didn't actually install the
hwdb file. This only worked on my machine thanks to an existing symlink
but didn't actually work anywhere else.

Only install the hwdb file, we shouldn't need to install the udev rule
since it hardly ever changes.
Previously we'd create a uinput device for each of our tablets, then
query udev if the property is set. This takes a long time, in parts
thanks to the 300ms sleep to wait for the uinput device to be ready.

With now over 500 tablet files and most of those having multiple matches
we're looking at at minimum 500*0.3 seconds for a test run which isn't
really useful for a test like this.

Instead - let's query systemd-hwdb directly: construct a query string
our udev rule and query systemd-hwdb for the properties, then ensure we
have the ones we expect.

Closes linuxwacom#675
This should have no functional effect but it reduces the hwdb file from
~10k lines to under 700 non-comment lines.

Entries with identical properties are now grouped together into one
list of fallthrough-match strings with the property assignments once the
VID changes.

Entries with identical match strings (Huion, Gaomon, etc.) are grouped
together into one list of tablet name comments followed by the match
string.

Entries are now visually separated by VID too to make it easier to spot
the grouping, and the entries are now in this form:

  libwacom:name:*:input:b0003v056Ap5222*                       # ISDv4 5222
  libwacom:name:*:input:b0003v056Ap5229*                       # ISDv4 5229
  libwacom:name:*:input:b0003v056Ap522A*                       # ISDv4 5229
   ID_INPUT=1
   ID_INPUT_TABLET=1
   ID_INPUT_JOYSTICK=0

Or for where multiple tablets share the same hwdb match:

  #                                                             TM156W
  #                                                             U16 TP(4K)
  #                                                             U16(4K)
  #                                                             WH850
  libwacom:name:*:input:b0003v256Cp0064*                       # WH851
  libwacom:name:*:input:b0003v256Cp0066*                       # Inspiroy 2 S
  libwacom:name:*:input:b0003v256Cp0067*                       # Inspiroy 2 M - H951P
  libwacom:name:*:input:b0003v256Cp0068*                       # Inspiroy 2 L - H1061P
@whot whot marked this pull request as draft June 6, 2024 01:53
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.

None yet

1 participant