r/embeddedlinux • u/narcis_peter • Jun 02 '26
seeking help and/or advice USB Gadget drivers
I have recently started looking at USB peripheral bring-up (DWC2). Host mode is done, now the device (gadget, or peripheral) mode.
I have found several ways of initializing the Gadgets on embedded linux:
- Legacy kernel drivers, as loadable modules (
modprobe g_serial) - libusbgx repo for creating gadgets
- using custom scripts and
CONFIGFS_FSto initialize the gadgets
As I am rather new in a field of the Embedded linux world and wanted to ask:
- Is there a preferred way in the industry for initializing gadgets? If yes, using which method?
- How would users usually initialize their gadgets from the user space?
Thank you.
5
Upvotes
1
u/Numerous_Bathroom_91 Jun 02 '26
I have used both the raw
configfsinterface from scripts andlibusbgx(which usesconfigfsunder the hood) and personally prefer the former, mainly because a configuration can be modified on-the-fly (editing the script itself) and is more flexible (I had for example a case in which the USB serial number was set starting from a parameter read from EEPROM - i.e., a nvmem device).