Comment 41 for bug 799202

Revision history for this message
Chase Douglas (chasedouglas) wrote :

Some background information on XInput: XInput 1.x added "valuators" which are axes that provide data beyond just X and Y. Unfortunately, in the infinite wisdom of the XInput 1.x creators, the valuators were not labeled. Thus, the Qt code has #defines like WAC_XTILT_I. Essentially, in XI 1.x the order of valuators is part of the ABI. However, I think only the Wacom X module has provided a stable valuator ordering, so it's all just a big mess.

This means that the code only works if you are using the X Wacom input module. I'm assuming you all are, but it would be good to double check (check /var/log/Xorg.0.log).

Another quirk in XI 1.x is that it provides valuator ranges instead of a bitmask of changed valuators. So, if the values in axes 3 and 5 changed, XI 1.x must send data for the current values of axes 3, 4, and 5. In XI 2.x, the server sends only the new values of 3 and 5. It is possible that there is an issue in how masked valuators in the internals of the X server are being handled, but I have not seen any indication this is the case. xinput test and xinput test-xi2 are great for testing this. You can run the same recording through both and see if there are any discrepencies. Note that natty and Oneiric are the first X servers that actually use masked valuators internally in the server. Clients who aren't fully compliant to the XI specs will only start to see issues now :).

I just got to this paragraph to summarize things, and then I realized what may be the issue. Notice how the xTilt and yTilt variables are set based on a constant index into the event valuators. This works fine if the event valuator range always begins at 0. However, if only the 3rd and 4th valuators changed, the valuator range from the server would be 3 to 4, and the indexes of valid data would be 0 and 1 (shifted down by 2). See /usr/include/X11/extensions/XInput.h, XDevice*Event.first_axis and XDevice*Event.axes_count for the valuator range of an event.

This would also explain why the issue is seen sporadically with pressure data but not with tilt. When pressure changes, X and Y is likely to also change. This causes the valuator range to start at 0, so the axis indices used in Qt are ok. However, when tilt changes, maybe it usually is the only valuator that changes value. Thus, the valuator range starts at whatever the tilt valuator is, and the indices used by Qt are wrong.