RE: [PATCH 2/3] usb: gadget: Add USB functions gadget

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

 



Hello Sebastian,

On September 17, 2012 6:23 PM Sebastian Andrzej Siewior wrote:

<snip>

> 
> Not looking at code. Can you give a few bash lines which setup the
> gadget? Please make it work with mass storage (which is ported in 3/3)
> and something else like serial or ncm (or $your_favorite) which
> (ofcourse) does not work (because not yet available) but it shows the
> way you plan it to behave.

This is how I would like to setup the gadget with mass storage
(udc interface unchanged, so no udc choice for user; configfs root
for the gadget is named "usb-function-gadget", probably to be changed
after the udc-core supports choice of other than first available; some
names probably to be changed as well, e.g. iManufacturer->manufacturer
or something like that, connect->ready):

$ insmod libcomposite.ko
$ insmod g_usb_functions.ko
$ mount -t configfs none /cfg
$ mkdir -p /cfg/usb-function-gadget/ufg/config1/function1
$ echo -n <some id> > /cfg/usb-function-gadget/ufg/idVendor
$ echo -n <some id> > /cfg/usb-function-gadget/ufg/idProduct
$ echo -n <something> > /cfg/usb-function-gadget/ufg/bcdDevice
$ echo -n <string> > /cfg/usb-function-gadget/ufg/iManufacturer
$ echo -n <string> > /cfg/usb-function-gadget/ufg/iSerialNumber
$ echo -n <string> > /cfg/usb-function-gadget/ufg/iProduct
$ echo -n "f_mass_storage" > /cfg/usb-function-gadget/ufg/\
config1/function1/name
$ mkdir /cfg/usb-function-gadget/ufg/config1/function1/\
f_mass_storage
$ echo -n 1 > /cfg/usb-function-gadget/ufg/config1/function1/\
f_mass_storage/luns
$ mkdir /cfg/usb-function-gadget/ufg/config1/function1/\
f_mass_storage/lun0
$ echo -n "file.img" > /cfg/usb-function-gadget/ufg/config1/\
function1/f_mass_storage/lun0/file
$ echo -n 1 > /cfg/usb-function-gadget/ufg/connect

With serial I would do the following:

$ insmod libcomposite.ko
$ insmod g_usb_functions.ko
$ mount -t configfs none /cfg
$ mkdir -p /cfg/usb-function-gadget/ufg/config1/function1
$ echo -n <some id> > /cfg/usb-function-gadget/ufg/idVendor
$ echo -n <some id> > /cfg/usb-function-gadget/ufg/idProduct
$ echo -n <something> > /cfg/usb-function-gadget/ufg/bcdDevice
$ echo -n <string> > /cfg/usb-function-gadget/ufg/iManufacturer
$ echo -n <string> > /cfg/usb-function-gadget/ufg/iSerialNumber
$ echo -n <string> > /cfg/usb-function-gadget/ufg/iProduct
$ echo -n "f_serial" > /cfg/usb-function-gadget/ufg/config1/\
function1/name
$ mkdir /cfg/usb-function-gadget/ufg/config1/function1/f_serial
$ echo -n 1 > /cfg/usb-function-gadget/ufg/config1/function1/\
f_serial/use_acm
$ echo -n 1 > /cfg/usb-function-gadget/ufg/config1/function1/\
f_serial/n_ports
$ echo -n 0 > /cfg/usb-function-gadget/ufg/config1/function1/\
f_serial/use_obex

When the udc-core supports multiple udcs in a manner more flexible
than the "first available", the "usb-function-gadget" name would
be changed to e.g. /cfg/usb-gadget/gadgets. Also, the "connect"
aka "ready" attribute could be changed to creating a symlink.

Setting e.g. maximum power would be done through an appropriate
attribute:

$ echo 500 > /cfg/usb-gadget/gadgets/ufg/config1/maximum_power.

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