diff options
author | Tushar Janefalkar <tusharj@codeaurora.org> | 2013-07-30 13:34:25 -0700 |
---|---|---|
committer | Kevin Tang <zhikait@codeaurora.org> | 2013-08-02 19:01:02 -0700 |
commit | e5e62728a24fc5c11f6140d11266017c79f1b77e (patch) | |
tree | 4f18401f21da8119cdf4817de8e07fb251715e9d /utils | |
parent | e7cafab287f46ec942c900e72447cae6810d4efd (diff) | |
download | gps-e5e62728a24fc5c11f6140d11266017c79f1b77e.tar.gz |
A mechanism to detect APQ chip set
The current changes to default the operation mode
to Standalone by the CHIP ID. A new method is used
for solving this issue.
CRs-Fixed: 510462
Change-Id: I58fd85e2c28bf824edeaef62660c62c34761bd37
Diffstat (limited to 'utils')
-rw-r--r-- | utils/loc_log.cpp | 35 | ||||
-rw-r--r-- | utils/loc_log.h | 2 | ||||
-rw-r--r-- | utils/loc_target.cpp | 46 | ||||
-rw-r--r-- | utils/loc_target.h | 28 |
4 files changed, 75 insertions, 36 deletions
diff --git a/utils/loc_log.cpp b/utils/loc_log.cpp index 533fabd..f755d70 100644 --- a/utils/loc_log.cpp +++ b/utils/loc_log.cpp @@ -39,6 +39,9 @@ #endif /* USE_GLIB */ #include "log_util.h" #include "platform_lib_includes.h" + +#define BUFFER_SIZE 120 + // Logging Improvements const char *loc_logger_boolStr[]={"False","True"}; const char VOID_RET[] = "None"; @@ -105,12 +108,12 @@ const char* log_succ_fail_string(int is_succ) //Target names loc_name_val_s_type target_name[] = { - NAME_VAL(TARGET_OTHER), - NAME_VAL(TARGET_APQ8064_STANDALONE), - NAME_VAL(TARGET_APQ8064_FUSION3), - NAME_VAL(TARGET_MPQ8064), - NAME_VAL(TARGET_MSM8930), - NAME_VAL(TARGET_APQ8030_STANDALONE) + NAME_VAL(GNSS_NONE), + NAME_VAL(GNSS_MSM), + NAME_VAL(GNSS_GSS), + NAME_VAL(GNSS_MDM), + NAME_VAL(GNSS_GRIFFON), + NAME_VAL(GNSS_UNKNOWN) }; static int target_name_num = sizeof(target_name)/sizeof(loc_name_val_s_type); @@ -128,11 +131,27 @@ RETURN VALUE The target name string ===========================================================================*/ -const char *loc_get_target_name(targetEnumType target) +const char *loc_get_target_name(unsigned int target) { - return loc_get_name_from_val(target_name, target_name_num, (long)target); + int index = 0; + char ret[BUFFER_SIZE]; + + index = getTargetGnssType(target); + if( index >= target_name_num || index < 0) + index = target_name_num - 1; + + if( (target & HAS_SSC) == HAS_SSC ) { + sprintf(ret, " %s with SSC", + loc_get_name_from_val(target_name, target_name_num, (long)index) ); + } + else { + sprintf(ret, " %s without SSC", + loc_get_name_from_val(target_name, target_name_num, (long)index) ); + } + return ret; } + /*=========================================================================== FUNCTION loc_get_time diff --git a/utils/loc_log.h b/utils/loc_log.h index abe29b7..82dc636 100644 --- a/utils/loc_log.h +++ b/utils/loc_log.h @@ -55,7 +55,7 @@ typedef struct const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask); const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value); const char* loc_get_msg_q_status(int status); -const char* loc_get_target_name(targetEnumType target); +const char* loc_get_target_name(unsigned int target); extern const char* log_succ_fail_string(int is_succ); diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp index 92eaa45..26df4cb 100644 --- a/utils/loc_target.cpp +++ b/utils/loc_target.cpp @@ -81,9 +81,9 @@ static int read_a_line(const char * file_path, char * line, int line_size) return result; } -targetEnumType get_target(void) +unsigned int get_target(void) { - targetEnumType target = TARGET_OTHER; + unsigned int target = TARGET_DEFAULT; char hw_platform[] = "/sys/devices/system/soc/soc0/hw_platform"; char id[] = "/sys/devices/system/soc/soc0/id"; @@ -92,27 +92,35 @@ targetEnumType get_target(void) char rd_hw_platform[LINE_LEN]; char rd_id[LINE_LEN]; char rd_mdm[LINE_LEN]; + char baseband[LINE_LEN]; + property_get("ro.baseband", baseband, ""); read_a_line(hw_platform, rd_hw_platform, LINE_LEN); read_a_line( id, rd_id, LINE_LEN); - 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)) - target = TARGET_APQ8064_FUSION3; - else if( (!memcmp(rd_id, APQ8064_ID_1, LENGTH(APQ8064_ID_1)) && IS_STR_END(rd_id[LENGTH(APQ8064_ID_1)])) || - (!memcmp(rd_id, APQ8064_ID_2, LENGTH(APQ8064_ID_2)) && IS_STR_END(rd_id[LENGTH(APQ8064_ID_2)])) ) - target = TARGET_APQ8064_STANDALONE; - else if((!memcmp(rd_id, APQ8030_ID_1, LENGTH(APQ8030_ID_1)) && IS_STR_END(rd_id[LENGTH(APQ8030_ID_1)]))) - target = TARGET_APQ8030_STANDALONE; + 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)]) ) + target = TARGET_MPQ; + else + target = 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)) + target = 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)])) ) + target = TARGET_MSM_NO_SSC; } - else if (!memcmp(rd_id, APQ8074_ID_1, LENGTH(APQ8074_ID_1)) && IS_STR_END(rd_id[LENGTH(APQ8074_ID_1)])) - target = TARGET_APQ8064_STANDALONE; - else if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1)) && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) ) - target = TARGET_MPQ8064; - 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)])) ) - target = TARGET_MSM8930; return target; } diff --git a/utils/loc_target.h b/utils/loc_target.h index 32c64b5..12cff1d 100644 --- a/utils/loc_target.h +++ b/utils/loc_target.h @@ -28,22 +28,34 @@ */ #ifndef LOC_TARGET_H #define LOC_TARGET_H +#define TARGET_SET(gnss,ssc) ( (gnss<<1)|ssc ) +#define TARGET_DEFAULT TARGET_SET(GNSS_MSM, HAS_SSC) +#define TARGET_MDM TARGET_SET(GNSS_MDM, HAS_SSC) +#define TARGET_APQ_SA TARGET_SET(GNSS_GSS, NO_SSC) +#define TARGET_MPQ TARGET_SET(GNSS_NONE,NO_SSC) +#define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC) +#define getTargetGnssType(target) (target>>1) #ifdef __cplusplus extern "C" { #endif +unsigned int get_target(void); + typedef enum { - TARGET_OTHER = 0, - TARGET_APQ8064_STANDALONE, - TARGET_APQ8064_FUSION3, - TARGET_MPQ8064, - TARGET_MSM8930, - TARGET_APQ8030_STANDALONE -}targetEnumType; + GNSS_NONE = 0, + GNSS_MSM, + GNSS_GSS, + GNSS_MDM, + GNSS_GRIFFON, + GNSS_UNKNOWN +}GNSS_TARGET; -targetEnumType get_target(void); +typedef enum { + NO_SSC = 0, + HAS_SSC +}SSC_TYPE; #ifdef __cplusplus } |