meta data for this page
libusbx
Yocto's libusbgx provide start/stop scripts to create gadgets from schema upon system start:
usbgx.service
- /usr/bin/gadget-start
- /usr/bin/gadget-stop
gadget-start sh script:
- sources config from
/etc/default/usbgx - iterates
IMPORT_SCHEMASand imports schemas (from path/etc/usbgx/${name}.schema) - executes scripts from
/etc/usbgx.ddirectory - iterates
ENABLED_SCHEMASand bind UDC to gadgets:- if
UDC_FOR_SCHEMA_${schema}is defined, then this value is used for UDC bing - if not, first UDC listed by
ls /sys/class/udc/is used
examples
- gadget-acm-ecm - creates ACM+ECM
- gadget-ffs - This is an example of how to create gadget with FunctionFS based functions in two ways. After executing this program gadget will not be enabled
because ffs instances should be mounted and both descriptors and strings should be written to ep0. For more details about FunctionFS please refer to FunctionFS documentation in linux kernel repository.
- gadget-hid -
- gadget-midi -
- gadget-ms - This is an example of how to create gadget with mass storage function with two luns.
- gadget-printer
- gadget-rndis-os-desc - This is an example of how to create an gadget with OS String support.
- gadget-uac2
- gadget-uvc
- gadget-export - This is an example of how to export a gadget to file. Common reason of doing this is to share schema of gadget between different devices or preserve gadget between reboots.
Usage: gadget-export gadget_name file_name
- gadget-import - This is an example of how to import a gadget from file. Common reason of doing this is to create gadget base on schema from other devices or resurect gadget after reboot.
“Usage: gadget-import gadget_name file_name
- gadget-vid-pid-remove - This is an example of how to find and remove an gadget device with given Vendor ID and product ID.
Usage: gadget-vid-pid-remove vid:pid
- show-gadgets -This example shows how to display all configured USB gadgets in the system
- show-udcs - This is an example of how to learn about UDCs available in system and find out what gadget are enabled on them.