diff --git a/loc_api/libloc_api_50001/Android.mk b/loc_api/libloc_api_50001/Android.mk index a1488a02..8f5d389b 100644 --- a/loc_api/libloc_api_50001/Android.mk +++ b/loc_api/libloc_api_50001/Android.mk @@ -74,7 +74,8 @@ LOCAL_SHARED_LIBRARIES := \ libloc_eng \ libloc_core \ libgps.utils \ - libdl + libdl \ + libmdmdetect LOCAL_SRC_FILES += \ loc.cpp \ @@ -91,7 +92,8 @@ endif ## Includes LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ - $(TARGET_OUT_HEADERS)/libloc_core + $(TARGET_OUT_HEADERS)/libloc_core \ + $(TARGET_OUT_HEADERS)/libmdmdetect/inc LOCAL_PRELINK_MODULE := false LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 0b032f0b..8a4d6756 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -44,7 +44,13 @@ #include #include #include - +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +#include +#ifdef __cplusplus +} +#endif /* __cplusplus */ using namespace loc_core; //Globals defns @@ -121,6 +127,9 @@ const GpsNiInterface sLocEngNiInterface = loc_ni_respond, }; +// For shutting down MDM in fusion devices +static int mdm_fd = -1; + static void loc_agps_ril_init( AGpsRilCallbacks* callbacks ); static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct); static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid); @@ -241,6 +250,7 @@ SIDE EFFECTS static int loc_init(GpsCallbacks* callbacks) { int retVal = -1; + int i = 0; ENTRY_LOG(); LOC_API_ADAPTER_EVENT_MASK_T event; @@ -279,6 +289,43 @@ static int loc_init(GpsCallbacks* callbacks) loc_afw_data.adapter->mAgpsEnabled = !loc_afw_data.adapter->hasAgpsExt(); loc_afw_data.adapter->mCPIEnabled = !loc_afw_data.adapter->hasCPIExt(); + if(retVal) { + LOC_LOGE("loc_eng_init() fail!"); + goto err; + } + + LOC_LOGD("loc_eng_init() success!"); + if (mdm_fd < 0) { + struct dev_info modem_info; + memset(&modem_info, 0, sizeof(struct dev_info)); + if(get_system_info(&modem_info) != RET_SUCCESS) { + LOC_LOGE("%s:%d]: Error: get_system_info returned error\n", + __func__, __LINE__); + goto err; + } + for(i=0; i= 0) - { - close(gss_fd); - gss_fd = -1; - LOC_LOGD("GSS shutdown.\n"); + if (mdm_fd >= 0) { + LOC_LOGD("closing the powerup node"); + close(mdm_fd); + mdm_fd = -1; + LOC_LOGD("finished closing the powerup node"); + } else { + LOC_LOGD("powerup node has not been opened yet."); } -*/ EXIT_LOG(%s, VOID_RET); }