@Justmat et al
also be aware of norns/lua/core/hid_event_types.lua. this defines a bunch of constants that correspond to the type and event codes.
IIRC they are named after the equivalent constants in libevdev headers. so this is slightly more readable than the raw numbers.
in there you can see:
- event type 1 is
EV_REL, “relative axes”
- in the event codes section under “relative axes”, code 0 is
REL_X and code 1 is REL_Y
in other words, the magic trackpad behaves just other computer mouses.
and the code can be made a little more readable (imho) by testing for the named constants
local hev = require 'hid_events'
...
if type = hev.types.EV_REL ...
if code = hev.codes.REL_X ...
if people want to make nicer middleware libraries for this stuff that would probably be cool.