From: lokilee73 Date: Tue, 5 Sep 2017 07:12:37 +0000 (+0900) Subject: api: Add altsetting getter X-Git-Tag: submit/tizen_4.0/20170905.071639^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8d6eacdc75b46a3ccd2e0c202c8d824933458736;p=platform%2Fcore%2Fapi%2Fusb-host.git api: Add altsetting getter Change-Id: I55de3d0aa3f7963ae29277b05e4d9a16e1dee582 Signed-off-by: lokilee73 --- diff --git a/include/usb_host.h b/include/usb_host.h index 1256345..ac6c91a 100755 --- 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 76dc5b1..079862a 100755 --- a/src/usb_host.c +++ b/src/usb_host.c @@ -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())