On Mon, Aug 25, 2014 at 10:54:51AM +0200, Krzysztof Opasiak wrote: > Dear Matt, > > This quite big series adds new part of libusbg API which allows to > import/export gadget/function/configuration from/to file. > > Motivation: > > Libusbg allows to create a binary file which set up custom > gadget. This is useful but if we have to create custom binary for > each gadget we wast a lot of work which kernel people put to separate > code from configuration. This leads us to main idea of gadget > schemes. Allow to create simple, human readable config file which > library will be able to translate into usb gadget. > > Description: > > Gadget schemes is idea of describing gadget/function/configuration in > config file. To not reinvent the wheel I have used existing library > libconfig [1]. This means that the syntax is similar to this described > in documentation of libconfig. Thank goodness. Apparently you read my mind and avoided use of xml and json here. I've used libconfig before and really like the human readable/creatable syntax. > > I have extended the library with set of usbg_export_*() functions > which allows to export selected gadget to given FILE. There is also > set of complementary usbg_import_*() functions which allows to read > scheme of gadget/function/config from file and create it using > configfs. > > To avoid name conflict I have used the convention that > usbg_import_gadget() function takes name of new gadget as parameter > and usbg_export_gadget() doesn't export gadget name to scheme > file. Similar idea is used in configuration and functions. > > Base convention of gadget schemes is simple: if something is not set > in scheme file, default values provided by kernel are used. Moreover > configfs has some attributes which are read only. To allow to store > them in scheme file they are ignored by import functions. > > Usage of libconfig and whole design of gadget schemes allows us to use > include directive in gadget definition to import complicated > configurations or functions. > > Syntax and detailed rules of using schemes has been described in > gadget_schemes.txt in commit: <snip> > Summary: > > I have created a pull request also for this series: > > https://github.com/libusbg/libusbg/pull/8 Applied this to master, thanks. > > Feel free to provide your comments about the whole idea and also about > its implementation. It all looks good, my major concern when you had first mentioned this was about was schema/format would be used. APIs look great, and I've tested this with my own WIP application and it works quite nicely. Thanks for adding this feature. -Matt -- 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