RE: Can Only Enable 2 Classes Using Gadget ConfigFS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
> 
> The attached script works only when 2 of the 3 given classes are enabled. The
> failure is that UDC is not writeable. Is there a limit I am reaching? I did not think I
> would get to 32 endpoints, so is there a limitation due to my device's construction?
> 
> I can not find any good troubleshooting information.
> 
> Thanks in advance,
>      R0b0t1
> 

I tried the similar, it works for one mass_storage and two ACMs, see below.
Since you have failed for last step, please debug your controller
driver's .udc_start function, and see what's wrong.

mkdir functions/mass_storage.0
ln -s functions/mass_storage.0 configs/c.1
mkdir functions/acm.0
ln -s functions/acm.0 configs/c.1
mkdir functions/acm.1
ln -s functions/acm.1 configs/c.1

Peter

> 
> ---
> 
> 
> #!/bin/bash
> set -euo pipefail
> 
> # General configuration:
> GADGET_NAME="testgadget"
> LANGUAGE=0x409
> MANUFACTURER="Sidney Spry"
> PRODUCT="Test Gadget"
> 
> # Function configuration:
> HOST_ADDRESS="1a:55:89:a2:69:42"
> DEV_ADDRESS="1a:55:89:a2:69:41"
> 
> 
> if [ "$EUID" -ne 0 ]; then
> echo "This script must run as root."
> exit 1
> fi
> 
> 
> echo "Loading libcomposite..."
> CONFIGFS="/sys/kernel/config/usb_gadget"
> GADGET="$CONFIGFS/$GADGET_NAME"
> modprobe libcomposite
> 
> while [ ! -d $CONFIGFS ]; do
> sleep 0.01
> done
> 
> 
> echo "Cleaning existing gadget..."
> find $GADGET/configs/*/* -maxdepth 0 -type l -exec rm {} \; || true find
> $GADGET/configs/*/strings/* -maxdepth 0 -type d -exec rmdir {} \; || true find
> $GADGET/os_desc/* -maxdepth 0 -type l -exec rm {} \; || true find
> $GADGET/functions/* -maxdepth 0 -type d -exec rmdir {} \; || true find
> $GADGET/strings/* -maxdepth 0 -type d -exec rmdir {} \; || true find
> $GADGET/configs/* -maxdepth 0 -type d -exec rmdir {} \; || true rmdir $GADGET ||
> true
> 
> #find "$GADGET/configs" -maxdepth 2 -type l -exec "rm" {} \; #find
> "$GADGET"/configs/*/strings/* -maxdepth 0 -type d -exec "rmdir" {} \; #find
> "$GADGET"/os_desc/* -maxdepth 0 -type l -exec "rm" {} \; #find
> "$GADGET"/configs/functions/* -maxdepth 0 -type d -exec "rmdir" {} \; #find
> "$GADGET"/configs/* -maxdepth 0 -type d -exec "rmdir" {} \; #rmdir "$GADGET"
> 
> echo "Creating gadget..."
> mkdir "$GADGET"
> cd "$GADGET"
> 
> echo "Configuring device identifiers..."
> echo 0x1d6b > idVendor  # Linux Foundation echo 0x0104 > idProduct #
> Multifunction Composite Gadget echo 0x0001 > bcdDevice # v0.1.0
> echo 0x0200 > bcdUSB    # USB 2.0
> mkdir "strings/$LANGUAGE"
> echo "$MANUFACTURER" > "strings/$LANGUAGE/manufacturer"
> echo "$PRODUCT" > "strings/$LANGUAGE/product"
> 
> echo "Configuring composite device..."
> echo 0xEF > bDeviceClass
> echo 0x02 > bDeviceSubClass
> echo 0x01 > bDeviceProtocol
> 
> echo "Configuring OS-specific descriptors..."
> echo 1       > os_desc/use
> echo 0xcd    > os_desc/b_vendor_code
> echo MSFT100 > os_desc/qw_sign
> 
> echo "Creating Ethernet endpoint (CDC NCM) (1/1)..."
> mkdir "functions/ncm.usb0"
> #echo "$HOST_ADDRESS" > "functions/ncm.usb0/host_addr"
> #echo "$DEV_ADDRESS" > "functions/ncm.usb0/dev_addr"
> 
> echo "Creating serial endpoint (1/2)..."
> mkdir "functions/acm.usb0"
> 
> echo "Creating serial endpoint (2/2)..."
> mkdir "functions/acm.usb1"
> 
> echo "Creating configuration..."
> mkdir "configs/c.1"
> echo 500 > "configs/c.1/MaxPower"
> mkdir "configs/c.1/strings/$LANGUAGE"
> echo "Config 1" > "configs/c.1/strings/$LANGUAGE/configuration"
> ln -s "functions/ncm.usb0" "configs/c.1"
> ln -s "functions/acm.usb0" "configs/c.1"
> ln -s "functions/acm.usb1" "configs/c.1"
> ln -s "configs/c.1" "os_desc/c.1"
> 
> echo "Attaching device..."
> udevadm settle
> ls "/sys/class/udc/" > UDC
> 
> echo "Done."
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a
> message to majordomo@xxxxxxxxxxxxxxx More majordomo info at
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvger.kernel.or
> g%2Fmajordomo-
> info.html&data=02%7C01%7Cpeter.chen%40nxp.com%7C36400e0fa6f74d302eee0
> 8d5cea2f8a6%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C63664212
> 1727615349&sdata=ul4axDZIvQBn8Qoy1A2hbXhQEm0sRWr%2BHTWToC%2B4P
> dc%3D&reserved=0
��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux