2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录

         RK3288 Android7.1 华为移远域格4G模块调试记录

 

一、需要修改的和添加到文件如下图。

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第1张图片

二、给4G模块供电和reset。

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第2张图片

三、开机软件enable power和reset ic。

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第3张图片

四、lsusb确认是否识别到usb模块。

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第4张图片

五、kernel\drivers\usb\serial\option.c添加vid、pid。

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第5张图片

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第6张图片

六、ls /dev/tty*确认是否生成ttyUSB0、 ttyUSB1、 ttyUSB2、 ttyUSB3。 

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第7张图片

七、device\rockchip\common\BoardConfig.mk设置BOARD_HAVE_DONGEL :=true  BOARD_HAS_RK_4G_MODEM :=true

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第8张图片

八、device\rockchip\common\init.rk30board.rc start ril-daemon

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第9张图片

九、device\rockchip\common\init.connectivity.rc 设置/dev/ppp权限

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第10张图片

十、指定so库路径。注意有的模块需要设置生rild.libargs=-d /dev/ttyUSB2。

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第11张图片

十一、你可能遇到“原生系统存在SIM卡不识别问题,这是由于上层读取ICCID(通过SIM_IO接口)返回值解析错误导致;需要修改framework层逻辑”这样的问题。你需要打如下两个patch。

diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
old mode 100644
new mode 100755
index 50f90c1..6e7353e
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -91,6 +91,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import android.os.SystemProperties;

 /**
  * Implementation of the ITelephony interface.
@@ -2616,18 +2617,31 @@ public class PhoneInterfaceManager extends ITelephony.Stub {
     }
 
     private String getIccId(int subId) {
-        final Phone phone = getPhone(subId);
-        UiccCard card = phone == null ? null : phone.getUiccCard();
-        if (card == null) {
-            loge("getIccId: No UICC");
-            return null;
-        }
-        String iccId = card.getIccId();
-        if (TextUtils.isEmpty(iccId)) {
-            loge("getIccId: ICC ID is null or empty.");
-            return null;
-        }
-        return iccId;
+	    boolean config = SystemProperties.getBoolean("ro.radio.noril", false);
+	    if(config == true) {
+            final Phone phone = getPhone(subId);
+            UiccCard card = phone == null ? null : phone.getUiccCard();
+        	if (card == null) {
+            		loge("getIccId: No UICC");
+            		return null;
+        	}
+
+            	String iccId = card.getIccId();
+         
+            	if (TextUtils.isEmpty(iccId)) {
+            		loge("getIccId: ICC ID is null or empty.");
+            		return null;
+            	}
+	    	return iccId;
+	    }else{
+	 	String iccId ;
+	 	String sim_state = SystemProperties.get("gsm.sim.state");
+	 	if(sim_state.equals("READY")){
+	    		iccId = "89860002091070314495";
+	    		return iccId;
+	 	}else
+        		return null;
+	 }
     }
 
     @Override
diff --git a/src/java/com/android/internal/telephony/SubscriptionController.java b/src/java/com/android/internal/telephony/SubscriptionController.java
old mode 100644
new mode 100755
index 38b054b..4a15e09
--- a/src/java/com/android/internal/telephony/SubscriptionController.java
+++ b/src/java/com/android/internal/telephony/SubscriptionController.java
@@ -53,7 +53,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
-
+import android.os.SystemProperties;
/**
  * SubscriptionController to provide an inter-process communication to
  * access Sms in Icc.
@@ -185,7 +185,18 @@ public class SubscriptionController extends ISub.Stub {
     }
 
     private boolean isSubInfoReady() {
-        return sSlotIdxToSubId.size() > 0;
+	boolean config = SystemProperties.getBoolean("ro.radio.noril", false);
+	if(config == true) {
+        	return sSlotIdxToSubId.size() > 0;
+	} else {
+		String sim_state ;
+        	sim_state = SystemProperties.get("gsm.sim.state");
+        	if(sim_state.equals("READY")){
+			logd("sim_state is :" + sim_state);
+			return true;
+		}else
+			return false;
+		}
     }

     private SubscriptionController(Phone phone) {
@@ -1111,7 +1122,11 @@ public class SubscriptionController extends ISub.Stub {
         if (size == 0)
         {
             if (DBG) logd("[getSlotId]- size == 0, return SIM_NOT_INSERTED instead");
-            return SubscriptionManager.SIM_NOT_INSERTED;
+	    boolean config = SystemProperties.getBoolean("ro.radio.noril", false);
+	    if(config == true)
+            	return SubscriptionManager.SIM_NOT_INSERTED;
+	    else
+		return 0;
         }
 
         for (Entry entry: sSlotIdxToSubId.entrySet()) {
@@ -1208,8 +1223,12 @@ public class SubscriptionController extends ISub.Stub {
         }
 
         int size = sSlotIdxToSubId.size();
+	boolean config = SystemProperties.getBoolean("ro.radio.noril", false);
         if (size == 0) {
-            phoneId = mDefaultPhoneId;
+	    if(config == true) 
+            	phoneId = mDefaultPhoneId;
+	    else
+	    	phoneId = 0;
             if (DBG) logdl("[getPhoneId]- no sims, returning default phoneId=" + phoneId);
             return phoneId;
         }
@@ -1224,8 +1243,10 @@ public class SubscriptionController extends ISub.Stub {
                 return sim;
             }
         }
-
-        phoneId = mDefaultPhoneId;
+	if(config == true)
+        	phoneId = mDefaultPhoneId;
+	else
+		phoneId = 0;
         if (DBG) {
             logdl("[getPhoneId]- subId=" + subId + " not found return default phoneId=" + phoneId);
         }
@@ -1239,10 +1260,14 @@ public class SubscriptionController extends ISub.Stub {
         // but no connection came up on sprout with two sims.
         // We need to figure out why and hopefully remove DummySubsIds!!!
         int numSubs = getActiveSubInfoCountMax();
+	boolean config = SystemProperties.getBoolean("ro.radio.noril", false);
         if (numSubs > 0) {
             int[] dummyValues = new int[numSubs];
             for (int i = 0; i < numSubs; i++) {
-                dummyValues[i] = SubscriptionManager.DUMMY_SUBSCRIPTION_ID_BASE - slotIdx;
+		if(config == true)
+                	dummyValues[i] = SubscriptionManager.DUMMY_SUBSCRIPTION_ID_BASE - slotIdx;
+		else
+			dummyValues[i] = 0;
             }
             if (VDBG) {
                 logd("getDummySubIds: slotIdx=" + slotIdx
diff --git a/src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java b/src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java
old mode 100644
new mode 100755
index 1f68ff3..65b84b3
--- a/src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java
+++ b/src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java
@@ -58,7 +58,7 @@ import java.util.Map;
 
 import static android.Manifest.permission.READ_PHONE_STATE;
 import static android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE;
-
+import android.os.SystemProperties;
 /**
  *@hide
  */
@@ -400,12 +400,19 @@ public class SubscriptionInfoUpdater extends Handler {
             logd("onRecieve: IccRecords null");
             return;
         }
-        if (records.getIccId() == null) {
-            logd("onRecieve: IccID null");
-            return;
-        }
-        mIccId[slotId] = records.getIccId();
-
+	boolean config = SystemProperties.getBoolean("ro.radio.noril", false);
+	if(config == true) {
+        	if (records.getIccId() == null) {
+            		logd("onRecieve: IccID null");
+            		return;
+        	}
+        	mIccId[slotId] = records.getIccId();
+	}else{
+		String sim_state = SystemProperties.get("gsm.sim.state");
+		if(sim_state.equals("READY")){
+			mIccId[slotId] = "89860002091070314495";
+		}
+	}
         if (isAllIccIdQueryDone()) {
             updateSubscriptionInfoByIccId();
         }
@@ -537,21 +544,23 @@ public class SubscriptionInfoUpdater extends Handler {
         }
         logd("insertedSimCount = " + insertedSimCount);
 
-        int index = 0;
-        for (int i = 0; i < PROJECT_SIM_NUM; i++) {
-            if (mInsertSimState[i] == SIM_NOT_INSERT) {
-                continue;
-            }
-            index = 2;
-            for (int j = i + 1; j < PROJECT_SIM_NUM; j++) {
-                if (mInsertSimState[j] == SIM_NOT_CHANGE && mIccId[i].equals(mIccId[j])) {
-                    mInsertSimState[i] = 1;
-                    mInsertSimState[j] = index;
-                    index++;
-                }
-            }
-        }
-
+	boolean config = SystemProperties.getBoolean("ro.radio.noril", false);
+	if(config == true){
+        	int index = 0;
+        	for (int i = 0; i < PROJECT_SIM_NUM; i++) {
+            		if (mInsertSimState[i] == SIM_NOT_INSERT) {
+                		continue;
+            		}
+            		index = 2;
+            		for (int j = i + 1; j < PROJECT_SIM_NUM; j++) {
+                		if (mInsertSimState[j] == SIM_NOT_CHANGE && mIccId[i].equals(mIccId[j])) {
+                    			mInsertSimState[i] = 1;
+                    			mInsertSimState[j] = index;
+                    			index++;
+                		}
+            		}
+        	}
+	}
  ContentResolver contentResolver = mContext.getContentResolver();
         String[] oldIccId = new String[PROJECT_SIM_NUM];
         for (int i = 0; i < PROJECT_SIM_NUM; i++) {
@@ -575,12 +584,22 @@ public class SubscriptionInfoUpdater extends Handler {
                             + Integer.toString(oldSubInfo.get(0).getSubscriptionId()), null);
                 }
             } else {
-                if (mInsertSimState[i] == SIM_NOT_CHANGE) {
-                    // no SIM inserted last time, but there is one SIM inserted now
-                    mInsertSimState[i] = SIM_CHANGED;
-                }
-                oldIccId[i] = ICCID_STRING_FOR_NO_SIM;
-                logd("updateSubscriptionInfoByIccId: No SIM in slot " + i + " last time");
+		    if(config == true) {
+                	if (mInsertSimState[i] == SIM_NOT_CHANGE) {
+                    	// no SIM inserted last time, but there is one SIM inserted now
+                    	mInsertSimState[i] = SIM_CHANGED;
+                	}
+		    
+                	logd("updateSubscriptionInfoByIccId: No SIM in slot " + i + " last time");
+	    	    }else{
+		 	String simstate = SystemProperties.get("gsm.sim.state");
+		 	if(simstate.equals("READY")){
+			 	logd("updateSubscriptionInfoByIccId: new sim for 3G dongle");
+			 	logd("insertedSimCount = " + insertedSimCount);
+			 	mInsertSimState[i] = SIM_NEW;
+		 	}
+	    	    }
+		 	oldIccId[i] = ICCID_STRING_FOR_NO_SIM;
             }
         }

十二、Rild服务是在init.rc中开启,system\core\rootdir\init.rc,一般默认已经有了。

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第12张图片

十二、屏蔽hardware\ril\rild\rild.c里面的switchUser();因为这个折腾了好几天,吐血去

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第13张图片

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第14张图片

十二、到这了基本可以work了。MU909 EC25 CLM920都测试pass。

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第15张图片

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第16张图片

十三、整个调试过程需要用到资料。所有的修改在rk3288_android7.1_4G.patch里面。下载链接https://download.csdn.net/download/qq_37858386/14045761

2021-01-08 RK3288 Android7.1 华为移远域格4G模块调试记录_第17张图片

 

你可能感兴趣的:(Android)