On Tue, Sep 18, 2012 at 04:53:13PM +0200, Andrzej Pietrasiewicz wrote: > 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 I wouldn't make functionN a directory. I think it's better to: echo "f_mass_storage" > /cfg/usb-function-gadget/ufg/config0/function0 and that would create all necessary interfaces and expose all knobs from interfaces and their endpoints. Some after running the command above you would have: ..../config1/intf0/ ..../config1/intf0/bLength ..../config1/intf0/bDescriptorType ..../config1/intf0/bInterfaceNumber ..../config1/intf0/bAlternateSetting ..../config1/intf0/bNumEndpoints ..../config1/intf0/bInterfaceClass ..../config1/intf0/bInterfaceSubClass ..../config1/intf0/bInterfaceProtocol ..../config1/intf0/iInterface ..../config1/intf0/ep80/ ..../config1/intf0/ep80/bLength ..../config1/intf0/ep80/bDescriptorType ..../config1/intf0/ep80/bInterfaceNumber ..../config1/intf0/ep80/bAlternateSetting ..../config1/intf0/ep80/bNumEndpoints ..../config1/intf0/ep80/bInterfaceClass ..../config1/intf0/ep80/bInterfaceSubClass ..../config1/intf0/ep80/bInterfaceProtocol ..../config1/intf0/ep80/iInterface ..../config1/intf0/ep81/ ..../config1/intf0/ep81/bLength ..../config1/intf0/ep81/bDescriptorType ..../config1/intf0/ep81/bInterfaceNumber ..../config1/intf0/ep81/bAlternateSetting ..../config1/intf0/ep81/bNumEndpoints ..../config1/intf0/ep81/bInterfaceClass ..../config1/intf0/ep81/bInterfaceSubClass ..../config1/intf0/ep81/bInterfaceProtocol ..../config1/intf0/ep81/iInterface of course only few of those would be writeable from userland, but exposing read-only versions of those might help us find bugs without needing to read the source code. And, you could create as many functionN files as you want under a particular configuration. -- balbi
Attachment:
signature.asc
Description: Digital signature