Versions Compared

Key

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

...

Code Block
#!/bin/sh

CONFIGFS_HOME=/sys/kernel/config
VID=0xabcd
PID=0x1234
serial_number="myserial"
manufacturer="mymfg"
product="myproduct"
name="c"
number="1"
configuration="uac1"
maxpower="500"

CONFIG="configs/$name.$number"
FUNCTION="uac1.0"
UDC_NAME="f8102800.usb"
# UDC_NAME="f80a1000.dwc3"

modprobe libcomposite

echo 0 > /sys/module/sunplus_udc/parameters/dmsg

mount -t configfs none $CONFIGFS_HOME
mkdir -p $CONFIGFS_HOME/usb_gadget/g1
cd $CONFIGFS_HOME/usb_gadget/g1
echo $VID > idVendor
echo $PID > idProduct

mkdir -p strings/0x409
echo $serial_number > strings/0x409/serialnumber
echo $manufacturer > strings/0x409/manufacturer
echo $product > strings/0x409/product

mkdir -p configs/$name.$number
echo $maxpower > configs/$name.$number/MaxPower

mkdir -p configs/$name.$number/strings/0x409
echo $configuration > configs/$name.$number/strings/0x409/configuration

mkdir -p functions/$FUNCTION
echo 0x3 > functions/$FUNCTION/p_chmask
echo 48000 > functions/$FUNCTION/p_srate
echo 2 > functions/$FUNCTION/p_ssize
echo 0x3 > functions/$FUNCTION/c_chmask
echo 48000 > functions/$FUNCTION/c_srate
echo 2 > functions/$FUNCTION/c_ssize

ln -s functions/$FUNCTION configs/$name.$number
echo $UDC_NAME > UDC

...