diff mbox series

[meta-oe] android-tools-conf-configfs: make USB gadget IDs configurable

Message ID 20260318050333.510028-1-viswanath.kraleti@oss.qualcomm.com
State Accepted
Headers show
Series [meta-oe] android-tools-conf-configfs: make USB gadget IDs configurable | expand

Commit Message

Viswanath Kraleti March 18, 2026, 5:03 a.m. UTC
The android-gadget-setup script currently hardcodes the USB vendor ID,
product ID, and configuration string. This makes it difficult for BSP
layers to customize USB gadget identity with platform specific values.

Introduce variables for the vendor ID, product ID, and configuration
string when populating the configfs attributes. This allows machine
or distro specific overrides via `/etc/android-gadget-setup.machine`,
while preserving the existing default values.

Signed-off-by: Viswanath Kraleti <viswanath.kraleti@oss.qualcomm.com>
---
 .../android-tools-conf-configfs/android-gadget-setup     | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Anuj Mittal March 18, 2026, 5:27 a.m. UTC | #1
I think we should at the same time also delete the same
android-tools-conf recipe present in
./meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools.
Otherwise, the behavior would be different depending on whether
meta-selinux is included or not.

On Wed, Mar 18, 2026 at 1:03 PM Viswanath Kraleti via
lists.openembedded.org
<viswanath.kraleti=oss.qualcomm.com@lists.openembedded.org> wrote:
>
> The android-gadget-setup script currently hardcodes the USB vendor ID,
> product ID, and configuration string. This makes it difficult for BSP
> layers to customize USB gadget identity with platform specific values.
>
> Introduce variables for the vendor ID, product ID, and configuration
> string when populating the configfs attributes. This allows machine
> or distro specific overrides via `/etc/android-gadget-setup.machine`,
> while preserving the existing default values.
>
> Signed-off-by: Viswanath Kraleti <viswanath.kraleti@oss.qualcomm.com>
> ---
>  .../android-tools-conf-configfs/android-gadget-setup     | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup b/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup
> index dbd7115151..47e4edb9be 100644
> --- a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup
> +++ b/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup
> @@ -2,9 +2,12 @@
>
>  set -e
>
> +conf="Conf 1"
>  manufacturer=RPB
>  model="Android device"
> +product=0xd002
>  serial=0123456789ABCDEF
> +vendor=0x18d1
>
>  if [ -r /etc/android-gadget-setup.machine ] ; then
>         . /etc/android-gadget-setup.machine
> @@ -23,12 +26,12 @@ mkdir configs/c.1
>  mkdir functions/ffs.usb0
>  mkdir strings/0x409
>  mkdir configs/c.1/strings/0x409
> -echo -n 0x18d1 > idVendor
> -echo -n 0xd002 > idProduct
> +echo -n "$vendor"  > idVendor
> +echo -n "$product" > idProduct
>  echo "$serial" > strings/0x409/serialnumber
>  echo "$manufacturer" > strings/0x409/manufacturer
>  echo "$model" > strings/0x409/product
> -echo "Conf 1" > configs/c.1/strings/0x409/configuration
> +echo "$conf" > configs/c.1/strings/0x409/configuration
>  ln -s functions/ffs.usb0 configs/c.1
>
>  mkdir -p /dev/usb-ffs/adb
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#125342): https://lists.openembedded.org/g/openembedded-devel/message/125342
> Mute This Topic: https://lists.openembedded.org/mt/118378467/3616702
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [anuj.mittal@oss.qualcomm.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Khem Raj March 18, 2026, 5:48 a.m. UTC | #2
yeah thats a good followup I would think.


On Tue, Mar 17, 2026 at 10:27 PM Anuj Mittal via lists.openembedded.org
<anuj.mittal=oss.qualcomm.com@lists.openembedded.org> wrote:

> I think we should at the same time also delete the same
> android-tools-conf recipe present in
> ./meta-oe/dynamic-layers/selinux/recipes-devtool/android-tools.
> Otherwise, the behavior would be different depending on whether
> meta-selinux is included or not.
>
> On Wed, Mar 18, 2026 at 1:03 PM Viswanath Kraleti via
> lists.openembedded.org
> <viswanath.kraleti=oss.qualcomm.com@lists.openembedded.org> wrote:
> >
> > The android-gadget-setup script currently hardcodes the USB vendor ID,
> > product ID, and configuration string. This makes it difficult for BSP
> > layers to customize USB gadget identity with platform specific values.
> >
> > Introduce variables for the vendor ID, product ID, and configuration
> > string when populating the configfs attributes. This allows machine
> > or distro specific overrides via `/etc/android-gadget-setup.machine`,
> > while preserving the existing default values.
> >
> > Signed-off-by: Viswanath Kraleti <viswanath.kraleti@oss.qualcomm.com>
> > ---
> >  .../android-tools-conf-configfs/android-gadget-setup     | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git
> a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup
> b/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup
> > index dbd7115151..47e4edb9be 100644
> > ---
> a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup
> > +++
> b/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup
> > @@ -2,9 +2,12 @@
> >
> >  set -e
> >
> > +conf="Conf 1"
> >  manufacturer=RPB
> >  model="Android device"
> > +product=0xd002
> >  serial=0123456789ABCDEF
> > +vendor=0x18d1
> >
> >  if [ -r /etc/android-gadget-setup.machine ] ; then
> >         . /etc/android-gadget-setup.machine
> > @@ -23,12 +26,12 @@ mkdir configs/c.1
> >  mkdir functions/ffs.usb0
> >  mkdir strings/0x409
> >  mkdir configs/c.1/strings/0x409
> > -echo -n 0x18d1 > idVendor
> > -echo -n 0xd002 > idProduct
> > +echo -n "$vendor"  > idVendor
> > +echo -n "$product" > idProduct
> >  echo "$serial" > strings/0x409/serialnumber
> >  echo "$manufacturer" > strings/0x409/manufacturer
> >  echo "$model" > strings/0x409/product
> > -echo "Conf 1" > configs/c.1/strings/0x409/configuration
> > +echo "$conf" > configs/c.1/strings/0x409/configuration
> >  ln -s functions/ffs.usb0 configs/c.1
> >
> >  mkdir -p /dev/usb-ffs/adb
> >
> >
> >
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#125344):
> https://lists.openembedded.org/g/openembedded-devel/message/125344
> Mute This Topic: https://lists.openembedded.org/mt/118378467/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [
> raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup b/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup
index dbd7115151..47e4edb9be 100644
--- a/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup
+++ b/meta-oe/recipes-devtools/android-tools/android-tools-conf-configfs/android-gadget-setup
@@ -2,9 +2,12 @@ 
 
 set -e
 
+conf="Conf 1"
 manufacturer=RPB
 model="Android device"
+product=0xd002
 serial=0123456789ABCDEF
+vendor=0x18d1
 
 if [ -r /etc/android-gadget-setup.machine ] ; then
 	. /etc/android-gadget-setup.machine
@@ -23,12 +26,12 @@  mkdir configs/c.1
 mkdir functions/ffs.usb0
 mkdir strings/0x409
 mkdir configs/c.1/strings/0x409
-echo -n 0x18d1 > idVendor
-echo -n 0xd002 > idProduct
+echo -n "$vendor"  > idVendor
+echo -n "$product" > idProduct
 echo "$serial" > strings/0x409/serialnumber
 echo "$manufacturer" > strings/0x409/manufacturer
 echo "$model" > strings/0x409/product
-echo "Conf 1" > configs/c.1/strings/0x409/configuration
+echo "$conf" > configs/c.1/strings/0x409/configuration
 ln -s functions/ffs.usb0 configs/c.1
 
 mkdir -p /dev/usb-ffs/adb