api: Add altsetting getter 88/135488/2 accepted/tizen/unified/20170905.184638 submit/tizen/20170905.070056
authorPaweł Szewczyk <p.szewczyk@samsung.com>
Thu, 22 Jun 2017 13:44:37 +0000 (15:44 +0200)
committerPaweł Szewczyk <p.szewczyk@samsung.com>
Thu, 24 Aug 2017 09:03:14 +0000 (11:03 +0200)
Change-Id: I5e5da4a42e1a8640987cc9fe509fc0216a1a6768
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
include/usb_host.h
src/usb_host.c

index 12563457b18759065f23836260ccb8a25dc0956c..ac6c91a7a0ad7e2ee1691d037c8d9e9c0941fb49 100644 (file)
@@ -835,6 +835,19 @@ int usb_host_interface_get_endpoint(usb_host_interface_h interface, int ep_index
  */
 int usb_host_interface_set_altsetting(usb_host_interface_h interface, int altsetting);
 
+/**
+ * @ingroup CAPI_USB_HOST_INTERFACE_MODULE
+ * @brief Gets current alternative setting from an interface.
+ * @since_tizen 4.0
+ * @param[in] interface Interface handle
+ * @param[out] altsetting Index of alternative setting set for the given interface
+ * @return 0 on success, otherwise a negative error value
+ * @retval #USB_HOST_ERROR_NONE Successful
+ * @retval #USB_HOST_ERROR_NOT_SUPPORTED Not supported
+ * @retval #USB_HOST_ERROR_INVALID_PARAMETER Invalid parameter was passed
+ */
+int usb_host_interface_get_altsetting(usb_host_interface_h interface, int *altsetting);
+
 /**
  * @ingroup CAPI_USB_HOST_INTERFACE_MODULE
  * @brief Gets string describing an interface.
index 14f185bda484ec38161f38e39140b49e8fd72941..4c1c1045c334b131368e66bc8e59045a2b95459a 100644 (file)
@@ -1558,6 +1558,20 @@ int usb_host_interface_set_altsetting(usb_host_interface_h interface, int altset
        return 0;
 }
 
+int usb_host_interface_get_altsetting(usb_host_interface_h interface, int *altsetting)
+{
+       if (!usb_host_feature_enabled())
+               return USB_HOST_ERROR_NOT_SUPPORTED;
+
+       if (!interface || !altsetting) {
+               _E("Invalid parameter was passed");
+               return USB_HOST_ERROR_INVALID_PARAMETER;
+       }
+
+       *altsetting = interface->altsetting;
+       return 0;
+}
+
 int usb_host_config_get_interface(usb_host_config_h config, int interface_index, usb_host_interface_h *interface)
 {
        if (!usb_host_feature_enabled())