libusbg: Allow to set all gadget attrs using one function.

Having specialized functions for each attribute may be
sometime inconvenient to use. Provide also function
whihc allows to set attribute selected by parameter.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Return suitable error codes instead of -1

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Make usbg_lookup_function_type() publicly available

Users of library may often receive function type as a string.
Instead of implementing parsing of such string in each program
it would be more convenient to provide such support in library.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Add own name to AUTHORS file.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Don't print errno when it has not been directly set

Replace ERRORNO() macro with ERROR(). Difference betwen
them is that ERRORNO() prints also standard error string
based on errno value. This variable should not be accessed
when called function doesn't directly set it.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Add udc structure

Add structure to store informations about available udcs
instead of using their names as a string.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Replace usbg_get_udcs() with loop

Library allows to iterate over each gadget using loop.
To be consistent with this convention add similar loop
for UDCs.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Rework API to use usbg_udc structure

Using string as udc identifier provides a lot
of troubles. To be more consistent with rest of
API rework it to start using usbg_udc structure
instead of using char *.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Refresh gadget UDC while each usbg_get_gadget_udc()

Kernel may decide to detach our gadget in some cases.
A good example is when FFS daemon received a SIGSEGV
and all descriptors has been closed.

To avoid returning false informations to user we have
to refresh UDC attribute before returning cached pointer
to usbg_udc.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Allow to get gadget enabled on given UDC

Add usbg_get_udc_gadget() which allows user to learn
which gadget is attached to selected UDC.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
libusbg: Add example how to use usbg_udc structure

This example shows how to learn what udcs are available
in system and also how to find out what gadgets are
enabled on them.

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