No matter how many mice are connected, Wayland with the Xwayland compatibility layer always reports these three pointing devices:
$ ./detect_mice
ManyMouse driver: X11 XInput2 extension
#0: xwayland-pointer:1
#1: xwayland-relative-pointer:1
#2: xwayland-pointer-gestures:1
Disabling the XInput2 code branch falls back to evdev and works if device permissions are good:
$ ./detect_mice
ManyMouse driver: Linux /dev/input/event* interface
#0: wireless wireless 2.4G Mouse
#1: USB Optical Mouse
#2: bcm5974
Would it be worth detecting Wayland or Xwayland, and not triggering the XInput2 branch in that case?
(Removing Xwayland also triggers the evdev branch, but breaks many other programs.)