From eb3de1983ab0f149abb98ae908d520c7284799c6 Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Mon, 22 Sep 2014 12:46:22 +0200 Subject: [PATCH] libusbgx: 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 --- include/usbg/usbg.h | 7 +++++++ src/usbg.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/usbg/usbg.h b/include/usbg/usbg.h index 57c9209..6adfe46 100644 --- a/include/usbg/usbg.h +++ b/include/usbg/usbg.h @@ -658,6 +658,13 @@ extern int usbg_cpy_function_instance(usbg_function *f, char *buf, size_t len); */ extern const char *usbg_get_function_type_str(usbg_function_type type); +/** + * @brief Lookup function type sutable for given name + * @param name Name of function + * @return Function type enum or negative error code + */ +extern int usbg_lookup_function_type(const char *name); + /* USB configurations allocation and configuration */ /** diff --git a/src/usbg.c b/src/usbg.c index 4d74a0d..6e0ce6f 100644 --- a/src/usbg.c +++ b/src/usbg.c @@ -310,7 +310,7 @@ const char *usbg_strerror(usbg_error e) return ret; } -static int usbg_lookup_function_type(const char *name) +int usbg_lookup_function_type(const char *name) { int i = 0; int max = sizeof(function_names)/sizeof(char *); -- 2.7.4