Android and custom Usb HID devices

I finally got an usb OTG cable for my Galaxy Nexus (JB4.2.1) and wondered whether or not my custom usb HID devices could be controlled through an app… the answer is YES! And there is no need of rooting or special ROMs or packages since there is 100% native support.
The first try was using the hardware of the USB RGB Facebook notifier, which is based only on a attiny85 AVR mcu.
I just followed the guidelines from here and the only thing i struggled for was to get match the parameters of the function used to send control transfer messages with the one used in the C version, it turned out the argument list was:

USBconnection.controlTransfer(0x40, CUSTOM_REQUEST_ID, CUSTOM_REQUEST_VALUE, 0, null, 0, 0);

for instance:

USBconnection.controlTransfer(0x40, 4, 0, 0, null, 0, 0);

The value 0x40 stands for “outbound connection”.
Source code is coming…