USB configfs gadget test with ffs-test tool

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB configfs gadget test with ffs-test tool

USB configfs gadget test with ffs-test tool

Platform: Demo images, i.MX8MPlus EVK

 

Some customer need test ffs gadget function on i.MX8MPlus EVK.

Here is demo for ffs test, please connect EVK and Ubuntu PC before test.

 

Test script:

#!/bin/sh
# Setup the device (configfs)
modprobe libcomposite
mkdir -p config
mount none config -t configfs
cd config/usb_gadget/
mkdir g1
cd g1
echo 0x1fc9 >idVendor
echo 0x0146 >idProduct

mkdir strings/0x409
echo 12345 >strings/0x409/serialnumber
echo "Signal 11" >strings/0x409/manufacturer
echo "Test" >strings/0x409/product

mkdir configs/c.1
mkdir configs/c.1/strings/0x409
echo "Config1" >configs/c.1/strings/0x409/configuration 

# Setup functionfs
mkdir functions/ffs.usb0
ln -s functions/ffs.usb0 configs/c.1
cd ../../../
mkdir -p ffs
mount usb0 ffs -t functionfs
cd ffs
ffs-test 64 & # from the Linux kernel, with mods!
sleep 3
cd ..
# Enable the USB device
echo 38100000.usb > config/usb_gadget/g1/UDC

 

EVK log

root@imx8mpevk:~# ./test2.sh
[   17.859597] file system registered
ffs-test: dbg:  ep0: writing descriptors (in v2 format)
ffs-test: dbg:  ep0: writing strings
ffs-test: dbg:  ep1: starting
ffs-test: dbg:  ep2: starting
ffs-test: dbg:  ep1: starts
ffs-test: dbg:  ep0: starts
ffs-test: dbg:  ep2: starts
Event BIND
Event ENABLE

Ubuntu PC log:

lzm@lzm-GL552VW:~$ lsusb -D /dev/bus/usb/001/008
Device: ID 1fc9:0146 NXP Semiconductors Test
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x1fc9 NXP Semiconductors
  idProduct          0x0146
  bcdDevice            6.01
  iManufacturer           1 Signal 11
  iProduct                2 Test
  iSerial                 3 12345
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0020
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          4 Config1
    bmAttributes         0x80
      (Bus Powered)
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              5 Source/Sink
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x0016
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x0000010e
      BESL Link Power Management (LPM) Supported
    BESL value      256 us
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000f
      Device can operate at Low Speed (1Mbps)
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat           0 micro seconds
    bU2DevExitLat           0 micro seconds
Device Status:     0x0001
  Self Powered

 

Comments

But in the demo image contains usb gadget test. 

Lots of functions. 

Like NCM in the test, we also can test the usb network.

unit_tests/USB/

1.png

No ratings
Version history
Last update:
‎11-24-2023 04:27 AM
Updated by: