【RK3288 Android6 T2pro 支持移远和有方4G模块切换】

文章目录

【RK3288 Android6 T2pro 支持移远和有方4G模块切换】

需求

原来的UI板只支持 移远的4G模块,现在需要兼容移远和有方的4G模块

方案

通过修改user_services.sh,通过识别4G模块,来加载不同的ril 库文件

patch

device_rk3288

bash 复制代码
From 40caa97a2e0eff89ada4953cf71864f4d21e84d0 Mon Sep 17 00:00:00 2001
From: wugt <wugt@keenon.com>
Date: Thu, 14 Sep 2023 11:17:57 +0800
Subject: [PATCH 07/17] feat: compitible for lte module of EC20 and Neoway

Change-Id: I336733348476422bd167fd676a48a9ebba468567
Signed-off-by: wugt <wugt@keenon.com>
---
 init.rc                    |   2 +-
 init.t5pro.rc              |   2 +-
 neoway/libreference-ril.so | Bin 0 -> 198764 bytes
 rk3288.mk                  |   2 ++
 scripts/startup_rild.sh    |  51 +++++++++++++++++++++++++++++++++++++++++++++
 scripts/user_service.sh    |   2 +-
 6 files changed, 56 insertions(+), 3 deletions(-)
 create mode 100644 neoway/libreference-ril.so
 create mode 100644 scripts/startup_rild.sh

diff --git a/init.rc b/init.rc
index e5863b5..0833b57 100644
--- a/init.rc
+++ b/init.rc
@@ -604,7 +604,7 @@ service debuggerd /system/bin/debuggerd
 service debuggerd64 /system/bin/debuggerd64
     class main
 
-service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so
+service ril-daemon /system/bin/rild
     class main
     socket rild stream 660 root radio
     socket rild-debug stream 660 radio system
diff --git a/init.t5pro.rc b/init.t5pro.rc
index 762b184..7a79ca7 100644
--- a/init.t5pro.rc
+++ b/init.t5pro.rc
@@ -610,7 +610,7 @@ service debuggerd /system/bin/debuggerd
 service debuggerd64 /system/bin/debuggerd64
     class main
 
-service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so
+service ril-daemon /system/bin/rild
     class main
     socket rild stream 660 root radio
     socket rild-debug stream 660 radio system
diff --git a/neoway/libreference-ril.so b/neoway/libreference-ril.so
new file mode 100644
index 0000000000000000000000000000000000000000..12d29763dacd3bd4fcd3c4b730dde64de492293f
GIT binary patch

diff --git a/rk3288.mk b/rk3288.mk
index 332f255..a9e8b25 100644
--- a/rk3288.mk
+++ b/rk3288.mk
@@ -33,10 +33,12 @@ PRODUCT_COPY_FILES += device/rockchip/rk3288/scripts/common.sh:system/bin/common
 PRODUCT_COPY_FILES += device/rockchip/rk3288/scripts/save_log.sh:system/bin/save_log.sh
 PRODUCT_COPY_FILES += device/rockchip/rk3288/scripts/save_kmsg.sh:system/bin/save_kmsg.sh
 PRODUCT_COPY_FILES += device/rockchip/rk3288/scripts/network_debug_tool.sh:system/bin/network_debug_tool.sh
+PRODUCT_COPY_FILES += device/rockchip/rk3288/scripts/startup_rild.sh:system/bin/startup_rild.sh
 PRODUCT_COPY_FILES += device/rockchip/rk3288/EC20/libreference-ril.so:system/lib/libreference-ril.so
 PRODUCT_COPY_FILES += device/rockchip/rk3288/EC20/ip-down:system/etc/ppp/ip-down
 PRODUCT_COPY_FILES += device/rockchip/rk3288/EC20/ip-up:system/etc/ppp/ip-up
 PRODUCT_COPY_FILES += device/rockchip/rk3288/EC20/chat:system/bin/chat
+PRODUCT_COPY_FILES += device/rockchip/rk3288/neoway/libreference-ril.so:system/lib/libreference-ril-neoway.so
 
 # Get the long list of APNs
 PRODUCT_COPY_FILES += vendor/rockchip/common/phone/etc/apns-full-conf.xml:system/etc/apns-conf.xml
diff --git a/scripts/startup_rild.sh b/scripts/startup_rild.sh
new file mode 100644
index 0000000..7fb44be
--- /dev/null
+++ b/scripts/startup_rild.sh
@@ -0,0 +1,51 @@
+#!/system/bin/sh
+
+printlog() {
+    echo [`date`] "$@" >> /mnt/user_service.log
+}
+
+MODULE_EC20=EC20
+MODULE_NEOWAY=NEOWAY
+MODULE_DEFAULT=$MODULE_EC20
+NEOWAY_ID=2949:8700
+
+start() {
+    # check Neoway LTE module vid:pid
+    module_type=$MODULE_DEFAULT
+    lsusb |grep "${NEOWAY_ID}"
+    [ $? -eq 0 ] && module_type=$MODULE_NEOWAY
+
+    libpath_old=`getprop rild.libpath`
+    if [ "$module_type" = "$MODULE_NEOWAY" ]; then
+        libpath_new=/system/lib/libreference-ril-neoway.so
+        libargs="-d /dev/ttyACM1"
+    else
+        libpath_new=/system/lib/libreference-ril.so
+        libargs="-d /dev/ttyUSB2"
+    fi
+
+    printlog "libpath old:${libpath_old} new:${libpath_new}"
+    printlog "libargs:${libargs}"
+
+    path_changed=0
+    if [ "x${libpath_old}" != "x${libpath_new}" ]; then
+        setprop rild.libpath ${libpath_new}
+        setprop rild.libargs "${libargs}"
+        path_changed=1
+    fi
+
+    if [ "x$(pidof /system/bin/rild)" != "x" ]; then
+        if [ ${path_changed} -eq 0 ]; then
+            printlog "rild already started."
+            exit 0
+        fi
+        printlog "stop ril-daemon"
+        setprop ctl.stop ril-daemon
+        sleep 1
+    fi
+    printlog "start ril-daemon"
+    setprop ctl.start ril-daemon
+}
+
+start
+
diff --git a/scripts/user_service.sh b/scripts/user_service.sh
index 834f591..b02c1eb 100644
--- a/scripts/user_service.sh
+++ b/scripts/user_service.sh
@@ -1,6 +1,6 @@
 #!/system/bin/sh
 
-echo -e "AT+QCFG=\"dbgctl\",0\r\n" > /dev/ttyUSB2
+[ -f /dev/ttyUSB2 ] && echo -e "AT+QCFG=\"dbgctl\",0\r\n" > /dev/ttyUSB2
 lte_ifname="ppp0" # can be ppp0 or usb0
 
 printlog() {
-- 
2.7.4
bash 复制代码
From e1b48b3c282db724003457b33776d73e1bfcb834 Mon Sep 17 00:00:00 2001
From: wugt <wugt@keenon.com>
Date: Tue, 26 Sep 2023 10:32:54 +0800
Subject: [PATCH 08/17] update: update libreference-ril.so for neoway

Change-Id: Ifb83d0e9a18bf3906667365b62c17330ee56898c
Signed-off-by: wugt <wugt@keenon.com>
---
 neoway/libreference-ril.so | Bin 198764 -> 198764 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/neoway/libreference-ril.so b/neoway/libreference-ril.so
bash 复制代码
From 3f190d8546b8262a3d80f3c62cbb370e4e71a374 Mon Sep 17 00:00:00 2001
From: wugt <wugt@keenon.com>
Date: Mon, 9 Oct 2023 15:57:03 +0800
Subject: [PATCH 09/17] update: update for 4G

Change-Id: I82e34f9c95db0f1a07447cef4ecc9d059e2617dc
Signed-off-by: wugt <wugt@keenon.com>
---
 N720V5/libreference-ril.so | Bin 0 -> 198764 bytes
 neoway/libreference-ril.so | Bin 198764 -> 0 bytes
 rk3288.mk                  |   2 +-
 scripts/startup_rild.sh    |  79 +++++++++++++++++++++------------------------
 4 files changed, 38 insertions(+), 43 deletions(-)
 create mode 100644 N720V5/libreference-ril.so
 delete mode 100644 neoway/libreference-ril.so

diff --git a/N720V5/libreference-ril.so b/N720V5/libreference-ril.so
new file mode 100644

diff --git a/rk3288.mk b/rk3288.mk
index a9e8b25..55ee905 100644
--- a/rk3288.mk
+++ b/rk3288.mk
@@ -38,7 +38,7 @@ PRODUCT_COPY_FILES += device/rockchip/rk3288/EC20/libreference-ril.so:system/lib
 PRODUCT_COPY_FILES += device/rockchip/rk3288/EC20/ip-down:system/etc/ppp/ip-down
 PRODUCT_COPY_FILES += device/rockchip/rk3288/EC20/ip-up:system/etc/ppp/ip-up
 PRODUCT_COPY_FILES += device/rockchip/rk3288/EC20/chat:system/bin/chat
-PRODUCT_COPY_FILES += device/rockchip/rk3288/neoway/libreference-ril.so:system/lib/libreference-ril-neoway.so
+PRODUCT_COPY_FILES += device/rockchip/rk3288/N720V5/libreference-ril.so:system/lib/libreference-ril-N720V5.so
 
 # Get the long list of APNs
 PRODUCT_COPY_FILES += vendor/rockchip/common/phone/etc/apns-full-conf.xml:system/etc/apns-conf.xml
diff --git a/scripts/startup_rild.sh b/scripts/startup_rild.sh
index 7fb44be..5656b3f 100644
--- a/scripts/startup_rild.sh
+++ b/scripts/startup_rild.sh
@@ -5,47 +5,42 @@ printlog() {
 }
 
 MODULE_EC20=EC20
-MODULE_NEOWAY=NEOWAY
+MODULE_N720V5=N720V5
 MODULE_DEFAULT=$MODULE_EC20
-NEOWAY_ID=2949:8700
-
-start() {
-    # check Neoway LTE module vid:pid
-    module_type=$MODULE_DEFAULT
-    lsusb |grep "${NEOWAY_ID}"
-    [ $? -eq 0 ] && module_type=$MODULE_NEOWAY
-
-    libpath_old=`getprop rild.libpath`
-    if [ "$module_type" = "$MODULE_NEOWAY" ]; then
-        libpath_new=/system/lib/libreference-ril-neoway.so
-        libargs="-d /dev/ttyACM1"
-    else
-        libpath_new=/system/lib/libreference-ril.so
-        libargs="-d /dev/ttyUSB2"
-    fi
-
-    printlog "libpath old:${libpath_old} new:${libpath_new}"
-    printlog "libargs:${libargs}"
-
-    path_changed=0
-    if [ "x${libpath_old}" != "x${libpath_new}" ]; then
-        setprop rild.libpath ${libpath_new}
-        setprop rild.libargs "${libargs}"
-        path_changed=1
+N720V5_ID=2949:8700
+
+# check N720V5 LTE module vid:pid
+module_type=$MODULE_DEFAULT
+lsusb |grep "${N720V5_ID}"
+[ $? -eq 0 ] && module_type=$MODULE_N720V5
+
+libpath_old=`getprop rild.libpath`
+if [ "$module_type" = "$MODULE_N720V5" ]; then
+    libpath_new=/system/lib/libreference-ril-N720V5.so
+    libargs="-d /dev/ttyACM1"
+else
+    libpath_new=/system/lib/libreference-ril.so
+    libargs="-d /dev/ttyUSB2"
+fi
+
+printlog "libpath old:${libpath_old} new:${libpath_new}"
+printlog "libargs:${libargs}"
+
+path_changed=0
+if [ "x${libpath_old}" != "x${libpath_new}" ]; then
+    setprop rild.libpath ${libpath_new}
+    setprop rild.libargs "${libargs}"
+    path_changed=1
+fi
+
+if [ "x$(pidof /system/bin/rild)" != "x" ]; then
+    if [ ${path_changed} -eq 0 ]; then
+        printlog "rild already started."
+        exit 0
     fi
-
-    if [ "x$(pidof /system/bin/rild)" != "x" ]; then
-        if [ ${path_changed} -eq 0 ]; then
-            printlog "rild already started."
-            exit 0
-        fi
-        printlog "stop ril-daemon"
-        setprop ctl.stop ril-daemon
-        sleep 1
-    fi
-    printlog "start ril-daemon"
-    setprop ctl.start ril-daemon
-}
-
-start
-
+    printlog "stop ril-daemon"
+    setprop ctl.stop ril-daemon
+    sleep 1
+fi
+printlog "start ril-daemon"
+setprop ctl.start ril-daemon
-- 
2.7.4

kernel

这边主要是解决插上 有方的4G模块时不时的不生成usb设备的问题。

bash 复制代码
From ed119d032513136427d514ca566842d8c49da817 Mon Sep 17 00:00:00 2001
From: wugt <wugt@keenon.com>
Date: Mon, 9 Oct 2023 14:18:16 +0800
Subject: [PATCH] feat: disable usb ethernet created by neoway 4G module

Change-Id: I8dafacf1e21f042d3e5937e2c03ffe5a45d8aec9
Signed-off-by: wugt <wugt@keenon.com>
---
 arch/arm/configs/rockchip_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/configs/rockchip_defconfig b/arch/arm/configs/rockchip_defconfig
index 88c8c71..ebf14a0 100644
--- a/arch/arm/configs/rockchip_defconfig
+++ b/arch/arm/configs/rockchip_defconfig
@@ -286,7 +286,7 @@ CONFIG_USB_NET_SMSC95XX=y
 CONFIG_USB_NET_GL620A=y
 CONFIG_USB_NET_PLUSB=y
 CONFIG_USB_NET_MCS7830=y
-CONFIG_USB_NET_RNDIS_HOST=y
+# CONFIG_USB_NET_RNDIS_HOST is not set
 CONFIG_USB_ALI_M5632=y
 CONFIG_USB_AN2720=y
 CONFIG_USB_EPSON2888=y
-- 
2.7.4
相关推荐
Data跳动8 分钟前
Spark内存都消耗在哪里了?
大数据·分布式·spark
woshiabc1111 小时前
windows安装Elasticsearch及增删改查操作
大数据·elasticsearch·搜索引擎
lucky_syq2 小时前
Saprk和Flink的区别
大数据·flink
lucky_syq2 小时前
流式处理,为什么Flink比Spark Streaming好?
大数据·flink·spark
袋鼠云数栈2 小时前
深入浅出Flink CEP丨如何通过Flink SQL作业动态更新Flink CEP作业
大数据
小白学大数据3 小时前
如何使用Selenium处理JavaScript动态加载的内容?
大数据·javascript·爬虫·selenium·测试工具
15年网络推广青哥3 小时前
国际抖音TikTok矩阵运营的关键要素有哪些?
大数据·人工智能·矩阵
节点。csn4 小时前
Hadoop yarn安装
大数据·hadoop·分布式
arnold664 小时前
探索 ElasticSearch:性能优化之道
大数据·elasticsearch·性能优化
NiNg_1_2345 小时前
基于Hadoop的数据清洗
大数据·hadoop·分布式