From: Paweł Szewczyk Date: Thu, 22 Jun 2017 13:44:37 +0000 (+0200) Subject: api: Add altsetting getter X-Git-Tag: submit/tizen/20170905.070056^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ea56bc381b26a1f2e4c8086bae4d17d1ffac341;p=platform%2Fcore%2Fapi%2Fusb-host.git api: Add altsetting getter Change-Id: I5e5da4a42e1a8640987cc9fe509fc0216a1a6768 Signed-off-by: Paweł Szewczyk --- diff --git a/include/usb_host.h b/include/usb_host.h index 1256345..ac6c91a 100644 --- a/include/usb_host.h +++ b/include/usb_host.h @@ -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. diff --git a/src/usb_host.c b/src/usb_host.c index 14f185b..4c1c104 100644 --- a/src/usb_host.c +++ b/src/usb_host.c @@ -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())