About gadget configfs

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

 



Hi Sebastian & Andrzej,

I have tried configfs today, and have some puzzled about its
behaviour, hope I can get answers from your both, thanks.

I am running the latest usb-next tree (3.15-rc3), and build
configfs as module, and enabled mass storage and serial, I follow
the instruction of ocumentation/usb/gadget_configfs.txt

The step at the board:

root@freescale ~$ modprobe libcomposite
root@freescale ~$ mount none /sys/kernel/config/ -t configfs
root@freescale ~$ mkdir /sys/kernel/config/usb_gadget/g1
root@freescale ~$ cd /sys/kernel/config/usb_gadget/g1/
root@freescale /sys/kernel/config/usb_gadget/g1$ echo 0x15a2 > idVendor
root@freescale /sys/kernel/config/usb_gadget/g1$ echo 0x0054 > idProduct 
root@freescale /sys/kernel/config/usb_gadget/g1$ mkdir strings/0x409
root@freescale /sys/kernel/config/usb_gadget/g1$ echo 123456ABCDEF >
strings/0x4
09/serialnumber
root@freescale /sys/kernel/config/usb_gadget/g1$ echo Freescale >
strings/0x409/
manufacturer
root@freescale /sys/kernel/config/usb_gadget/g1$ echo "FSL i.mx6q
sabreSD Board"
 > strings/0x409/product

root@freescale /sys/kernel/config/usb_gadget/g1$ echo 5 >
configs/c.1/MaxPower 
root@freescale /sys/kernel/config/usb_gadget/g1$ mkdir
	functions/mass_storage.1
	Number of LUNs=8
	Mass Storage Function, version: 2009/09/11
	LUN: removable file: (no medium)
root@freescale /sys/kernel/config/usb_gadget/g1$ echo
"/dev/mmcblk0p1" > functio
ns/mass_storage.1/lun.0/file 

root@freescale /sys/kernel/config/usb_gadget/g1$ mkdir
functions/gser.1
root@freescale /sys/kernel/config/usb_gadget/g1$ cat
functions/gser.1/port_num 
	0

root@freescale /sys/kernel/config/usb_gadget/g1$ lsmod
	Module                  Size  Used by
	usb_f_serial            2974  2 
	u_serial               10032  1 usb_f_serial
	usb_f_mass_storage     38373  2 
	libcomposite           37503 10 usb_f_serial,usb_f_mass_storage

root@freescale /sys/kernel/config/usb_gadget/g1$ ls /sys/class/udc/
ci_hdrc.0
root@freescale /sys/kernel/config/usb_gadget/g1$ echo "ci_hdrc.0" > UDC
root@freescale /sys/kernel/config/usb_gadget/g1$ configfs-gadget gadget:
high-speed config #2: c

At Linux PC:

b29397@nchen-desktop:~$ lsusb -d 15a2:0054 -v

Bus 001 Device 064: ID 15a2:0054 Freescale Semiconductor, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               0.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x15a2 Freescale Semiconductor, Inc.
  idProduct          0x0054 
  bcdDevice            3.15
  iManufacturer           1 Freescale
  iProduct                2 FSL i.mx6q sabreSD Board
  iSerial                 3 123456ABCDEF
  bNumConfigurations      2
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower                6mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      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               0
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     2
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk (Zip)
      iInterface              5 Mass Storage
      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
Device Status:     0x0000

My questions:

- Why mass storage has been chosen at PC, but not gserial?
- Is it possible both two configurations can be seen at PC?
If possible, how to do?
- How to choose gserial? I tried to remove the configuration
of mass storage, but both of configurations have been removed

root@freescale /sys/kernel/config/usb_gadget/g1$ rm -rf
configs/c.2/mass_storage
.1/
configfs-gadget gadget: unbind function 'gser'/be822b80
configfs-gadget gadget: unbind function 'Mass Storage Function'/be822d80

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux