From a2cafde5bda030a2b82a07ca7d4f07d0cbf5110c Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Tue, 20 Jun 2017 15:09:19 -0700 Subject: [PATCH] Fixed loc_get_target() and removed 1530 support it is a stale feature, been disconnected for years. Also tightend up loc_get_target(), as it currently doesn't get produce a result, but also return -1, which would cause the next call and every call going through the entire function every time it is called. Change-Id: I348d99f690eb8973730112d5edeb870b2be2c6c8 CRs-Fixed: 2062169 --- utils/loc_log.cpp | 1 - utils/loc_target.cpp | 115 ++++++++----------------------------------- utils/loc_target.h | 2 - 3 files changed, 20 insertions(+), 98 deletions(-) diff --git a/utils/loc_log.cpp b/utils/loc_log.cpp index 23b28944..9fad9e6e 100644 --- a/utils/loc_log.cpp +++ b/utils/loc_log.cpp @@ -109,7 +109,6 @@ static const loc_name_val_s_type target_name[] = NAME_VAL(GNSS_MSM), NAME_VAL(GNSS_GSS), NAME_VAL(GNSS_MDM), - NAME_VAL(GNSS_QCA1530), NAME_VAL(GNSS_AUTO), NAME_VAL(GNSS_UNKNOWN) }; diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp index 7e475eb0..cf429321 100644 --- a/utils/loc_target.cpp +++ b/utils/loc_target.cpp @@ -61,12 +61,6 @@ #define LENGTH(s) (sizeof(s) - 1) #define GPS_CHECK_NO_ERROR 0 #define GPS_CHECK_NO_GPS_HW 1 -/* When system server is started, it uses 20 seconds as ActivityManager - * timeout. After that it sends SIGSTOP signal to process. - */ -#define QCA1530_DETECT_TIMEOUT 15 -#define QCA1530_DETECT_PRESENT "yes" -#define QCA1530_DETECT_PROGRESS "detect" static unsigned int gTarget = (unsigned int)-1; @@ -92,63 +86,6 @@ static int read_a_line(const char * file_path, char * line, int line_size) return result; } -/*! - * \brief Checks if QCA1530 is avalable. - * - * Function verifies if qca1530 SoC is configured on the device. The test is - * based on property value. For 1530 scenario, the value shall be one of the - * following: "yes", "no", "detect". All other values are treated equally to - * "no". When the value is "detect" the system waits for SoC detection to - * finish before returning result. - * - * \retval true - QCA1530 is available. - * \retval false - QCA1530 is not available. - */ -static bool is_qca1530(void) -{ - static const char qca1530_property_name[] = "sys.qca1530"; - bool res = false; - int ret, i; - char buf[PROPERTY_VALUE_MAX]; - - memset(buf, 0, sizeof(buf)); - - for (i = 0; i < QCA1530_DETECT_TIMEOUT; ++i) - { - ret = platform_lib_abstraction_property_get(qca1530_property_name, buf, NULL); - if (ret < 0) - { - LOC_LOGV( "qca1530: property %s is not accessible, ret=%d", - qca1530_property_name, - ret); - - break; - } - - LOC_LOGV( "qca1530: property %s is set to %s", - qca1530_property_name, - buf); - - if (!memcmp(buf, QCA1530_DETECT_PRESENT, - sizeof(QCA1530_DETECT_PRESENT))) - { - res = true; - break; - } - if (!memcmp(buf, QCA1530_DETECT_PROGRESS, - sizeof(QCA1530_DETECT_PROGRESS))) - { - LOC_LOGV("qca1530: SoC detection is in progress."); - sleep(1); - continue; - } - break; - } - - LOC_LOGD("qca1530: detected=%s", res ? "true" : "false"); - return res; -} - /*The character array passed to this function should have length of atleast PROPERTY_VALUE_MAX*/ void loc_get_target_baseband(char *baseband, int array_length) @@ -209,11 +146,6 @@ unsigned int loc_get_target(void) char baseband[LINE_LEN]; char rd_auto_platform[LINE_LEN]; - if (is_qca1530()) { - gTarget = TARGET_QCA1530; - goto detected; - } - loc_get_target_baseband(baseband, sizeof(baseband)); if (!access(hw_platform, F_OK)) { @@ -242,42 +174,35 @@ unsigned int loc_get_target(void) } if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) || - !memcmp(baseband, STR_SDC, LENGTH(STR_SDC)) ){ + !memcmp(baseband, STR_SDC, LENGTH(STR_SDC)) ) { if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1)) && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) ) gTarget = TARGET_NO_GNSS; else gTarget = TARGET_APQ_SA; - } - else { - if( (!memcmp(rd_hw_platform, STR_LIQUID, LENGTH(STR_LIQUID)) - && IS_STR_END(rd_hw_platform[LENGTH(STR_LIQUID)])) || - (!memcmp(rd_hw_platform, STR_SURF, LENGTH(STR_SURF)) - && IS_STR_END(rd_hw_platform[LENGTH(STR_SURF)])) || - (!memcmp(rd_hw_platform, STR_MTP, LENGTH(STR_MTP)) - && IS_STR_END(rd_hw_platform[LENGTH(STR_MTP)]))) { - - if (!read_a_line( mdm, rd_mdm, LINE_LEN)) - gTarget = TARGET_MDM; - } - - else if( (!memcmp(rd_id, MSM8930_ID_1, LENGTH(MSM8930_ID_1)) - && IS_STR_END(rd_id[LENGTH(MSM8930_ID_1)])) || - (!memcmp(rd_id, MSM8930_ID_2, LENGTH(MSM8930_ID_2)) - && IS_STR_END(rd_id[LENGTH(MSM8930_ID_2)])) ) - gTarget = TARGET_MSM_NO_SSC; - - else if ( !memcmp(baseband, STR_MSM, LENGTH(STR_MSM)) || - !memcmp(baseband, STR_SDM, LENGTH(STR_SDM)) ) - gTarget = TARGET_DEFAULT; - - else - gTarget = TARGET_UNKNOWN; + } else if (((!memcmp(rd_hw_platform, STR_LIQUID, LENGTH(STR_LIQUID)) + && IS_STR_END(rd_hw_platform[LENGTH(STR_LIQUID)])) || + (!memcmp(rd_hw_platform, STR_SURF, LENGTH(STR_SURF)) + && IS_STR_END(rd_hw_platform[LENGTH(STR_SURF)])) || + (!memcmp(rd_hw_platform, STR_MTP, LENGTH(STR_MTP)) + && IS_STR_END(rd_hw_platform[LENGTH(STR_MTP)]))) && + !read_a_line( mdm, rd_mdm, LINE_LEN)) { + gTarget = TARGET_MDM; + } else if( (!memcmp(rd_id, MSM8930_ID_1, LENGTH(MSM8930_ID_1)) + && IS_STR_END(rd_id[LENGTH(MSM8930_ID_1)])) || + (!memcmp(rd_id, MSM8930_ID_2, LENGTH(MSM8930_ID_2)) + && IS_STR_END(rd_id[LENGTH(MSM8930_ID_2)])) ) { + gTarget = TARGET_MSM_NO_SSC; + } else if ( !memcmp(baseband, STR_MSM, LENGTH(STR_MSM)) || + !memcmp(baseband, STR_SDM, LENGTH(STR_SDM)) ) { + gTarget = TARGET_DEFAULT; + } else { + gTarget = TARGET_UNKNOWN; } detected: - LOC_LOGD("HAL: %s returned %d", __FUNCTION__, gTarget); + LOC_LOGW("HAL: %s returned %d", __FUNCTION__, gTarget); return gTarget; } diff --git a/utils/loc_target.h b/utils/loc_target.h index 69395db7..47a67d91 100644 --- a/utils/loc_target.h +++ b/utils/loc_target.h @@ -34,7 +34,6 @@ #define TARGET_APQ_SA TARGET_SET(GNSS_GSS, NO_SSC) #define TARGET_NO_GNSS TARGET_SET(GNSS_NONE, NO_SSC) #define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC) -#define TARGET_QCA1530 TARGET_SET(GNSS_QCA1530, NO_SSC) #define TARGET_AUTO TARGET_SET(GNSS_AUTO, NO_SSC) #define TARGET_UNKNOWN TARGET_SET(GNSS_UNKNOWN, NO_SSC) #define getTargetGnssType(target) (target>>1) @@ -69,7 +68,6 @@ typedef enum { GNSS_MSM, GNSS_GSS, GNSS_MDM, - GNSS_QCA1530, GNSS_AUTO, GNSS_UNKNOWN }GNSS_TARGET;