From cd266abf1de910775180fb813632d4cbe2023efe Mon Sep 17 00:00:00 2001 From: Marc Schink Date: Sat, 24 Oct 2015 21:47:10 +0200 Subject: [PATCH] Change API of jaylink_select_interface() --- libjaylink/libjaylink.h | 3 ++- libjaylink/target.c | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/libjaylink/libjaylink.h b/libjaylink/libjaylink.h index 4d0bb18..ac89e0c 100644 --- a/libjaylink/libjaylink.h +++ b/libjaylink/libjaylink.h @@ -419,7 +419,8 @@ JAYLINK_API int jaylink_set_speed(struct jaylink_device_handle *devh, JAYLINK_API int jaylink_get_speeds(struct jaylink_device_handle *devh, uint32_t *freq, uint16_t *div); JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh, - uint8_t interface); + enum jaylink_target_interface interface, + enum jaylink_target_interface *prev_interface); JAYLINK_API int jaylink_get_available_interfaces( struct jaylink_device_handle *devh, uint32_t *interfaces); JAYLINK_API int jaylink_get_selected_interface( diff --git a/libjaylink/target.c b/libjaylink/target.c index ea5ef65..8bf38e1 100644 --- a/libjaylink/target.c +++ b/libjaylink/target.c @@ -173,16 +173,20 @@ JAYLINK_API int jaylink_get_speeds(struct jaylink_device_handle *devh, * #JAYLINK_DEV_CAP_SELECT_TIF capability. * * @param[in,out] devh Device handle. - * @param[in] interface Target interface to select. See - * #jaylink_target_interface for valid values. + * @param[in] interface Target interface to select. + * @param[out] prev_interface Previously selected target interface on success, + * and undefined on failure. Can be NULL. * - * @return The previously selected target interface on success, or a negative - * error code on failure. + * @retval JAYLINK_OK Success. + * @retval JAYLINK_ERR_ARG Invalid arguments. + * @retval JAYLINK_ERR_TIMEOUT A timeout occurred. + * @retval JAYLINK_ERR Other error conditions. * * @see jaylink_get_caps() to retrieve device capabilities. */ JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh, - uint8_t interface) + enum jaylink_target_interface interface, + enum jaylink_target_interface *prev_interface) { int ret; struct jaylink_context *ctx; @@ -227,7 +231,10 @@ JAYLINK_API int jaylink_select_interface(struct jaylink_device_handle *devh, return JAYLINK_ERR; } - return tmp; + if (prev_interface) + *prev_interface = tmp; + + return JAYLINK_OK; } /** -- 2.11.4.GIT