diff options
author | Kevin Tang <zhikait@codeaurora.org> | 2016-02-04 10:03:40 -0800 |
---|---|---|
committer | Kevin Tang <zhikait@codeaurora.org> | 2016-02-04 10:03:40 -0800 |
commit | 1aeb6bad84c0afd0e032c3d4d7e33959501e18f1 (patch) | |
tree | 3518628e958d4e939b72e1d32a1618e6056e653d /utils/loc_target.cpp | |
parent | db367819e26af1a6b8cb013e0dcda575d242c732 (diff) | |
parent | 89f41a9b1602ce82ea6272f2a3be8595fb4b6058 (diff) | |
download | gps-1aeb6bad84c0afd0e032c3d4d7e33959501e18f1.tar.gz |
Merging m_master changes to oe_master
Merging LA m_master changes to oe_master
merge head - 89f41a9b1602ce82ea6272f2a3be8595fb4b6058
Change-Id: I9010487f1d6f3d2e30a568b441bc5f9b719a0fb1
Diffstat (limited to 'utils/loc_target.cpp')
-rw-r--r-- | utils/loc_target.cpp | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp index b5a6297..30c040c 100644 --- a/utils/loc_target.cpp +++ b/utils/loc_target.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2012,2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2015, 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 @@ -53,11 +53,15 @@ #define STR_SURF "Surf" #define STR_MTP "MTP" #define STR_APQ "apq" +#define STR_AUTO "auto" #define IS_STR_END(c) ((c) == '\0' || (c) == '\n' || (c) == '\r') #define LENGTH(s) (sizeof(s) - 1) #define GPS_CHECK_NO_ERROR 0 #define GPS_CHECK_NO_GPS_HW 1 -#define QCA1530_DETECT_TIMEOUT 30 +/* 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" @@ -99,7 +103,7 @@ static int read_a_line(const char * file_path, char * line, int line_size) */ static bool is_qca1530(void) { - static const char qca1530_property_name[] = "persist.qca1530"; + static const char qca1530_property_name[] = "sys.qca1530"; bool res = false; int ret, i; char buf[PROPERTY_VALUE_MAX]; @@ -142,6 +146,34 @@ static bool is_qca1530(void) 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) +{ + if(baseband && (array_length >= PROPERTY_VALUE_MAX)) { + property_get("ro.baseband", baseband, ""); + LOC_LOGD("%s:%d]: Baseband: %s\n", __func__, __LINE__, baseband); + } + else { + LOC_LOGE("%s:%d]: NULL parameter or array length less than PROPERTY_VALUE_MAX\n", + __func__, __LINE__); + } +} + +/*The character array passed to this function should have length + of atleast PROPERTY_VALUE_MAX*/ +void loc_get_platform_name(char *platform_name, int array_length) +{ + if(platform_name && (array_length >= PROPERTY_VALUE_MAX)) { + property_get("ro.board.platform", platform_name, ""); + LOC_LOGD("%s:%d]: Target name: %s\n", __func__, __LINE__, platform_name); + } + else { + LOC_LOGE("%s:%d]: Null parameter or array length less than PROPERTY_VALUE_MAX\n", + __func__, __LINE__); + } +} + unsigned int loc_get_target(void) { if (gTarget != (unsigned int)-1) @@ -164,7 +196,8 @@ unsigned int loc_get_target(void) goto detected; } - platform_lib_abstraction_property_get("ro.baseband", baseband, ""); + loc_get_target_baseband(baseband, sizeof(baseband)); + if (!access(hw_platform, F_OK)) { read_a_line(hw_platform, rd_hw_platform, LINE_LEN); } else { @@ -175,8 +208,13 @@ unsigned int loc_get_target(void) } else { read_a_line(id_dep, rd_id, LINE_LEN); } - + if( !memcmp(baseband, STR_AUTO, LENGTH(STR_AUTO)) ) + { + gTarget = TARGET_AUTO; + goto detected; + } if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){ + if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1)) && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) ) gTarget = TARGET_MPQ; @@ -207,3 +245,17 @@ detected: LOC_LOGD("HAL: %s returned %d", __FUNCTION__, gTarget); return gTarget; } + +/*Reads the property ro.lean to identify if this is a lean target + Returns: + 0 if not a lean and mean target + 1 if this is a lean and mean target +*/ +int loc_identify_lean_target() +{ + int ret = 0; + char lean_target[PROPERTY_VALUE_MAX]; + property_get("ro.lean", lean_target, ""); + LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target); + return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX)); +} |