diff options
author | Maksym Sloyko <maxims@google.com> | 2021-08-06 21:50:45 +0000 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2021-08-07 21:35:04 -0700 |
commit | 3cf2475ea059184820525bb949c11c3da0e64af8 (patch) | |
tree | eb8832d9023ffaac25ec2e3f3f4f7b1ac8c9d20c /meta-oe | |
parent | ccd022736a000026595452663b45b9d27c99a30e (diff) | |
download | meta-openembedded-contrib-3cf2475ea059184820525bb949c11c3da0e64af8.tar.gz |
libusbgx: Configure the Devices Used
Add ability to configure the UDC used for specific schema.
The feature is backwards compatible, so existing users don't need to
change anything.
If one wants to specify which UDC is used for specific schema,
for example, `eth0`, they can add this variable to the configuration
file:
UDC_FOR_SCHEMA_eth0=f8000000.udc
If the device file exists in /sys/class/udc when the gadget is started,
it will be used for this schema.
If this configuration is not present, first available device is picked.
Signed-off-by: Maksym Sloyko <maxims@google.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe')
-rwxr-xr-x[-rw-r--r--] | meta-oe/recipes-support/libusbgx/libusbgx/gadget-start | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/meta-oe/recipes-support/libusbgx/libusbgx/gadget-start b/meta-oe/recipes-support/libusbgx/libusbgx/gadget-start index 1a106b7851..9e22671a9e 100644..100755 --- a/meta-oe/recipes-support/libusbgx/libusbgx/gadget-start +++ b/meta-oe/recipes-support/libusbgx/libusbgx/gadget-start @@ -7,5 +7,10 @@ for i in $IMPORT_SCHEMAS; do done for i in $ENABLED_SCHEMAS; do - ls /sys/class/udc/ > /sys/kernel/config/usb_gadget/"$i"/UDC + configured_udc=$(eval 'echo ${UDC_FOR_SCHEMA_'"$i"'}') + if [ -n "${configured_udc}" ] && [ -e "/sys/class/udc/${configured_udc}" ]; then + echo ${configured_udc} > /sys/kernel/config/usb_gadget/"$i"/UDC + else + ls /sys/class/udc/ > /sys/kernel/config/usb_gadget/"$i"/UDC + fi done |