RK3568适配美格(MEIG-SLM3XX)4G模块
前言
平台:RK3568
系统:Android 11
需求:MEIG-SLM3XXX 4G模块适配
Kernel驱动配置
- rockchip_defconfig需要配置ppp驱动与usb串口驱动
+ CONFIG_USB_SERIAL_GENERIC=y
+ CONFIG_USB_SERIAL_OPTION=y
+ CONFIG_USB_SERIAL_QT2=y
- 安装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 */
- 添加串口设备权限
device/rockchip/common/ueventd.rockchip.rc
+ /dev/ttyUSB* 0664 radio radio
- 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)
{
- 添加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>
- 添加网络属性相关配置
在网络属性中添加移动网络支持,在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>
- 添加RIL配置
- 将附件的RIL适配.rar解压Android源码根目录下vendor/meig目录下
- 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