Androhid is a project mainly written in JAVA and C, it's free.
Extending the androhid project to be a versatile gamepad device.
I'm trying to extend the Androhid project to be a versatile gamepad controller (i.e. for an HTPC setup)