I'm starting to dig into the evdev api on linux for the purpose of playing around with uinput emulation. I noticed that between a joystick and a touch pad, there are different button/key event codes to distinguish between joypad button presses and mouse clicks. But both devices have event codes for ABS_X and ABS_Y axis.
joystick dump:
# Event type 3 (EV_ABS)
# Event code 0 (ABS_X)
# Value 128
# Min 0
# Max 255
# Fuzz 0
# Flat 15
# Resolution 0
# Event code 1 (ABS_Y)
# Value 103
# Min 0
# Max 255
# Fuzz 0
# Flat 15
# Resolution 0
touchpad dump:
# Event type 3 (EV_ABS)
# Event code 0 (ABS_X)
# Value 3909
# Min 1270
# Max 5670
# Fuzz 0
# Flat 0
# Resolution 44
# Event code 1 (ABS_Y)
# Value 3835
# Min 1240
# Max 4746
# Fuzz 0
# Flat 0
# Resolution 66
So how does x11 know whether to treat the '/dev/input/eventX' node as a joystick or a mouse for the purpose of moving the on screen cursor? Is there some ioctl I can use to set whether or not the device gets loaded by x11? Something else that the driver needs to do to indicate this?
I looked around at some bug reports and found that there have been cases in old releases where the joypad did move the mouse when connected but I could not find any patches that would indicate what they changed to indicate that distinction to x11.
Before someone says it, I know that using libevdev if preferred over direct calls to uinput in practice, but this is for educational purposes only. And even there, I have the same question.