From: "Maxim Sloyko" <maxims@google.com>
To: openembedded-core@lists.openembedded.org
Cc: Maksym Sloyko <maxims@google.com>
Subject: [meta-oe][PATCH] meta-oe: libusbgx: Configure the Devices Used
Date: Fri, 6 Aug 2021 18:14:02 +0000 [thread overview]
Message-ID: <20210806181402.3014345-1-maxims@google.com> (raw)
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>
---
meta-oe/recipes-support/libusbgx/libusbgx/gadget-start | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
mode change 100644 => 100755 meta-oe/recipes-support/libusbgx/libusbgx/gadget-start
diff --git a/meta-oe/recipes-support/libusbgx/libusbgx/gadget-start b/meta-oe/recipes-support/libusbgx/libusbgx/gadget-start
old mode 100644
new mode 100755
index 1a106b785..9e22671a9
--- 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
--
2.32.0.605.g8dce9f2422-goog
next reply other threads:[~2021-08-06 18:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 18:14 Maxim Sloyko [this message]
2021-08-17 23:43 ` [OE-core] [meta-oe][PATCH] meta-oe: libusbgx: Configure the Devices Used Khem Raj
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210806181402.3014345-1-maxims@google.com \
--to=maxims@google.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox