android-tools-conf-configfs: make USB gadget IDs configurable

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>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Viswanath Kraleti 2026-03-18 10:33:33 +05:30 committed by Khem Raj
parent 62b17d2806
commit ad2a5ac0a0
No known key found for this signature in database
GPG Key ID: BB053355919D3314

View File

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