mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-04-02 02:49:12 +00:00
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>
39 lines
838 B
Bash
39 lines
838 B
Bash
#!/bin/sh
|
|
|
|
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
|
|
fi
|
|
|
|
[ -d /sys/kernel/config/usb_gadget ] || modprobe libcomposite
|
|
|
|
cd /sys/kernel/config/usb_gadget
|
|
|
|
[ -d adb ] && /usr/bin/android-gadget-cleanup || true
|
|
|
|
mkdir adb
|
|
cd adb
|
|
|
|
mkdir configs/c.1
|
|
mkdir functions/ffs.usb0
|
|
mkdir strings/0x409
|
|
mkdir configs/c.1/strings/0x409
|
|
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" > configs/c.1/strings/0x409/configuration
|
|
ln -s functions/ffs.usb0 configs/c.1
|
|
|
|
mkdir -p /dev/usb-ffs/adb
|
|
mount -t functionfs usb0 /dev/usb-ffs/adb
|