looks_like_stick(
dev) ->stick
Check whether a device is a stick or a gamepad
dev needs axes and buttons, each keyed by code, as an open device
has them. Any true value marks a code, so plain tables serve.
True when the device reports ABS_X, ABS_Y and one key udev counts as a
joystick button:
BTN_JOYSTICK up to BTN_DIGI: the joystick and
gamepad names;BTN_DPAD_UP to BTN_DPAD_RIGHT;BTN_TRIGGER_HAPPY1 to BTN_TRIGGER_HAPPY40: the
spares a stick with more than sixteen buttons falls back on.A touchscreen and a touchpad report X and Y too, but their keys sit in the
digitizer block, 0x140 to 0x14f, so neither passes. A mouse with more than
sixteen buttons runs into the joystick range. It reports 0x11f, the code
below BTN_JOYSTICK, and a device with that code is never a stick.