Andrei Konovalov from Google is developing a new module , to emulate USB devices in user space. It's currently under review for including this module in the mainline of the Linux kernel. USB Raw Gadget is already in Google to simplify fuzz testing of the USB stack in the kernel using tools .
The module adds a new programming interface to the kernel's and is being developed as an alternative to GadgetFS. The creation of the new API is driven by the need for low-level and direct access to the USB Gadget subsystem from user space, allowing all possible USB requests to be processed (GadgetFS handles some requests on its own, without passing to user space). The USB Raw Gadget is controlled via the device /dev/raw-gadget, similar to /dev/gadget in GadgetFS, but it uses an ioctl()-based interface rather than a pseudo-FS.
In addition to directly handling all USB requests by a user-space process, the new interface also has the capability to return any data in response to a USB request (GadgetFS performs a validity check of USB descriptors and filters certain responses, which hinders error detection during fuzz testing of the USB stack). Raw Gadget also allows the selection of a specific UDC (USB Device Controller) and driver for attachment, whereas GadgetFS attaches to the first available UDC. Predictable names are assigned for different UDCs to differentiate between different types of data channels within a single device.
Allikas: opennet.ru
