diff options
author | Krzysztof Opasiak <k.opasiak@samsung.com> | 2014-04-02 18:49:57 +0200 |
---|---|---|
committer | Krzysztof Opasiak <k.opasiak@samsung.com> | 2014-04-03 15:38:39 +0200 |
commit | 5ec5d264f52199cbeb7e77c87470fdd87d6ed34d (patch) | |
tree | 6bce16ed577e3c1d432fa8aa154375fdc4753176 /include/usbg | |
parent | 4bbea573b6784842503ca4abb869e13c78ced2fc (diff) | |
download | libusbg-5ec5d264f52199cbeb7e77c87470fdd87d6ed34d.tar.gz libusbg-5ec5d264f52199cbeb7e77c87470fdd87d6ed34d.tar.bz2 libusbg-5ec5d264f52199cbeb7e77c87470fdd87d6ed34d.zip |
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>
Diffstat (limited to 'include/usbg')
-rw-r--r-- | include/usbg/usbg.h | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/include/usbg/usbg.h b/include/usbg/usbg.h index fadbe07..1407f10 100644 --- a/include/usbg/usbg.h +++ b/include/usbg/usbg.h @@ -37,6 +37,7 @@ #define DEFAULT_UDC NULL #define LANG_US_ENG 0x0409 +#define DEFAULT_CONFIG_LABEL "config" #define USBG_MAX_STR_LENGTH 256 #define USBG_MAX_PATH_LENGTH PATH_MAX @@ -266,10 +267,14 @@ extern usbg_function *usbg_get_function(usbg_gadget *g, /** * @brief Get a configuration by name * @param g Pointer to gadget - * @param name Name of the configuration + * @param id Identify of configuration + * @param label Configuration label. If not NULL this function will return + * valid value only if configuration with given id exist and has this label. + * If NULL this function will return config with given id (if such exist) + * and ignore this param. * @return Pointer to config or NULL if a matching config isn't found */ -extern usbg_config *usbg_get_config(usbg_gadget *g, const char *name); +extern usbg_config *usbg_get_config(usbg_gadget *g, int id, const char *label); /* USB gadget allocation and configuration */ @@ -491,31 +496,39 @@ extern const char *usbg_get_function_type_str(usbg_function_type type); /** * @brief Create a new USB gadget configuration * @param g Pointer to gadget - * @param name Name of configuration + * @param id Identify of configuration + * @param label configuration label, if NULL, default is used * @param c_attrs Configuration attributes to be set * @param c_strs Configuration strings to be set * @param c Pointer to be filled with pointer to configuration * @note Given strings are assumed to be in US English * @return 0 on success usbg_error if error occurred */ -extern int usbg_create_config(usbg_gadget *g, char *name, +extern int usbg_create_config(usbg_gadget *g, int id, const char *label, usbg_config_attrs *c_attrs, usbg_config_strs *c_strs, usbg_config **c); /** - * @brief Get config name length - * @param c Config which name length should be returned - * @return Length of name string or usbg_error if error occurred. + * @brief Get config label length + * @param c Config which label length should be returned + * @return Length of label or usbg_error if error occurred. */ -extern size_t usbg_get_config_name_len(usbg_config *c); +extern size_t usbg_get_config_label_len(usbg_config *c); /** - * @brieg Get config name + * @brieg Get config label * @param c Pointer to config - * @param buf Buffer where name should be copied + * @param buf Buffer where label should be copied * @param len Length of given buffer * @return 0 on success or usbg_error if error occurred. */ -extern int usbg_get_config_name(usbg_config *c, char *buf, size_t len); +extern int usbg_get_config_label(usbg_config *c, char *buf, size_t len); + +/** + * @brieg Get config id + * @param c Pointer to config + * @return Configuration id or usbg_error if error occurred. + */ +extern int usbg_get_config_id(usbg_config *c); /** * @brief Set the USB configuration attributes |