api: Add altsetting getter 33/147633/1 accepted/tizen/4.0/unified/20170905.175359 submit/tizen_4.0/20170905.071639 tizen_4.0.IoT.p1_release tizen_4.0.m2_release
authorlokilee73 <changjoo.lee@samsung.com>
Tue, 5 Sep 2017 07:12:37 +0000 (16:12 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Tue, 5 Sep 2017 07:12:43 +0000 (16:12 +0900)
Change-Id: I55de3d0aa3f7963ae29277b05e4d9a16e1dee582
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
include/usb_host.h
src/usb_host.c

index 12563457b18759065f23836260ccb8a25dc0956c..ac6c91a7a0ad7e2ee1691d037c8d9e9c0941fb49 100755 (executable)
@@ -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 76dc5b135b1376e276b2986e952038ecf99db765..079862a5a4d08cf6a4db0f113b3a491bd063a2a5 100755 (executable)
@@ -1552,6 +1552,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())