当前位置: 首页 > article >正文

RK3568适配美格(MEIG-SLM3XX)4G模块

前言

平台:RK3568
系统:Android 11
需求:MEIG-SLM3XXX 4G模块适配

Kernel驱动配置

  1. rockchip_defconfig需要配置ppp驱动与usb串口驱动
+ CONFIG_USB_SERIAL_GENERIC=y
+ CONFIG_USB_SERIAL_OPTION=y
+ CONFIG_USB_SERIAL_QT2=y
  1. 安装USB驱动
diff --git a/kernel/drivers/usb/serial/option.c b/kernel/drivers/usb/serial/option.c
index 66e9896..b50bef9 100644
--- a/kernel/drivers/usb/serial/option.c
+++ b/kernel/drivers/usb/serial/option.c
@@ -569,6 +569,12 @@
 #define WETELECOM_PRODUCT_WMD300		0x6803
 
 
+/* Meig products */
+#define MEIG_VENDOR_ID              0x2dee
+#define MEIG_PRODUCT_SLM320_1       0x4d41
+#define MEIG_PRODUCT_SLM320_2       0x4d42
+#define MEIG_PRODUCT_SLM320_3       0x4d43
+
 /* Device flags */
 
 /* Highest interface number which can be used with NCTRL() and RSVD() */
@@ -603,6 +609,9 @@
 		.driver_info = RSVD(0) | RSVD(1)}, /*  YuGe */
 	{ USB_DEVICE(0x05c6, 0x9025),
 		.driver_info = RSVD(0) | RSVD(1) | RSVD(4)}, /* YuGe */
+	{ USB_DEVICE(MEIG_VENDOR_ID, MEIG_PRODUCT_SLM320_1) },		/*MeiG SLM320*/
+	{ USB_DEVICE(MEIG_VENDOR_ID, MEIG_PRODUCT_SLM320_2) },		/*MeiG SLM320*/
+	{ USB_DEVICE(MEIG_VENDOR_ID, MEIG_PRODUCT_SLM320_3) },		/*MeiG SLM320*/
 	{ USB_DEVICE(0x2C7C, 0x0191) }, /* Quectel EG91 */
 	{ USB_DEVICE(0x2C7C, 0x0195) }, /* Quectel EG95 */
 	{ USB_DEVICE(0x2C7C, 0x0306) }, /* Quectel EG06/EP06/EM06 */
  1. 添加串口设备权限

device/rockchip/common/ueventd.rockchip.rc

+ /dev/ttyUSB*   0664   radio   radio 
  1. ril增加配置

加载对应的ril库

diff --git a/hardware/ril/rild/rild.c b/hardware/ril/rild/rild.c
index 170f55c..b587406 100644
--- a/hardware/ril/rild/rild.c
+++ b/hardware/ril/rild/rild.c
@@ -48,6 +48,7 @@
 #define REFERENCE_RIL_QUECTEL_PATH    "/vendor/lib64/libreference-ril-Quectel.so"
 #define REFERENCE_RIL_YUGA_PATH       "/vendor/lib64/libreference-ril-YuGe.so"
 #define REFERENCE_RIL_SIMCOM_PATH     "/vendor/lib64/libreference-ril-simcom.so"
+#define REFERENCE_RIL_MEIG_PATH 	  "/vendor/lib64/libreference-ril-MeiG.so"
 #define REFERENCE_RIL_DEF_PATH        "/vendor/lib64/libreference-ril.so"
 
 static void usage(const char *argv0) {
@@ -142,8 +143,17 @@
             sleep(1);
 		}
 	}
+
+    int n;
+    for(n = 0;n < argc; n++){
+        RLOGD("**RILd param argc = %d, argv = %s", n,argv[n]);
+    }
 	start_uevent_monitor();
 	switch(modem_type){
+        case MEIG_MODEM:
+            rilLibPath=REFERENCE_RIL_MEIG_PATH;
+            RLOGE("rild.libpath is MEIG_MODEM");
+			break;
         case YUGA_MODEM:
             rilLibPath = REFERENCE_RIL_YUGA_PATH;
             property_set("persist.ril.data.prefer","rndis");
@@ -163,8 +173,8 @@
             RLOGD("**get modem_type: SIMCOM_MODEM**");
             break;
         default:
-            rilLibPath = REFERENCE_RIL_QUECTEL_PATH;
-            RLOGD("**default modem_type: QUECTEL_MODEM**");
+            rilLibPath=REFERENCE_RIL_MEIG_PATH;
+            RLOGE("rild.libpath is REFERENCE_RIL_MEIG_PATH");
 			break;
 	}
 	property_set(LIB_PATH_PROPERTY,rilLibPath);
diff --git a/hardware/ril/runtime-ril-port/runtime_port.c b/hardware/ril/runtime-ril-port/runtime_port.c
index 7b70859..d588ae2 100644
--- a/hardware/ril/runtime-ril-port/runtime_port.c
+++ b/hardware/ril/runtime-ril-port/runtime_port.c
@@ -132,6 +132,14 @@
 		.deviceport = "/dev/ttyUSB2",
 		.type		= SIMCOM_MODEM,
 	},
+	{
+		.name		= "MEIG-SLM320",
+		.idVendor	= "2dee",
+		.idProduct	= "4d41",
+		.deviceport = "/dev/ttyUSB1",
+		.dataport	= "/dev/ttyUSB2",
+		.type		= MEIG_MODEM,
+	},
 };
 int readfile(char *path, char *content, size_t size)
 {
  1. 添加HID配置

对于Android8.0及以上版本,需要配置HIDL。

一般device下都有个宏DEVICE_MANIFEST_FILE配置了对应的manifest.xml文件,需要在此文件中配置radio相关的hidl,telephony service才能找到rild service,否则RIL跑不起来。

device/khadas/kvim/BoardConfig.mk:183:
DEVICE_MANIFEST_FILE:= device/khadas/common/products/mbox/manifest/manifest_aosp.xml 
+ <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> 
+ <hal format="hidl"> 
<name>android.hardware.bluetooth</name> 
<transport>hwbinder</transport> 
<version>1.0</version> 
  1. 添加网络属性相关配置

在网络属性中添加移动网络支持,在frameworks/base/core/res/res/values/config.xml配置,一般在对应device下overlay掉这个配置,需要注意以overlay下的config.xml为准。

--a/device/rockchip/rk356x/overlay/frameworks/base/core/res/res/values/config.xml 
++b/device/rockchip/rk356x/overlay/frameworks/base/core/res/res/values/config.xml
@@ -12,6 +12,7 @@ 
<string-array translatable="false" name="networkAttributes"> 
<item>"wifi,1,1,1,-1,true"</item> 
<item>"ethernet,9,9,9,-1,true"</item> 
+ <item>"mobile,0,0,0,-1,true"</item> 
<!-- <item>"pppoe,18,18,1,-1,true"</item> --> 
</string-array> 
<!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering__--> 
@@ -19,6 +20,7 @@ 
<!== [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH --> 
<!-- [18,9] for TYPE_PPPOE, TYPE_ETHERNET --> 
<integer-array translatable="false" name="config_tether_upstream_types"> 
+ <item>0</item> 
<item>1</item> 
<item>18</item> 
<item>9</item> 
  1. 添加RIL配置
    1. 将附件的RIL适配.rar解压Android源码根目录下vendor/meig目录下
    2. mk中添加美格ril配置,注意区分32跟64位,如我的平台是rk3568 64bit
--- a/device/rockchip/rk356x/rk3568_r/rk3568_r.mk
+++ b/device/rockchip/rk356x/rk3568_r/rk3568_r.mk
@@ -58,3 +58,13 @@ PRODUCT_PROPERTY_OVERRIDES += ro.sf.lcd_density=240
+#########################################################################
+# MEIG RIL CONFIG
+#########################################################################
+#if Android is 32 bit
+-include vendor/meig/meig_radio.mk
+#if Android is 64 bit
+-include vendor/meig/meig_radio_x64.mk

http://www.kler.cn/a/464163.html

相关文章:

  • 联发科MTK6771/MT6771安卓核心板规格参数介绍
  • 《learn_the_architecture_-_generic_interrupt_controller_v3_and_v4__lpisn》学习笔记
  • SD下载、安装、使用、卸载-Stable Diffusion整合包v4.10发布!
  • Redission红锁
  • 【74HC192减法24/20/72进制】2022-5-17
  • 解决 ffmpeg “Unknown encoder ‘hevc_nvenc‘“
  • JavaWeb开发(五)Servlet-ServletContext
  • 大数据-266 实时数仓 - Canal 对接 Kafka 客户端测试
  • 数字图像总复习
  • ubuntu切换到root用户
  • 【C++动态规划】2088. 统计农场中肥沃金字塔的数目|2104
  • C++11右值与列表初始化
  • Redis数据库主要数据结构类型
  • 【HarmonyOS之旅】ArkTS语法(四) -> 使用限制与扩展
  • 使用爬虫技术获取网页中的半结构化数据
  • 算法-判断一个数是不是3的次幂
  • 解决cookie跳转页面失效等问题
  • 大屏深色系 UI 设计:点亮科技与艺术的融合之光
  • 微记录-Linux字符设备的write函数如何避免文件系统重复调用?
  • 级联配准learning
  • 详解广义表长度与深度计算方法
  • 【初识vue以及简单指令】
  • 本地调试自定义Maven Plugin步骤
  • 力学笃行(示例1)QGraphicsView显示相机图像
  • Java对象创建过程与类加载机制
  • 科技查新测试基础知识分享