This directory contains two examples of using Raw Gadget:
-
keyboard.c
emulates a USB keyboard that keeps sending keypresses of the letterx
. This example also handles the USB device being reset by the host; -
printer.c
emulates the enumeration stage of a USB printer.
When run without arguments, the examples rely on the Dummy HCD/UDC module to emulate virtual devices that connect to the kernel they are running on.
If you want to use them with a physical host instead, you need to provide the UDC device and driver names as arguments (e.g. both are 20980000.usb
for Raspberry Pi Zero).
Also see tests/gadget.c for an example of a device that is used with the Raw Gadget testing suite.
Build:
make
Run:
sudo ./keyboard
Or:
sudo ./keyboard 20980000.usb 20980000.usb
Run:
sudo ./printer
Or:
sudo ./printer 20980000.usb 20980000.usb