-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
USB gadgets can be implemented as userspace daemons running on top of FunctionFS. Systemd has socket-activation of such daemons built in. The very first thing that must be done by systemd is writing USB descriptors and strings to the ep0 file. The said descriptors and strings are referenced by USBFunctionDescriptors and USBFunctionStrings of the service unit associated with the socket unit in question. Both the descriptors and strings must be in binary form.
It is difficult to create the needed binary blobs on the one hand, and to inspect what is inside such blobs on the other. The latter can only be done manually with a hex viewer and USB standard.
There is a gt tool: https://github.com/kopasiak/gt and an outstanding pull request: linux-usb-gadgets/gt#8. The PR adds support to gt for creating the binary blobs with command line invocations of gt or based on a declarative config file.
The question to systemd maintainers is whether you would like similar functionality in systemd itself, so that systemd can build those binary blobs on its own based on a textual description? The standalone gt tool mentioned above seems a better place for such functionality, because it could also do the reverse: given a blob produce a textual description - the latter does not seem the right fit for systemd and seems better handled by a standalone tool. But anyway, what is your opinion?