> * Andrzej Pietrasiewicz | 2012-11-22 13:06:56 [+0100]: >> echo <some file>.img > /cfg/usb-function-gadget/G1/C1/F1/MassStorage/lun0/file >> >> Do the similar thing to other functions, then >> >> echo 1 > /cfg/usb-function-gadget/G1/ready On Thu, Nov 22 2012, Sebastian Andrzej Siewior wrote: > One thing you miss: Lets say you have C1 and C2. How do you configure > the same F1 in C1 and C2 _and_ how do you configure a different F1 in > F1 and F2 in C2. I guess the latter will work just now but the former > example won't. The former example is used by the nokia gadget, the > latter by g_serial. Yeah. I would propose having a separate directory for functions, ie.: cd /cfg/usb-function-gadget/gadget1 mkdir functions/mass_storage would load the function and allocate usb_function structure for it (or whatever) as well as create all the interesting attributes inside the directory, and later on: mkdir configs/config0 mkdir configs/config0/func0 ln functions/mass_storage configs/config0/func0/function or something similar. >>+struct ufg_gadget_grp { >>+ /* This group needs children */ >>+ struct config_group group; >>+ >>+ /* attributes' values */ >>+ ushort idVendor; >>+ ushort idVendor_set:1; >>+ ushort idProduct; >>+ ushort idProduct_set:1; >>+ ushort bcdDevice; >>+ ushort bcdDevice_set:1; > If you put the :1 variables after each other then the compiler will > merge them. I think that was the plan because otherwise it is confusing. >>+ char iManufacturer[UFG_NAME_LEN]; >>+ ushort iManufacturer_set:1; >>+ char iProduct[UFG_NAME_LEN]; >>+ ushort iProduct_set:1; >>+ char iSerialNumber[UFG_NAME_LEN]; >>+ ushort iSerialNumber_set:1; > So you decided to use the max number of bytes USB allowes. You waste > around half a KiB because most will be smaller. Please use a kmalloc() > buffer here. I think it would also allow removal of those three _set variables. >>+ bool ready; unsigned ready:1; like the rest perhaps? >>+ >>+ void *gadget_grp_data; >>+}; -- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, Michał “mina86” Nazarewicz (o o) ooo +----<email/xmpp: mpn@xxxxxxxxxx>--------------ooO--(_)--Ooo--
Attachment:
pgp9Hdf69KQwN.pgp
Description: PGP signature