diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-10-08 11:33:14 +0900 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-10-10 14:35:49 +0200 |
commit | 9856478957f315b63cd273d8d76589bb38daf2de (patch) | |
tree | b1e576d8fe051feb706840493c98fabbf5527d8d | |
parent | b75ce22c33c824f61820091f06d4d9c0df7bcbed (diff) | |
download | connman-9856478957f315b63cd273d8d76589bb38daf2de.tar.gz connman-9856478957f315b63cd273d8d76589bb38daf2de.tar.bz2 connman-9856478957f315b63cd273d8d76589bb38daf2de.zip |
Add work around Intel WiMAX SDK API breakage
Release of the Intel WiMAX SDK 1.5 breaks source compatibility from
1.4 by removing WIMAX_API_DEVICE_STATUS_Connection_Idle.
Rather than fight a useless fight, work aronud it with an autoconf
test and a few (ugly) #ifdefs.
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | plugins/iwmx.c | 3 | ||||
-rw-r--r-- | plugins/iwmxsdk.c | 18 |
3 files changed, 27 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index aa61ba2a..25ada261 100644 --- a/configure.ac +++ b/configure.ac @@ -223,6 +223,15 @@ if (test "${enable_iwmx}" = "yes"); then PKG_CONFIG_PATH="" AC_SUBST(IWMXSDK_CFLAGS) AC_SUBST(IWMXSDK_LIBS) + CPPFLAGS_save=$CPPFLAGS + CPPFLAGS="$IWMXSDK_CFLAGS $CPPFLAGS" + AH_TEMPLATE([HAVE_IWMXSDK_STATUS_IDLE], + [WIMAX_API_DEVICE_STATUS_Connection_Idle is present]) + AC_CHECK_DECL(WIMAX_API_DEVICE_STATUS_Connection_Idle, + [AC_DEFINE([HAVE_IWMXSDK_STATUS_IDLE], [1], [])], + [], + [[#include <WiMaxType.h>]]) + CPPFLAGS=$CPPFLAGS_save fi AM_CONDITIONAL(IWMX, test "${enable_iwmx}" = "yes") diff --git a/plugins/iwmx.c b/plugins/iwmx.c index ccbd1d21..74e9786c 100644 --- a/plugins/iwmx.c +++ b/plugins/iwmx.c @@ -299,6 +299,7 @@ void __iwmx_cm_state_change(struct wmxsdk *wmxsdk, * For practical effects, some states are the same */ +#if HAVE_IWMXSDK_STATUS_IDLE /* Conection_Idle is the same as Data_Connected */ if (__old_status == WIMAX_API_DEVICE_STATUS_Connection_Idle) old_status = WIMAX_API_DEVICE_STATUS_Data_Connected; @@ -308,7 +309,7 @@ void __iwmx_cm_state_change(struct wmxsdk *wmxsdk, new_status = WIMAX_API_DEVICE_STATUS_Data_Connected; else new_status = __new_status; - +#endif /* #if HAVE_IWMXSDK_STATUS_IDLE */ /* Radio off: all are just RF_OFF_SW (the highest) */ switch (__old_status) { case WIMAX_API_DEVICE_STATUS_RF_OFF_HW_SW: diff --git a/plugins/iwmxsdk.c b/plugins/iwmxsdk.c index 60466e5c..7888c09a 100644 --- a/plugins/iwmxsdk.c +++ b/plugins/iwmxsdk.c @@ -98,8 +98,10 @@ const char *iwmx_sdk_dev_status_to_str(WIMAX_API_DEVICE_STATUS status) return "Connection in progress"; case WIMAX_API_DEVICE_STATUS_Data_Connected: return "Layer 2 connected"; +#if HAVE_IWMXSDK_STATUS_IDLE case WIMAX_API_DEVICE_STATUS_Connection_Idle: return "Idle connection"; +#endif /* #if HAVE_IWMXSDK_STATUS_IDLE */ default: return "unknown state"; } @@ -298,7 +300,9 @@ int iwmx_sdk_rf_state_set(struct wmxsdk *wmxsdk, WIMAX_API_RF_STATE rf_state) case WIMAX_API_DEVICE_STATUS_Scanning: case WIMAX_API_DEVICE_STATUS_Connecting: case WIMAX_API_DEVICE_STATUS_Data_Connected: +#if HAVE_IWMXSDK_STATUS_IDLE case WIMAX_API_DEVICE_STATUS_Connection_Idle: +#endif if (rf_state == WIMAX_API_RF_ON) { result = 0; DBG("radio is already on\n"); @@ -346,7 +350,10 @@ static void __iwmx_sdk_connect_cb(struct WIMAX_API_DEVICE_ID *device_id, status = iwmx_cm_status_get(wmxsdk); if (resp == WIMAX_API_CONNECTION_SUCCESS) { if (status != WIMAX_API_DEVICE_STATUS_Data_Connected - && status != WIMAX_API_DEVICE_STATUS_Connection_Idle) +#if HAVE_IWMXSDK_STATUS_IDLE + && status != WIMAX_API_DEVICE_STATUS_Connection_Idle +#endif + ) connman_error("wmxsdk: error: connect worked, but state" " didn't change (now it is %d [%s])\n", status, @@ -406,7 +413,9 @@ int iwmx_sdk_connect(struct wmxsdk *wmxsdk, struct connman_network *nw) result = -EINPROGRESS; goto error_cant_do; case WIMAX_API_DEVICE_STATUS_Data_Connected: +#if HAVE_IWMXSDK_STATUS_IDLE case WIMAX_API_DEVICE_STATUS_Connection_Idle: +#endif connman_error("wmxsdk: BUG? need to disconnect?\n"); result = -EINVAL; goto error_cant_do; @@ -459,7 +468,10 @@ static void __iwmx_sdk_disconnect_cb(struct WIMAX_API_DEVICE_ID *device_id, status = iwmx_cm_status_get(wmxsdk); if (resp == WIMAX_API_CONNECTION_SUCCESS) { if (status == WIMAX_API_DEVICE_STATUS_Data_Connected - || status == WIMAX_API_DEVICE_STATUS_Connection_Idle) +#if HAVE_IWMXSDK_STATUS_IDLE + || status == WIMAX_API_DEVICE_STATUS_Connection_Idle +#endif + ) connman_error("wmxsdk: error: disconnect worked, " "but state didn't change (now it is " "%d [%s])\n", status, @@ -510,7 +522,9 @@ int iwmx_sdk_disconnect(struct wmxsdk *wmxsdk) goto error_cant_do; case WIMAX_API_DEVICE_STATUS_Connecting: case WIMAX_API_DEVICE_STATUS_Data_Connected: +#if HAVE_IWMXSDK_STATUS_IDLE case WIMAX_API_DEVICE_STATUS_Connection_Idle: +#endif break; default: g_assert(1); |