summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--loc_api/libloc_api_50001/loc.cpp8
-rw-r--r--utils/loc_log.cpp35
-rw-r--r--utils/loc_log.h2
-rw-r--r--utils/loc_target.cpp46
-rw-r--r--utils/loc_target.h28
5 files changed, 79 insertions, 40 deletions
diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp
index 63cf8f4..4ada907 100644
--- a/loc_api/libloc_api_50001/loc.cpp
+++ b/loc_api/libloc_api_50001/loc.cpp
@@ -205,7 +205,7 @@ const GpsInterface* gps_get_hardware_interface ()
// for gps.c
extern "C" const GpsInterface* get_gps_interface()
{
- targetEnumType target = TARGET_OTHER;
+ unsigned int target = TARGET_DEFAULT;
if (NULL == loc_afw_data.context) {
loc_eng_read_config();
@@ -214,8 +214,8 @@ extern "C" const GpsInterface* get_gps_interface()
target = get_target();
LOC_LOGD("Target name check returned %s", loc_get_target_name(target));
- //APQ8064 and APQ8030
- if((target == TARGET_APQ8064_STANDALONE) || (target == TARGET_APQ8030_STANDALONE)) {
+ //APQ8064
+ if( getTargetGnssType(target) == GNSS_GSS ) {
gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
gss_fd = open("/dev/gss", O_RDONLY);
if (gss_fd < 0) {
@@ -226,7 +226,7 @@ extern "C" const GpsInterface* get_gps_interface()
}
}
//MPQ8064
- else if(target == TARGET_MPQ8064) {
+ else if( getTargetGnssType(target) == GNSS_NONE) {
LOC_LOGE("No GPS HW on this target (MPQ8064). Not returning interface");
return NULL;
}
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
}