src/core/linux/SDL_evdev_capabilities.h


Log

Author Commit Date CI Message
Simon McVittie aae53d59 2020-11-11T19:15:09 evdev: Detect whether input devices are accelerometers Anything with X, Y and Z axes but no buttons is probably an accelerometer (this is the assumption made in udev). Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie fdd945f2 2020-11-11T19:14:52 joystick: Use a better heuristic to guess what is a joystick Previously we only checked for at least one button or key and at least the X and Y absolute axes, but this has both false positives and false negatives. Graphics tablets, trackpads and touchscreens all have buttons and absolute X and Y axes, but we don't want to detect those as joysticks. On normal Linux systems ordinary users do not have access to these device nodes, but members of the 'input' group do. Conversely, some game controllers only have digital buttons and no analogue axes (the Nintendo Wiimote is an example), and some have axes and no buttons (steering wheels or flight simulator rudders might not have buttons). Use the more elaborate heuristic factored out from SDL's udev code path to handle these cases. In an ideal world we could use exactly the same heuristic as udev's input_id builtin, but that isn't under a suitable license for inclusion in SDL, so we have to use a parallel implementation of something vaguely similar. Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie 8db3171b 2020-11-11T19:14:34 udev: Factor out SDL_EVDEV_GuessDeviceClass This works on capability bitfields that can either come from udev or from ioctls, so it is equally applicable to both udev and non-udev input device detection. Signed-off-by: Simon McVittie <smcv@collabora.com>