Merge "MDM shutdown for Fusion device"

This commit is contained in:
Linux Build Service Account 2014-02-22 14:51:00 -08:00 committed by Gerrit - the friendly Code Review server
commit 95e0001d57
2 changed files with 60 additions and 11 deletions

View file

@ -74,7 +74,8 @@ LOCAL_SHARED_LIBRARIES := \
libloc_eng \ libloc_eng \
libloc_core \ libloc_core \
libgps.utils \ libgps.utils \
libdl libdl \
libmdmdetect
LOCAL_SRC_FILES += \ LOCAL_SRC_FILES += \
loc.cpp \ loc.cpp \
@ -91,7 +92,8 @@ endif
## Includes ## Includes
LOCAL_C_INCLUDES:= \ LOCAL_C_INCLUDES:= \
$(TARGET_OUT_HEADERS)/gps.utils \ $(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_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw

View file

@ -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 * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -44,7 +44,13 @@
#include <errno.h> #include <errno.h>
#include <LocDualContext.h> #include <LocDualContext.h>
#include <cutils/properties.h> #include <cutils/properties.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <mdm_detect.h>
#ifdef __cplusplus
}
#endif /* __cplusplus */
using namespace loc_core; using namespace loc_core;
//Globals defns //Globals defns
@ -121,6 +127,9 @@ const GpsNiInterface sLocEngNiInterface =
loc_ni_respond, 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_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_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct);
static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid); 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) static int loc_init(GpsCallbacks* callbacks)
{ {
int retVal = -1; int retVal = -1;
int i = 0;
ENTRY_LOG(); ENTRY_LOG();
LOC_API_ADAPTER_EVENT_MASK_T event; 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->mAgpsEnabled = !loc_afw_data.adapter->hasAgpsExt();
loc_afw_data.adapter->mCPIEnabled = !loc_afw_data.adapter->hasCPIExt(); 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<modem_info.num_modems; i++) {
if((modem_info.mdm_list[i].type == MDM_TYPE_EXTERNAL) &&
(modem_info.mdm_list[i].powerup_node)) {
LOC_LOGD("%s:%d]: powerup_node: %s", __func__, __LINE__,
modem_info.mdm_list[i].powerup_node);
mdm_fd = open(modem_info.mdm_list[i].powerup_node, O_RDONLY);
if (mdm_fd < 0) {
LOC_LOGE("Error: %s open failed: %s\n",
modem_info.mdm_list[i].powerup_node, strerror(errno));
} else {
LOC_LOGD("%s opens success!", modem_info.mdm_list[i].powerup_node);
}
}
else {
LOC_LOGD("%s:%d]: powerup_node not present in mdm %d",
__func__, __LINE__, i);
}
}
} else {
LOC_LOGD("powerup_node has been opened before");
}
err:
EXIT_LOG(%d, retVal); EXIT_LOG(%d, retVal);
return retVal; return retVal;
} }
@ -306,14 +353,14 @@ static void loc_cleanup()
gps_loc_cb = NULL; gps_loc_cb = NULL;
gps_sv_cb = NULL; gps_sv_cb = NULL;
/* if (mdm_fd >= 0) {
if (gss_fd >= 0) LOC_LOGD("closing the powerup node");
{ close(mdm_fd);
close(gss_fd); mdm_fd = -1;
gss_fd = -1; LOC_LOGD("finished closing the powerup node");
LOC_LOGD("GSS shutdown.\n"); } else {
LOC_LOGD("powerup node has not been opened yet.");
} }
*/
EXIT_LOG(%s, VOID_RET); EXIT_LOG(%s, VOID_RET);
} }