RK3229_Android9.0_Box 4G模块EC200A调试

0、kernel修改

这部分完全可以参考Linux的移植:

RK3588 EC200A-CN【4G模块】调试_rk ec200a-cn-CSDN博客

1、修改device/rockchip/rk322x

diff --git a/device.mk b/device.mk
index ec6bfaa..e7c32d1 100755
--- a/device.mk
+++ b/device.mk
@@ -105,6 +105,8 @@ endif
 #add Rockchip properties here
 #
 PRODUCT_PROPERTY_OVERRIDES += \
+       vendor.rild.libpath=/vendor/lib/libquectel-ril.so \
+       vendor.rild.libargs=-d /dev/ttyUSB2 \
     wifi.interface=wlan0 \
     ro.audio.monitorOrientation=true \
     vendor.hwc.compose_policy=6 \
@@ -159,3 +161,12 @@ PRODUCT_COPY_FILES += \
 
 PRODUCT_COPY_FILES += \
     frameworks/av/media/libeffects/data/audio_effects.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_effects.xml
+
+PRODUCT_COPY_FILES += \
+       device/rockchip/rk322x/RIL_32bits/chat:system/bin/chat \
+       device/rockchip/rk322x/RIL_32bits/ip-down:system/etc/ppp/ip-down \
+       device/rockchip/rk322x/RIL_32bits/ip-up:system/etc/ppp/ip-up \
+       device/rockchip/rk322x/RIL_32bits/libquectel-ril.so:vendor/lib/libquectel-ril.so
+
+PRODUCT_COPY_FILES += \
+       device/rockchip/rk322x/RIL_32bits/apns-conf.xml:system/etc/apns-conf.xml
diff --git a/rk322x_box/manifest.xml b/rk322x_box/manifest.xml
index dd00d51..df8c03f 100755
--- a/rk322x_box/manifest.xml
+++ b/rk322x_box/manifest.xml
@@ -201,6 +201,24 @@
             default
         
     
+       
+               android.hardware.radio
+               hwbinder
+               1.1
+               
+               IRadio
+               slot1
+               
+       
+       
+               android.hardware.radio.deprecated
+               hwbinder
+               1.0
+               
+               IOemHook
+               slot1
+               
+       
     
         26.0
     
diff --git a/rk322x_box/overlay/frameworks/base/core/res/res/values/config.xml b/rk322x_box/overlay/frameworks/base/core/res/res/values/config.xml
index e2d7ab9..e671269 100755
--- a/rk322x_box/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/rk322x_box/overlay/frameworks/base/core/res/res/values/config.xml
@@ -28,6 +28,14 @@
     
     
         "wifi,1,1,1,-1,true"
+               "mobile,0,0,0,-1,true"
+               "mobile_mms,2,0,2,60000,true"
+        "mobile_supl,3,0,2,60000,true"
+        "mobile_dun,4,0,2,60000,true"
+        "mobile_hipri,5,0,3,60000,true"
+        "mobile_fota,10,0,2,60000,true"
+        "mobile_ims,11,0,2,60000,true"
+        "mobile_cbs,12,0,2,60000,true"
         "ethernet,9,9,9,-1,true"
     
 
diff --git a/rk322x_box/system.prop b/rk322x_box/system.prop
index 385fdfd..80ce58f 100755
--- a/rk322x_box/system.prop
+++ b/rk322x_box/system.prop
@@ -2,13 +2,13 @@
 # system.prop
 #
 
-#rild.libpath=/system/lib/libreference-ril.so
-#rild.libargs=-d /dev/ttyUSB2
+vendor.rild.libpath=/vendor/lib/libquectel-ril.so
+vendor.rild.libargs=-d /dev/ttyUSB2
 # Default ecclist
 ro.ril.ecclist=112,911
 wifi.interface=wlan0
-rild.libpath=/system/lib/libril-rk29-dataonly.so
-rild.libargs=-d /dev/ttyACM0
+#rild.libpath=/system/lib/libril-rk29-dataonly.so
+#rild.libargs=-d /dev/ttyACM0
 persist.tegra.nvmmlite = 1
 persist.sys.boot.check=false
 ro.audio.monitorOrientation=true

2、改device/rockchip/common

diff --git a/BoardConfig.mk b/BoardConfig.mk
old mode 100644
new mode 100755
index 3f3cc8e3..a039215a
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -365,7 +365,7 @@ BOARD_FORCE_UDISK_VISIBLE ?= true
 BOARD_DISABLE_SAFE_MODE ?= true
 
 #enable 3g dongle
-BOARD_HAVE_DONGLE ?= false
+BOARD_HAVE_DONGLE ?= true
 
 #for boot and shutdown animation ringing
 BOOT_SHUTDOWN_ANIMATION_RINGING ?= false
diff --git a/device.mk b/device.mk
old mode 100644
new mode 100755
index 4c698b75..eeff1474
--- a/device.mk
+++ b/device.mk
@@ -1048,3 +1048,9 @@ BOARD_TWRP_ENABLE ?= false
 #Build with UiMode Config
 PRODUCT_COPY_FILES += \
        device/rockchip/common/uimode/package_uimode_config.xml:vendor/etc/package_uimode_config.xml
+
+PRODUCT_PACKAGES += \
+       Telecom \
+       TeleService \
+       TelephonyProvider \
+       CarrierConfig
diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts
old mode 100644
new mode 100755
index 3ffc7763..aa86f177
--- a/sepolicy/vendor/file_contexts
+++ b/sepolicy/vendor/file_contexts
@@ -1,5 +1,5 @@
 /dev/ttyFIQ[0-9]*    u:object_r:serial_device:s0
-/dev/ttyUSB[0-9]*    u:object_r:tty_device:s0
+#/dev/ttyUSB[0-9]*    u:object_r:tty_device:s0
 /dev/mali[0-9]       u:object_r:gpu_device:s0
 /dev/mali            u:object_r:gpu_device:s0
 /dev/ddr_freq        u:object_r:ddr_device:s0
@@ -155,3 +155,16 @@
 
 #for healthd
 /sys/devices/virtual/power_supply(/.*)?                              u:object_r:sysfs_power:s0
+
+/dev/ttyUSB[0-9] u:object_r:radio_device:s0
+/dev/ttyACM[0-9] u:object_r:radio_device:s0
+/dev/cdc-wdm[0-9] u:object_r:radio_device:s0
+/dev/qcqmi[0-9] u:object_r:radio_device:s0
+/vendor/bin/hw/rild u:object_r:rild_exec:s0
+/dev/socket/rildOemHook u:object_r:rild_socket:s0
+#PCIe
+/dev/mhi_DUN u:object_r:radio_device:s0
+/dev/mhi_DIAG u:object_r:radio_device:s0
+/dev/mhi_BHI u:object_r:radio_device:s0
+/dev/mhi_LOOPBACK u:object_r:radio_device:s0
+/dev/mhi_QMI0 u:object_r:radio_device:s0
diff --git a/sepolicy/vendor/rild.te b/sepolicy/vendor/rild.te
index eb3df7de..99c395b0 100644
--- a/sepolicy/vendor/rild.te
+++ b/sepolicy/vendor/rild.te
@@ -3,3 +3,5 @@ allow rild ppp_device:chr_file ioctl;
 allow rild rootfs:dir { open read };
 allow rild system_file:file execute_no_trans;
 allow rild vendor_file:file execute_no_trans;
+allow rild self:packet_socket { create bind write read };
+
diff --git a/ueventd.rockchip.rc b/ueventd.rockchip.rc
index 0fa485a9..b8901f46 100755
--- a/ueventd.rockchip.rc
+++ b/ueventd.rockchip.rc
@@ -207,3 +207,18 @@
 
 # for sensors
 /dev/input/event*    0666   input system
+
+# for quectel prot
+/dev/ttyUSB*              0660   radio        radio
+/dev/ttyACM*              0660   radio        radio
+/dev/cdc-wdm*             0660   radio        radio
+/dev/qcqmi*               0660   radio        radio
+/dev/cdc-acm*             0660   radio        radio
+
+#PCIe
+/dev/mhi_DUN              0660   radio        radio
+/dev/mhi_DIAG             0660   radio        radio
+/dev/mhi_BHI              0660   radio        radio
+/dev/mhi_LOOPBACK         0660   radio        radio
+/dev/mhi_QMI0             0660   radio        radio
+

3、修改frameworks/base

diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml
index 275142ad83f..7c5c143f9a1 100755
--- a/packages/SettingsProvider/res/values/defaults.xml
+++ b/packages/SettingsProvider/res/values/defaults.xml
@@ -36,7 +36,7 @@
     100%
     true
 
-    true
+    false
     false
     false
     true
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index 49fbd8f06b0..d6b88614747 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -164,7 +164,7 @@ public interface RILConstants {
     int NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA  = 21; /*TD-SCDMA,EvDo,CDMA,GSM/WCDMA*/
     int NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = 22; /* TD-SCDMA/LTE/GSM/WCDMA, CDMA, and EvDo */
     int PREFERRED_NETWORK_MODE = Integer.parseInt(TelephonyManager.getTelephonyProperty(0,
-            "ro.telephony.default_network", Integer.toString(NETWORK_MODE_WCDMA_PREF)));
+            "ro.telephony.default_network", Integer.toString(NETWORK_MODE_LTE_GSM_WCDMA)));
 
     int BAND_MODE_UNSPECIFIED = 0;      //"unspecified" (selected by baseband automatically)

4、修改hardware/ril

diff --git a/rild/rild.rc b/rild/rild.rc
index 1a8019f..8960b26 100644
--- a/rild/rild.rc
+++ b/rild/rild.rc
@@ -1,5 +1,8 @@
-service vendor.ril-daemon /vendor/bin/hw/rild
-    class main
-    user root
-    group radio  cache inet misc audio log readproc wakelock
-    capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW
+
+service ril-daemon /vendor/bin/hw/rild -l /vendor/lib/libquectel-ril.so
+        class main
+        user root
+        group radio  cache inet misc audio log readproc wakelock
+        capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW
+

5、修改packages/services/Telephony
 

diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
old mode 100644
new mode 100755
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
old mode 100644
new mode 100755
index 9025405b5..c5f7e8726
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -246,6 +246,21 @@ public class PhoneInterfaceManager extends ITelephony.Stub {
         }
     }
 
+       @Override
+    public void carrierActionResetAll(int subId) {
+        enforceModifyPermission();
+        final Phone phone = getPhone(subId);
+        if (phone == null) {
+            loge("carrierAction: ResetAll fails with invalid sibId: " + subId);
+            return;
+        }
+        try {
+            //phone.carrierActionResetAll();
+        } catch (Exception e) {
+            Log.e(LOG_TAG, "carrierAction: ResetAll fails. Exception ex=" + e);
+        }
+    }
+
     /**
      * A request object to use for transmitting data to an ICC.
      */

6、遇到的问题

1、不断印下面这个

init: starting service 'ril-daemon'...
[  444.744250] init: Service 'ril-daemon' (pid 1651) exited with status 1
[  444.744308] init: Sending signal 9 to service 'ril-daemon' (pid 1651) process group...
[  444.744453] libprocessgroup: Successfully killed process cgroup uid 0 pid 1651 in 0ms
解决方法就是更换ril库,换成ndk专用的
2、开机几十秒后进入recover模式
原因就是少加了"mobile,0,0,0,-1,true"这句,导致拨号应用异常崩溃后进入recover模式,完整应该加下面这段。

+++ b/rk322x_box/overlay/frameworks/base/core/res/res/values/config.xml
@@ -28,6 +28,14 @@
     
     
         "wifi,1,1,1,-1,true"
+               "mobile,0,0,0,-1,true"
+               "mobile_mms,2,0,2,60000,true"
+        "mobile_supl,3,0,2,60000,true"
+        "mobile_dun,4,0,2,60000,true"
+        "mobile_hipri,5,0,3,60000,true"
+        "mobile_fota,10,0,2,60000,true"
+        "mobile_ims,11,0,2,60000,true"
+        "mobile_cbs,12,0,2,60000,true"

3、缺少apn


+PRODUCT_COPY_FILES += \
+       device/rockchip/rk322x/RIL_32bits/apns-conf.xml:system/etc/apns-conf.xml

4、缺少拨号应用,应该在下面加入

+PRODUCT_PACKAGES += \
+       Telecom \
+       TeleService \
+       TelephonyProvider \
+       CarrierConfig

你可能感兴趣的:(网络)