linuxwacom / xf86-input-wacom

X.Org driver for Wacom devices
356 stars 46 forks source link

Don't report fifth valuator unless it exists on tool (v2) #270

Closed whot closed 2 years ago

whot commented 2 years ago

Supersedes #261

@skomra's patch is identical to #261, only the patch to add the test is different.

Arguably the test should be a separate one but that would require copy/paste of 90% of the test code which is more likely to become an issue than a single condition in the current test that differs based on stylus type, so let's go with that.

skomra commented 2 years ago

HI Peter, I'm trying to test this but I'm getting the following error, even though I rebuilt the driver and reconfigured meson.

test/test_wacom.py::test_axis_updates[PenId.ARTPEN-x] PASSED
test/test_wacom.py::test_axis_updates[PenId.ARTPEN-y] PASSED
test/test_wacom.py::test_axis_updates[PenId.ARTPEN-pressure] PASSED
test/test_wacom.py::test_axis_updates[PenId.ARTPEN-tilt_x] PASSED
test/test_wacom.py::test_axis_updates[PenId.ARTPEN-tilt_y] PASSED
test/test_wacom.py::test_axis_updates[PenId.ARTPEN-wheel] PASSED
test/test_wacom.py::test_axis_updates[PenId.CINTIQ_13_PEN-x] FAILED
test/test_wacom.py::test_axis_updates[PenId.CINTIQ_13_PEN-y] FAILED
test/test_wacom.py::test_axis_updates[PenId.CINTIQ_13_PEN-pressure] FAILED
test/test_wacom.py::test_axis_updates[PenId.CINTIQ_13_PEN-tilt_x] FAILED
test/test_wacom.py::test_axis_updates[PenId.CINTIQ_13_PEN-tilt_y] FAILED
test/test_wacom.py::test_axis_updates[PenId.CINTIQ_13_PEN-wheel] FAILED

...

E               AssertionError: for axis wheel
E               assert True == False

test/test_wacom.py:239: AssertionError

Also maybe we should make sure Ping's recent kernel patch isn't inadvertently fixing the problem on your system. My kernel is

5.13.0-41-generic #46~20.04.1-Ubuntu SMP Wed Apr 20 13:16:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

I'm using the stock kernel driver and I don't have Ping's recent kernel patch installed.

To make sure there isn't something wrong with my system I'm trying to do a clean install on a new system. However I'm getting an error in test on the clean system when I run the tests:

ImportError while loading conftest '/home/aas/xf86-input-wacom/test/conftest.py'.
  File "/home/aas/xf86-input-wacom/test/__init__.py", line 52
    product: int = attr.ib()

Can you think of what I might be missing to get this error on the fresh system? I thought it might be attrs but I have that installed.

whot commented 2 years ago

Also maybe we should make sure Ping's recent kernel patch isn't inadvertently fixing the problem on your system

we're using uinput here, so the kernel patches don't matter. the evdev device is set up with our specific axes and ranges and we send the events through uinput - no kernel patch is involved here. that's what makes uinput-based testing so nice, you can use the kernel infrastructure (i.e. udev, etc.) but you decouple completely from the actual kernel driver.

Can you think of what I might be missing to get this error on the fresh system? I thought it might be attrs but I have that installed.

that error is confusing... if it was attr you'd think the error would happen at import attr, not when it's actually used. maybe attr.ib() local-imports something else? You can try this:

$ ./test/wacom-test-env.sh
$ python3
>>> import test
>>> from test import InputId
>>>

That would import the test module and then for good measure the class that triggers that error too. If that throws an import error it may at least have more information.

Oh, and - if you pip install something as user but then run the tests as root it won't find the package. Maybe that's it?

As for the test case failure.... no idea why this could happen, this isn't host-specific so the result should be the same regardless of distribution/kernel/userspace. pytest --verbose --log-level=DEBUG may have some info on what the driver actually does.

skomra commented 2 years ago

Hi Peter, you were right I need to 'pip install' as root. I was able to see the tests pass on my the clean system. I wasn't able to figure out what was wrong with the setup on the original system. Thanks for you help with this.

Reviewed-by: Aaron Skomra aaron.skomra@wacom.com