Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This document demonstrates how to create an USB 2.0 / USB 3.0 ADB gadget on SP7350 platforms.

...

Please refer to https://sunplus.atlassian.net/wiki/x/1gB-dg to download the source code. Use the following command to set up the compilation environment. In “Select rootfs“, “5“ should be selected for Buildroot root file-system.

Code Block
# make config

image-20240806-022759.png

adbd utility for the

...

target

Use the following command to enter Buildroot Configuration and select submenus for the adbd utility for the target : Target Packages > System tools. Select [*] for “android-tools” (it selects “adbd” by default).

Code Block
# make bconfig

image-20240806-032119.png

kernel

...

Setup

Enter the kernel configuration by running the following command in the top directory of project.

...

Code Block
#!/bin/bash

# enable USB2 or USB3
ADB_EN=USB2

KERNEL_PATH=/lib/modules/`uname -r`/kernel
GADGET_PATH=$KERNEL_PATH/drivers/usb/gadget
FUNCTION_PATH=$GADGET_PATH/function

COMPOSITE=$GADGET_PATH/libcomposite.ko
U_FFS=$FUNCTION_PATH/usb_f_fs.ko

insmod $COMPOSITE
insmod $U_FFS

# disable debug message
echo 0 > /sys/module/sunplus_udc/parameters/dmsg

if [ ! -d /dev/pts ]
then
        mkdir /dev/pts
        mount -t devpts none /dev/pts
fi

if [ ! -d /sys/kernel/config ]
then
        mkdir -p /sys/kernel/config
        mount -t configfs none /sys/kernel/config
fi

cd /sys/kernel/config/usb_gadget
mkdir g_adb
cd g_adb

echo "0x1d6b" > idVendor
echo "0x0105" > idProduct

mkdir configs/c.1
mkdir functions/ffs.adb
mkdir strings/0x409
mkdir configs/c.1/strings/0x409

echo "20240807" > strings/0x409/serialnumber
echo "Sunplus" > strings/0x409/manufacturer
echo "FunctionFS gadget (adb)" > strings/0x409/product
echo "adb" > configs/c.1/strings/0x409/configuration
echo 120 > configs/c.1/MaxPower

mkdir -p functions/ffs.adb
ln -s functions/ffs.adb configs/c.1

mkdir -p /dev/usb-ffs/adb
mount -o uid=2000,gid=2000 -t functionfs adb /dev/usb-ffs/adb
adbd&

sleep 1

if [ $ADB_EN = USB2 ]
then
        echo "f8102800.usb" > UDC
else ifelif [ $ADB_EN = USB3 ]
then
        echo "f80a1000.dwc3" > UDC
fi

...