Related to this older thread, I'm also trying to get uvc-gadget to work, on a J784S4XEVM this time. My script is listed below.
#! /bin/sh GADGET_DIR="/sys/kernel/config/usb_gadget" GADGET_NAME="uvc_gadget" LANGUAGE=0x409 VENDOR_ID=0x1d6b #Linux Foundation PRODUCT_ID=0x0104 #Multifunction composite gadget SERIAL="0123456789" MANUFACTURER="Acme" PRODUCT="Testing123" CONFIGNAME="c" CONFIGNUM=1 CONFIGURATION="UVC" MAXPOWER=500 FUNCTION="uvc" FUNCTION_ID="usb0" MAX_SPEED="high-speed" create_frame() { # Example usage: # create_frame <width> <height> <group> <format name> WIDTH=$1 HEIGHT=$2 FORMAT=$3 NAME=$4 wdir=$GADGET_DIR/$GADGET_NAME/functions/$FUNCTION.$FUNCTION_ID/streaming/$FORMAT/$NAME/${HEIGHT}p mkdir -p $wdir echo $WIDTH > $wdir/wWidth echo $HEIGHT > $wdir/wHeight echo $(( $WIDTH * $HEIGHT * 2 )) > $wdir/dwMaxVideoFrameBufferSize cat <<EOF > $wdir/dwFrameInterval 666666 100000 5000000 EOF } modprobe libcomposite mkdir $GADGET_DIR/$GADGET_NAME cd $GADGET_DIR/$GADGET_NAME echo $VENDOR_ID > idVendor echo $PRODUCT_ID > idProduct echo $MAX_SPEED > max_speed mkdir strings/$LANGUAGE echo $MANUFACTURER > strings/$LANGUAGE/manufacturer echo $SERIAL > strings/$LANGUAGE/serialnumber echo $PRODUCT > strings/$LANGUAGE/product mkdir configs/$CONFIGNAME.$CONFIGNUM mkdir configs/$CONFIGNAME.$CONFIGNUM/strings/$LANGUAGE echo $MAXPOWER > configs/$CONFIGNAME.$CONFIGNUM/MaxPower echo $CONFIGURATION > configs/$CONFIGNAME.$CONFIGNUM/strings/$LANGUAGE/configuration mkdir $GADGET_DIR/$GADGET_NAME/functions/uvc.usb0 mkdir $GADGET_DIR/$GADGET_NAME/functions/acm.usb0 mkdir functions/uvc.usb0/control/header/h ln -s functions/uvc.usb0/control/header/h functions/uvc.usb0/control/class/fs/h create_frame 1280 720 mjpeg mjpeg create_frame 1920 1080 mjpeg mjpeg mkdir functions/uvc.usb0/streaming/header/h cd $GADGET_DIR/$GADGET_NAME/functions/uvc.usb0/streaming/header/h ln -s ../../mjpeg/mjpeg cd ../../class/fs ln -s ../../header/h cd ../../class/hs ln -s ../../header/h cd $GADGET_DIR/$GADGET_NAME ln -s functions/uvc.usb0 configs/c.1 ln -s functions/acm.usb0 configs/c.1 ls /sys/class/udc > $GADGET_DIR/$GADGET_NAME/UDC
When I try to link the UDC device to the uvc_gadget in configfs I get these errors:
[ 53.427774] udc 6000000.usb: binding gadget driver [uvc_gadget] [ 53.433747] configfs-gadget.uvc_gadget gadget.0: adding 'uvc'/000000003ec1e969 to config 'c'/00000000dbcd99c2 [ 53.443652] configfs-gadget.uvc_gadget gadget.0: uvc: uvc_function_bind() [ 53.450441] configfs-gadget.uvc_gadget gadget.0: adding 'uvc'/000000003ec1e969 --> -19 [ 53.458351] udc 6000000.usb: failed to start uvc_gadget: -19 [ 53.464051] UDC core: uvc_gadget: couldn't find an available UDC or it's busy ls: write error: Device or resource busy
I'm using SDK 09.01, does the USB driver fully support UDC at this stage?
Thanks,
Simon