rk3288 android7.1.2 4g模块调试(四)

rk3288 android7.1.2 多4g模块gps功能调试

1、修改gps库名,每个4g模块单独对应一个gps库

gps.default.so->gps.me3630.so

2、在rild服务中添加sys.gps.module系统属性,标志当前获取的4g模块

hardware/ril/rild/rild.c

@@ -50,6 +50,7 @@
 #define REFERENCE_RIL_SIMCOM_SIM7600CE_PATH "/system/lib/libreference-ril-sim7600ce.so"
 #define REFERENCE_RIL_HUAWEI_ME909S_PATH "/system/lib/libreference-ril-me909s.so"
 #define REFERENCE_RIL_NEOWAY_N720_PATH "/system/lib/libreference-ril-n720.so"
+#define LIB_GPS_PROPERTY   "sys.gps.module"
 static void usage(const char *argv0) {
     fprintf(stderr, "Usage: %s -l  [-- ]\n", argv0);
     exit(EXIT_FAILURE);
@@ -218,6 +219,9 @@ int main(int argc, char **argv) {
 		case ZTE_MODEM:
 		case ZTE_ME3630:
 		rilLibPath = REFERENCE_RIL_ZTE_ME3630_PATH;
+                /*by set sys.gps.module property to let gps jni choose the right gps lib*/
+                property_set(LIB_GPS_PROPERTY, "me3630");
+                ALOGD("setprop sys.gps.module for me3630 gps");
 		break;
 
 		case SIMCOM_SIM7600:
@@ -230,6 +234,9 @@ int main(int argc, char **argv) {
 
 		case NEOWAY_N720:
 		rilLibPath = REFERENCE_RIL_NEOWAY_N720_PATH;
+                /*by set sys.gps.module property to let gps jni choose the right gps lib*/
+                property_set(LIB_GPS_PROPERTY, "n720");
+                ALOGD("setprop sys.gps.module for n720 gps");
                 break;

3、根据4g模块标志,指定调用的gps库

hardware/libhardware/hardware.c

@@ -189,6 +190,32 @@ int hw_get_module_by_class(const char *class_id, const char *inst,
         }
     }
 
+    if(strncmp(class_id, "gps", 3) == 0){
+            ALOGD("gps-jni start found gps lib now!");
+            char gps_prop_name[PATH_MAX] = {0};
+            int chance = 10;/*10 tiems try*/
+            do{
+                    chance--;
+                    ALOGE("gps-jni property sys.gps.module not exit !");
+                    sleep(1);
+            }while((property_get("sys.gps.module", gps_prop_name, NULL) <= 0) && (chance >= 0));
+            if(strncmp(gps_prop_name, "n720", 4) == 0){
+                    if (hw_module_exists(path, sizeof(path), name, "n720") == 0) {
+                            ALOGD("gps-jni found neoway n720 gps lib!");
+                            goto found;
+                    }
+            }else if(strncmp(gps_prop_name, "me3630", 6 ) == 0){
+                    if (hw_module_exists(path, sizeof(path), name, "me3630") == 0) {
+                            ALOGD("gps-jni found me3630 gps lib!");
+                            goto found;
+                    }
+            }else {
+                    ALOGE("gps-jni no property gps lib found, will use gps.defualt.so");
+            }
+    }+    /*add by hjh, use to find right gps lib for different 4g&gps modules end*/
+

你可能感兴趣的:(android,hardware)