Age | Commit message (Collapse) | Author | Files | Lines |
|
Change-Id: I8c015fe84734a1020227040699dc4bbf9a081ccd
|
|
This reverts commit af80c789ed18bffe59ff815f0fddabbda56b9442.
Change-Id: I21d25ee142e12b9111664bd7ce3b2b190a56bb88
|
|
Change-Id: I7f9821384b1c58f400c5e4935edb8b89f30d503e
|
|
This reverts commit 1521b31edc929f9b2d2551d2548765fa953f357d.
Change-Id: Id43ea1856c1d1a02b0f5667a80e5f25bb5e641e5
|
|
Change-Id: I3ef3d374cc9e58ac062a426b9113a2f90d46e60f
|
|
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>
|
|
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>
|
|
Path and name length should not be placed in constant
size buffer but in allocated memory.
Use PATH_MAX macro from limits.h as default size for
USBG_MAX_PATH_LENGTH.
Handle overflows of snprintf in related funcitons.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add usbg_error_name() to get error name as a string.
Add usbg_strerror() to get brief error description in English.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Change usbg_add_config_function() to return usbg_error
instead of returning 0 or -1.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
usbg_get_function_attrs() may fail due to many reasons
so it should notify the user about exact reason of failure
instead of returning only NULL pointer.
Add also USBG_ERROR_NOT_SUPPORTED to usbg_set_function_attrs().
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Change usbg_get_config_strs() and usbg_get_config_attrs()
to return usbg_error instead of NULL pointer.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Change usbg_get_gadget_strs() and usbg_get_gadget_attrs()
to return usbg_error instead of NULL pointer.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Enabling and disabling gadget may fail due to many reasons
so those functions should notify user about it.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Each usbg_set_config_*() may fail so it should have
a return value to notify user about reason of failure.
To be consistent with rest of API usbg_create_config()
should also return error code to notify user about reasons
of failure instead of binary information (NULL or not).
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Each usbg_set_*() may fail so it should have a return value
to notify user about reason of failure.
To be consistent with rest of API usbg_create_function()
should also return error code to notify user about reasons
of failure instead of binary information (NULL or not).
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Setting each of attribute may fail due to a lot of reasons
so those functions should report this failure to a user.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Functions related to gadget creation should return error codes
instead of pointer.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
API should be consistent and use error codes to determine what
type of error occurred instead of returning NULL only.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Functions which provides user length of some internal
strings should return usbg_error instead of -1.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Assumption that all malloc() and read()/write() finish correctly
is too bold. Errors should be handled and propagated to upper
layers of library and returned to user.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Config strings should not be cached in library.
Removing internal strings structure allowed to add
full support for multilingual strings.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Gadget strings should not be cached in library.
Removing internal strings structure allowed to add
full support for multilingual strings.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Switch form struct * to typedef usbg_* to provide convenient
API for user.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Hide definition of binding structure to avoid direct
access to its fields. Rename it to usbg_binding.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Hide definition of function structure to avoid direct
access to its fields. Rename it to usbg_function.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Hide definition of config structure to avoid direct
access to its fields. Rename it to usbg_confg.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Remove definition of gadget structure to avoid direct
access to its fields. Rename that structure to usbg_gadget.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Hide definition of state structure to avoid direct
access to its fields. Rename it to usbg_state.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add usbg_get_binding_target() to avoid direct binding
structure members access. Add also usbg_get_binding_name_len()
and usbg_get_binding_name() to allow getting binding name.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add usbg_get_function_name() and usbg_get_function_name_len()
to avoid direct function structure members access.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add usbg_get_function_attrs() and usbg_get_function_type()
to aviod direct access to function structure members.
Add usbg_set_function_attrs() to allow set all function\
attributes with one call.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
function_names table is for internal usage only.
User should use function_types enum.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add usbg_get_config_name() and usbg_get_config_name_len()
to avoid direct config structure members access.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add usbg_set_config_attrs() function to allow setting
all attributes with one call. Add also getter for attrs
to avoid direct accessing of configuration fields.
Add usbg_set_config_strs() to be consistent with gadget
API.
Change usbg_create_config() to allow configuration creation
and attribute setting with one call.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Configuration, its attributes and strings are all logically
independent so should be placed in separate structures.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add usbg_get_configfs_path_len() and usbg_get_configfs_path()
to avoid direct access to state structure.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add dedicated functions for iterating over gadgets, configs,
bindigs and functions to avoid direct access to fields of this
structures. Change definitons of usbg_for_each_* macros to use
new functions.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add usbg_get_gadget_name() and usbg_get_gadget_udc() to avoid
direct gadget structure members access.
Add also usbg_get_gadget_name_len() and
usbg_get_gadget_udc_len() to allow getting udc and name length.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Add getter's to avoid direct access to gadget structure
members.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Rename usbg_create_gadget() to usbg_create_vid_pid().
dd usbg_create_gadget() to allow gadget creation
with given attributes and strings. Add usbg_set_gadget_attrs()
which allow to set all attributes with one call. Add
usbg_set_gadget_strs() which allow to set all strings with
one call.
Gadget structure creation and initialization has been moved to
usbg_create_empty_gadget() to avoid copy-paste same code in
usbg_create_gadget_vid_pid() and usbg_create_gadget().
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Setting idVendor and idProduct was allowed only when
creating new gadget. Add usbg_set_gadget_vendor_id() and
usbg_set_gadget_product_id() to allow set those values
on existing gadget.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Gadget strings are not logically part of gadget, so should
be separated.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Rename all gadget attributes to be consistent with usb
standard and libusb. Change also field size and order
to allow direct memcpy from libusb_device_descriptor.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Gadget attributes should be placed in external structure
because they are almost that same as USB device descriptor.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Surround header with include guards to protect against
multiple inclusion.
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
|
|
Replace hard coded value of 256 by two constant
defines, USBG_MAX_STR_LENGTH and USBG_MAX_PATH_LENGTH
Define USBG_MAX_NAME_LENGTH for name[] array
Signed-off-by: Stanislaw Wadas <s.wadas@samsung.com>
|
|
Update email address for myself throughout the code.
Signed-off-by: Matt Porter <mporter@linaro.org>
|
|
Rename library to libusbg. Moves the API include to usbg.h and
accordingly changes all API prefixes to usbg_*().
Signed-off-by: Matt Porter <mporter@linaro.org>
|