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 @@
             <instance>default</instance>
         </interface>
     </hal>
+       <hal format="hidl">
+               <name>android.hardware.radio</name>
+               <transport>hwbinder</transport>
+               <version>1.1</version>
+               <interface>
+               <name>IRadio</name>
+               <instance>slot1</instance>
+               </interface>
+       </hal>
+       <hal format="hidl">
+               <name>android.hardware.radio.deprecated</name>
+               <transport>hwbinder</transport>
+               <version>1.0</version>
+               <interface>
+               <name>IOemHook</name>
+               <instance>slot1</instance>
+               </interface>
+       </hal>
     <sepolicy>
         <version>26.0</version>
     </sepolicy>
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 @@
     <!-- the 6th element indicates boot-time dependency-met value. -->
     <string-array translatable="false" name="networkAttributes">
         <item>"wifi,1,1,1,-1,true"</item>
+               <item>"mobile,0,0,0,-1,true"</item>
+               <item>"mobile_mms,2,0,2,60000,true"</item>
+        <item>"mobile_supl,3,0,2,60000,true"</item>
+        <item>"mobile_dun,4,0,2,60000,true"</item>
+        <item>"mobile_hipri,5,0,3,60000,true"</item>
+        <item>"mobile_fota,10,0,2,60000,true"</item>
+        <item>"mobile_ims,11,0,2,60000,true"</item>
+        <item>"mobile_cbs,12,0,2,60000,true"</item>
         <item>"ethernet,9,9,9,-1,true"</item>
     </string-array>
 
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 @@
     <fraction name="def_window_transition_scale">100%</fraction>
     <bool name="def_haptic_feedback">true</bool>
 
-    <bool name="def_bluetooth_on">true</bool>
+    <bool name="def_bluetooth_on">false</bool>
     <bool name="def_wifi_display_on">false</bool>
     <bool name="def_install_non_market_apps">false</bool>
     <bool name="def_package_verifier_enable">true</bool>
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 vpn 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 vpn 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模式

原因就是少加了<item>"mobile,0,0,0,-1,true"</item>这句,导致拨号应用异常崩溃后进入recover模式,完整应该加下面这段。

+++ b/rk322x_box/overlay/frameworks/base/core/res/res/values/config.xml
@@ -28,6 +28,14 @@
     <!-- the 6th element indicates boot-time dependency-met value. -->
     <string-array translatable="false" name="networkAttributes">
         <item>"wifi,1,1,1,-1,true"</item>
+               <item>"mobile,0,0,0,-1,true"</item>
+               <item>"mobile_mms,2,0,2,60000,true"</item>
+        <item>"mobile_supl,3,0,2,60000,true"</item>
+        <item>"mobile_dun,4,0,2,60000,true"</item>
+        <item>"mobile_hipri,5,0,3,60000,true"</item>
+        <item>"mobile_fota,10,0,2,60000,true"</item>
+        <item>"mobile_ims,11,0,2,60000,true"</item>
+        <item>"mobile_cbs,12,0,2,60000,true"</item>

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
相关推荐
m0_7482400210 分钟前
Chromium 中chrome.webRequest扩展接口定义c++
网络·c++·chrome
終不似少年遊*18 分钟前
华为云计算HCIE笔记05
网络·华为云·云计算·学习笔记·hcie·认证·hcs
蜜獾云32 分钟前
docker 安装雷池WAF防火墙 守护Web服务器
linux·运维·服务器·网络·网络安全·docker·容器
小林熬夜学编程2 小时前
【Linux网络编程】第十四弹---构建功能丰富的HTTP服务器:从状态码处理到服务函数扩展
linux·运维·服务器·c语言·网络·c++·http
Hacker_Fuchen2 小时前
天融信网络架构安全实践
网络·安全·架构
上海运维Q先生2 小时前
面试题整理15----K8s常见的网络插件有哪些
运维·网络·kubernetes
ProtonBase2 小时前
如何从 0 到 1 ,打造全新一代分布式数据架构
java·网络·数据库·数据仓库·分布式·云原生·架构
fantasy_arch12 小时前
CPU性能优化-磁盘空间和解析时间
网络·性能优化
是Dream呀13 小时前
Python从0到100(七十八):神经网络--从0开始搭建全连接网络和CNN网络
网络·python·神经网络
kaixin_learn_qt_ing14 小时前
了解RPC
网络·网络协议·rpc