All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCH] meta-oe: libusbgx: Configure the Devices Used
@ 2021-08-06 21:50 Maxim Sloyko
  2021-08-08  4:36 ` [oe] " Khem Raj
  0 siblings, 1 reply; 4+ messages in thread
From: Maxim Sloyko @ 2021-08-06 21:50 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Maksym Sloyko

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [oe] [meta-oe][PATCH] meta-oe: libusbgx: Configure the Devices Used
  2021-08-06 21:50 [meta-oe][PATCH] meta-oe: libusbgx: Configure the Devices Used Maxim Sloyko
@ 2021-08-08  4:36 ` Khem Raj
  2021-08-09 16:35   ` Maxim Sloyko
  0 siblings, 1 reply; 4+ messages in thread
From: Khem Raj @ 2021-08-08  4:36 UTC (permalink / raw)
  To: Maxim Sloyko; +Cc: openembeded-devel

On Fri, Aug 6, 2021 at 2:50 PM Maxim Sloyko via lists.openembedded.org
<maxims=google.com@lists.openembedded.org> wrote:
>
> 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.
>

Thanks for your contribution Maxim, it looks fine, although I had to
edit the commit subject line to remove meta-oe from it
commit msg guidelines are here for OE
https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines


> 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
>
>
> 
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [oe] [meta-oe][PATCH] meta-oe: libusbgx: Configure the Devices Used
  2021-08-08  4:36 ` [oe] " Khem Raj
@ 2021-08-09 16:35   ` Maxim Sloyko
  0 siblings, 0 replies; 4+ messages in thread
From: Maxim Sloyko @ 2021-08-09 16:35 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembeded-devel

On Sat, Aug 7, 2021 at 9:37 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> On Fri, Aug 6, 2021 at 2:50 PM Maxim Sloyko via lists.openembedded.org
> <maxims=google.com@lists.openembedded.org> wrote:
> >
> > 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.
> >
>
> Thanks for your contribution Maxim, it looks fine, although I had to
> edit the commit subject line to remove meta-oe from it
> commit msg guidelines are here for OE
> https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines

Noted, thank you.

>
>
> > 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
> >
> >
> > 
> >



-- 
-MS

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [meta-oe][PATCH] meta-oe: libusbgx: Configure the Devices Used
@ 2021-08-06 18:14 Maxim Sloyko
  0 siblings, 0 replies; 4+ messages in thread
From: Maxim Sloyko @ 2021-08-06 18:14 UTC (permalink / raw)
  To: openembedded-core; +Cc: Maksym Sloyko

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-09 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 21:50 [meta-oe][PATCH] meta-oe: libusbgx: Configure the Devices Used Maxim Sloyko
2021-08-08  4:36 ` [oe] " Khem Raj
2021-08-09 16:35   ` Maxim Sloyko
  -- strict thread matches above, loose matches on Subject: below --
2021-08-06 18:14 Maxim Sloyko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.