Re: About gadget configfs

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

 



Hello,

W dniu 04.05.2014 12:31, Peter Stuge pisze:
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.



This one is necessary. The code which implements the function registration
interface is located in libcomposite. Once libcomposite is loaded
all other modules are requested automatically, indeed.

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?

Definitely yes.




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.

Configurations can provide a number of functions. To tell the kernel
which functions you want in a configuration you make symbolic links -
the links point at the functions you want and the links themselves
are located in your configuration's directory.
The same function can be exposed in more than one configuration.
It is ok, because only one configuration can be active at a time.



- 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.


A likely cause.


- 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.


That's right. Please see above.


- 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.


At a linux host you need to use vendor and product parameters of the
usbserial module.


AP

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