summaryrefslogtreecommitdiff
path: root/include/usbg
diff options
context:
space:
mode:
authorKrzysztof Opasiak <k.opasiak@samsung.com>2014-02-14 13:17:58 +0100
committerKrzysztof Opasiak <k.opasiak@samsung.com>2014-02-19 21:17:19 +0100
commit48af9fbf1225352108c6d61e2c1da017eb2b4405 (patch)
treee0f03a198278b4b63a3195b1614ca656f306a134 /include/usbg
parented9919d88476621b5dbfff418efa9836834041e9 (diff)
downloadlibusbg-48af9fbf1225352108c6d61e2c1da017eb2b4405.tar.gz
libusbg-48af9fbf1225352108c6d61e2c1da017eb2b4405.tar.bz2
libusbg-48af9fbf1225352108c6d61e2c1da017eb2b4405.zip
libusbg: Add getter for gadget name and udc.
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>
Diffstat (limited to 'include/usbg')
-rw-r--r--include/usbg/usbg.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/usbg/usbg.h b/include/usbg/usbg.h
index 1ffc75d..f471255 100644
--- a/include/usbg/usbg.h
+++ b/include/usbg/usbg.h
@@ -303,6 +303,22 @@ extern struct gadget_attrs *usbg_get_gadget_attrs(struct gadget *g,
struct gadget_attrs *g_attrs);
/**
+ * @brief Get gadget name length
+ * @param g Gadget which name length should be returned
+ * @return Length of name string or -1 if error occurred.
+ */
+extern size_t usbg_get_gadget_name_len(struct gadget *g);
+
+/**
+ * @brieg Get gadget name
+ * @param b Pointer to gadget
+ * @param buf Buffer where name should be copied
+ * @param len Length of given buffer
+ * @return Pointer to destination or NULL if error occurred.
+ */
+extern char *usbg_get_gadget_name(struct gadget *g, char *buf, size_t len);
+
+/**
* @brief Set the USB gadget vendor id
* @param g Pointer to gadget
* @param idVendor USB device vendor id
@@ -479,6 +495,24 @@ extern void usbg_enable_gadget(struct gadget *g, char *udc);
*/
extern void usbg_disable_gadget(struct gadget *g);
+/**
+ * @brief Get gadget name length
+ * @param g Gadget which name length should be returned
+ * @return Length of name string or -1 if error occurred.
+ * @note If gadget isn't enabled on any udc returned size is 0.
+ */
+extern size_t usbg_get_gadget_udc_len(struct gadget *g);
+
+/**
+ * @brieg Get name of udc to which gadget is binded
+ * @param b Pointer to gadget
+ * @param buf Buffer where udc name should be copied
+ * @param len Length of given buffer
+ * @return Pointer to destination or NULL if error occurred.
+ * @note If gadget isn't enabled on any udc returned string is empty.
+ */
+extern char *usbg_get_gadget_udc(struct gadget *g, char *buf, size_t len);
+
/*
* USB function-specific attribute configuration
*/