2015-11-28

Shuttle Crash: X11 & Qt 5.4

I've recently upgraded my Kubuntu installation to 15.10 ... just to find out that pressing any button of the ShuttlePro crashes Kdenlive. After some digging I found out that Qt 5.4 in combination with X11 are the culprits here. The ShuttlePro gets integrated as a pointing device by X11, then Qt dumps core trying to dispatching Shuttle events happily into the great void...

This may actually be more in X11's ballpark than Qt's, but this is difficult to tell. Maybe there's even the particular application involved ... but I simply don't care. I expect the whole enchilada to work ... too much expectation, eh?

Too Much Input...


Luckily, there's a simple remedy available. Because with Qt 5.4 (this is what ships with Kubuntu 15.14) it is not possible to selectively disable any unwanted input devices, we need to disable the ShuttlePro v2 device in X11 itself. This is acceptable, since Kdenlive will handle the ShuttlePro fine on its own. Also, as other X11 application most probably won't make any use of the ShuttlePro either, it's better to forbid X11 messing around with this particular USB HID input device.

As Qt 5.5 will finally handle all input devices completely by itself, the whole thing will probably pop up again. Have fun with X11 and Qt then dispatching input events twice. Sigh.

Please note that you still need to make sure that you've added yourself to the group input in order to use the ShuttlePro at all. Otherwise, all applications you start won't be able to access the ShuttlePro directly.

The Cure


So, as root create a new configuration file /usr/share/X11/xorg.conf.d/50-shuttlepro.conf dealing especially with the ShuttlePro input device:
Section "InputClass"
  Identifier "Ignore Contour Design ShuttlePRO v2"
  MatchDevicePath "/dev/input/event*
  Driver "evdev"
  MatchProduct "ShuttlePRO v2"
  Option "Ignore" "true"
EndSection
Make sure you saved this configuration file correctly.

Next, end your current X11 session by logging out, then log in again. This time, X11 should not use the ShuttlePro device anymore. But Kdenlive should still be able to see and use your ShuttlePro.

You can check that X11 doesn't use your ShuttlePro anymore using the xev diagnosis tool. When started, it should not report any events while you press the buttons or shuttle around using the ShuttlePro. In contrast, evtest should still report your ShuttlePro as being present and available. If that's the case, you're set.

This additional X11 configuration file overwrites the existing base rules from 10-evdev.conf which would otherwise integrate the ShuttlePro as a mouse input device into X11. Please note that X11 config files with a higher number will be read in later, thus overriding any configuration rules loaded earlier. This config file specifies which devices to match and then finally tell X11 to ignore any matching input devices.

Post Scriptum


Notably, the Qt forums were of no help. While people tried to help quickly, they had no expertise in the event/input device topic. They gave a lot of misleading advice, such as trying to replace the Qt libraries or filing Qt bug reports. Reminds me of those first level support experts asking you to first reboot, then reset everything, then disappear into a puff of smoke because they have no clue. Never mind.