They have some examples that emulate an USB keyboard and mouse, and the app shows how to configure the Gadget API to turn the phone into whatever USB device you want.
The repo is unfortunately inactive, but the underlying feature is exposed through a stable Linux kernel API (via ConfigFS), so everything will continue working as long as Android leaves the feature enabled.
You do need to be root, however, since you will essentially be writing a USB device. Then all you have to do is open `/dev/hidg0`, and when you read from this file you will be reading USB HID packets. Write your response and it is sent on the cable.
I always wondered if we could convert an old andoid phone or tablet into a USB/wireless graphics-tablet for drawing input -- or as a live annotator for screen presentations where I can mirror the PC slideshow on the tablet and use the tablet to make annotations during a lecture say.
If there are any such projects already -- I would e very keen to take a look.
I have a bunch of older android phones that could be repurposed for some tinkering.
The touchscreen display and input would open a lot more interactive possibilities.
Is there a community or gallery of ideas and projects that leverage this?