Hit assert with unusual USB input hardware
Summary
I have some input hardware based on an esoteric IO card. (It's flight-simulator hardware). The device is accessed via /dev/hidraw from a user-mode app, with some appropriate UDev rules to permit non-root access.
When I open the hidraw device (or shortly after), my Xorg crashes - specifically I hit an assert in libinput:
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007f233fdf7801 in __GI_abort () at abort.c:79
#2 0x00007f233fde739a in __assert_fail_base (fmt=0x7f233ff6e7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f23398c9f4c "device->key_count[code] > 0", file=file@entry=0x7f23398c9f21 "../src/evdev.c", line=line@entry=122,
function=function@entry=0x7f23398cac40 "evdev_update_key_down_count") at assert.c:92
#3 0x00007f233fde7412 in __GI___assert_fail (assertion=0x7f23398c9f4c "device->key_count[code] > 0", file=0x7f23398c9f21 "../src/evdev.c", line=122, function=0x7f23398cac40 "evdev_update_key_down_count") at assert.c:101
#4 0x00007f23398ad745 in ?? () from /usr/lib/x86_64-linux-gnu/libinput.so.10
Steps to reproduce
Reproduction is impossible I guess without access to the TEKWorx hardware: http://www.tekworx.com/home.php
(I guess the issue is that HID descriptor for this hardware is completely inaccurate, causing libinput to get confused).
To be clear I'm not trying or wanting libinput to talk to this hardware at all, but opening the device (from another process) somehow causes the assertion in libinput. (Is there some monitoring of all open HID devices?)
libinput version you encountered the bug on
Current version on Ubuntu 18.04 Version: 1.10.4-1
Hardware information:
For what it's worth, the hardware is a FlightDeckSolutions Pro CDU, which internally is a TEKWorx InterfaceIT card. This device is USB-interfaced and exposes a HID interface, but the report descriptor is completely bogus, and the card actually uses a message-based protocol over the USB input and output reports.
I've dealt with all that in my user-space adapter application, I just need libinput to ignore the device (and not crash my Xorg...)
Other log output:
-
libinput record
output:
My libinput binary claims 'record' is not a known command, maybe I missed some config step?
-
libinput debug-events --verbose
output:
event1 - Power Button: is tagged by udev as: Keyboard
event1 - Power Button: device is a keyboard
event0 - Power Button: is tagged by udev as: Keyboard
event0 - Power Button: device is a keyboard
event20 - HDA NVidia HDMI/DP,pcm=3: is tagged by udev as: Switch
event21 - HDA NVidia HDMI/DP,pcm=7: is tagged by udev as: Switch
event22 - HDA NVidia HDMI/DP,pcm=8: is tagged by udev as: Switch
event23 - HDA NVidia HDMI/DP,pcm=9: is tagged by udev as: Switch
event2 - MOSART Semi. 2.4G Keyboard Mouse: is tagged by udev as: Keyboard
event2 - MOSART Semi. 2.4G Keyboard Mouse: device is a keyboard
event3 - MOSART Semi. 2.4G Keyboard Mouse: is tagged by udev as: Keyboard Mouse
event3 - MOSART Semi. 2.4G Keyboard Mouse: device is a pointer
event3 - MOSART Semi. 2.4G Keyboard Mouse: device is a keyboard
event7 - Leo Bodnar BU0836A Interface: is tagged by udev as: Joystick
event7 - Leo Bodnar BU0836A Interface: device is a joystick, ignoring
event7 - not using input device '/dev/input/event7'
event10 - Saitek Saitek Pro Flight Rudder Pedals: is tagged by udev as: Joystick
event10 - Saitek Saitek Pro Flight Rudder Pedals: device is a joystick, ignoring
event10 - not using input device '/dev/input/event10'
event11 - TEKWorx Limited interfaceIT Controller v2: is tagged by udev as: Mouse
event11 - TEKWorx Limited interfaceIT Controller v2: device is a pointer
event12 - TEKWorx Limited interfaceIT Controller v2: is tagged by udev as: Keyboard Mouse Joystick
event12 - TEKWorx Limited interfaceIT Controller v2: device is a pointer
event12 - TEKWorx Limited interfaceIT Controller v2: device is a keyboard
event13 - HDA Intel Rear Mic: is tagged by udev as: Switch
event14 - HDA Intel Front Mic: is tagged by udev as: Switch
event15 - HDA Intel Line: is tagged by udev as: Switch
event16 - HDA Intel Line Out Front: is tagged by udev as: Switch
event17 - HDA Intel Line Out Surround: is tagged by udev as: Switch
event18 - HDA Intel Line Out CLFE: is tagged by udev as: Switch
event19 - HDA Intel Line Out Side: is tagged by udev as: Switch
event4 - Thrustmaster T.16000M: is tagged by udev as: Joystick
event4 - Thrustmaster T.16000M: device is a joystick, ignoring
event4 - not using input device '/dev/input/event4'
event5 - Saitek Saitek Pro Flight Quadrant: is tagged by udev as: Joystick
event5 - Saitek Saitek Pro Flight Quadrant: device is a joystick, ignoring
event5 - not using input device '/dev/input/event5'
event6 - Saitek Saitek Pro Flight Quadrant: is tagged by udev as: Joystick
event6 - Saitek Saitek Pro Flight Quadrant: device is a joystick, ignoring
event6 - not using input device '/dev/input/event6'
event8 - Microchip Technology Inc. Multi Media Keyboard Demo: is tagged by udev as: Mouse
event8 - Microchip Technology Inc. Multi Media Keyboard Demo: device is a pointer
event9 - Microchip Technology Inc. Multi Media Keyboard Demo: is tagged by udev as: Keyboard
event9 - Microchip Technology Inc. Multi Media Keyboard Demo: device is a keyboard
-event1 DEVICE_ADDED Power Button seat0 default group1 cap:k
-event0 DEVICE_ADDED Power Button seat0 default group2 cap:k
-event20 DEVICE_ADDED HDA NVidia HDMI/DP,pcm=3 seat0 default group3 cap:
-event21 DEVICE_ADDED HDA NVidia HDMI/DP,pcm=7 seat0 default group3 cap:
-event22 DEVICE_ADDED HDA NVidia HDMI/DP,pcm=8 seat0 default group3 cap:
-event23 DEVICE_ADDED HDA NVidia HDMI/DP,pcm=9 seat0 default group3 cap:
-event2 DEVICE_ADDED MOSART Semi. 2.4G Keyboard Mouse seat0 default group4 cap:k
-event3 DEVICE_ADDED MOSART Semi. 2.4G Keyboard Mouse seat0 default group4 cap:kp left scroll-nat scroll-button
-event11 DEVICE_ADDED TEKWorx Limited interfaceIT Controller v2 seat0 default group5 cap:p left scroll-nat
-event12 DEVICE_ADDED TEKWorx Limited interfaceIT Controller v2 seat0 default group5 cap:kp left scroll-nat
-event13 DEVICE_ADDED HDA Intel Rear Mic seat0 default group3 cap:
-event14 DEVICE_ADDED HDA Intel Front Mic seat0 default group3 cap:
-event15 DEVICE_ADDED HDA Intel Line seat0 default group3 cap:
-event16 DEVICE_ADDED HDA Intel Line Out Front seat0 default group3 cap:
-event17 DEVICE_ADDED HDA Intel Line Out Surround seat0 default group3 cap:
-event18 DEVICE_ADDED HDA Intel Line Out CLFE seat0 default group3 cap:
-event19 DEVICE_ADDED HDA Intel Line Out Side seat0 default group3 cap:
-event8 DEVICE_ADDED Microchip Technology Inc. Multi Media Keyboard Demo seat0 default group6 cap:p left scroll-nat scroll-button
-event9 DEVICE_ADDED Microchip Technology Inc. Multi Media Keyboard Demo seat0 default group6 cap:k