Input-Mangler is a project mainly written in JAVASCRIPT and C, it's free.
Linux tool for modification of input device behavior.
See docs/index.html