Merge pull request #1 from kopasiak/master

Merging the following series:

libusbg: clean up and error handling
libusbg: Cleanup, bug fix and refactoring
libusbg: Bug fixes, feature enhancements and API
libusbg: Add error code propagation and attributes refreshing
libusbg: Fix missing read of bcdDevice.

Value of bcdDevice has been never read from Config FS
and this field was leaved uninitialized. Change
usbg_parse_gadget_attrs() to read also from this file.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Fix wrong malloc sizes in allocate functions.

Functions usbg_allocate_function() and usbg_allocate_binding()
had allocated sizeof(usbg_config) instead of usbg_function
and usbg_binding.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Add checking for legal function type.

Function type provided by user to functions should
be checked before usage to avoid errors.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Replace usage of function name with type and instance.

User of library should not use directly function name but
only type of the function and name of instance. Using this
will separate user for naming convention on Config FS.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Use config ID and label instead of config name.

Naming convention of Config FS should not be exposed
to user of library. All API functions should use
configuration ID (configuration number) as unique
identificator and configuration label as human
readable description.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Merge pull request #2 from kopasiak/devel

Small bug fixes and rework of API.
libusbg: Add remove binding functionality.

Add function which allow to remove binding between function
and configuration. This functions also remove binding from
internal library structures wht means that after this
operation all pointers to removed binding are invalid.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Add remove gadget/config strings functionality.

Add functions which allow to remove strings in gadget
and configuration.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Add remove configuration functionality.

Add function which allow to remove configuration.
This functions also remove binding from internal
library structures what means that after this
operation all pointers to removed config are invalid.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Add remove function functionality.

Add function which allow to remove USB function.
This functions also remove function from internal
library structures what means that after this
operation all pointers to removed function are invalid.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Add remove gadget functionality.

Add function which allow to remove USB gadget.
This functions also remove gadget from internal
library structures what means that after this
operation all pointers to removed gadget are invalid.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Update examples to new API functionality.

Removing gadget/config/function/binding functionality
has been added to API so add example of how to use it.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>