Re: About gadget configfs

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

 



Hi Peter,

Peter Chen wrote:
> The step at the board:
> 
> root@freescale ~$ modprobe libcomposite

I guess this step is unneccessary, and that all neccessary modules
are loaded automatically on demand.


> 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/0x409/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

I guess you also did a "mkdir configs/c.1" step here?


> 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" > functions/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

So far so good! You've created two functions in the gadget, following
gadget_configfs.txt up to and including section 3.

Section 4. comes next, which wasn't included in your list of commands.
"Associating the functions with their configurations"

ln -s functions/<name>.<instance name> configs/<name>.<number>

I assume that this results in having only a single configuration with
two interfaces.


> - Why mass storage has been chosen at PC, but not gserial?

Probably because the host (PC) doesn't have a driver for gserial with
your chosen vid+pid.


> - Is it possible both two configurations can be seen at PC?
> If possible, how to do?

Both configurations *are* seen by the host - but only one
configuration of a USB device can be selected at any one time.

If you want both functions available simultaneously then they must be
two different interfaces within a single configuration. I believe the
symlink described in gadget_configfs.txt section 4. accomplishes that.


> - How to choose gserial? I tried to remove the configuration
> of mass storage, but both of configurations have been removed

I guess that you will need to add your vid+pid to the host driver.


> root@freescale /sys/kernel/config/usb_gadget/g1$ rm -rf configs/c.2/mass_storage.1/

Where does configs/c.2 come from? It wasn't mentioned before in your steps?


Best regards

//Peter
--
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