千家信息网

RK3399 4G模块移远EC20移植调试

发表于:2024-11-19 作者:千家信息网编辑
千家信息网最后更新 2024年11月19日,CPU : RK3399系统: Android 7.11 、通过串口打印或者 adb 获取模块的 pid 和 vid ,顺便可以看到生成 4 个虚拟串口 /dev/ttyUSB*[ 11.734379
千家信息网最后更新 2024年11月19日RK3399 4G模块移远EC20移植调试

CPU RK3399

系统: Android 7.1

1 、通过串口打印或者 adb 获取模块的 pid vid ,顺便可以看到生成 4 个虚拟串口 /dev/ttyUSB*

[ 11.734379 ] usb 1 - 1.1 : new high-speed USB device number 3 using ehci-platform

[ 11.828247 ] usb 1 - 1.1 : New USB device found, idVendor=2c7c, idProduct= 0125

[ 11.828386 ] usb 1 - 1.1 : New USB device strings: Mfr= 1 , Product= 2 , SerialNumber= 0

[ 11.828413 ] usb 1 - 1.1 : Product: Android

[ 11.828436 ] usb 1 - 1.1 : Manufacturer: Android

[ 11.835480 ] option 1 - 1.1 : 1.0 : GSM modem ( 1 -port) converter detected

[ 11.841217 ] usb 1 - 1.1 : GSM modem ( 1 -port) converter now attached to ttyUSB0

[ 11.844988 ] option 1 - 1.1 : 1.1 : GSM modem ( 1 -port) converter detected

[ 11.851892 ] usb 1 - 1.1 : GSM modem ( 1 -port) converter now attached to ttyUSB1

[ 11.853964 ] option 1 - 1.1 : 1.2 : GSM modem ( 1 -port) converter detected

[ 11.864677 ] usb 1 - 1.1 : GSM modem ( 1 -port) converter now attached to ttyUSB2

[ 11.865658 ] option 1 - 1.1 : 1.3 : GSM modem ( 1 -port) converter detected

[ 11.871387 ] usb 1 - 1.1 : GSM modem ( 1 -port) converter now attached to ttyUSB3

2 、在代码中添加模块的 pid vid ,原始代码中已经包含移远的几个模块,仿照现有的添加 EC20

diff --git a/kernel/drivers/usb/serial/option.c b/kernel/drivers/usb/serial/option.c

index 1799aa0..f6c9e5d 100644

--- a/kernel/drivers/usb/serial/option.c

+++ b/kernel/drivers/usb/serial/option.c

@@ - 241 , 6 + 241 , 7 @@ static void option_instat_callback( struct urb *urb);

#define QUECTEL_VENDOR_ID 0x2c7c

/* These Quectel products use Quectel's vendor ID */

+ #define QUECTEL_PRODUCT_EC20 0x0125

#define QUECTEL_PRODUCT_EC21 0x0121

#define QUECTEL_PRODUCT_EC25 0x0125

#define QUECTEL_PRODUCT_BG96 0x0296

@@ - 1200 , 6 + 1201 , 8 @@ static const struct usb_device_id option_ids[] = {

{ USB_DEVICE(QUALCOMM_VENDOR_ID, YUGA_PRODUCT_CLM920_NC5),

.driver_info = (kernel_ulong_t)&yuga_clm920_nc5_blacklist },

/* Quectel products using Quectel vendor ID */

+ { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC20),

+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },

{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),

.driver_info = (kernel_ulong_t)&net_intf4_blacklist },

{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25)

3 、添加模块的 so 库,此库需要移远提供, so 支持的系统要匹配,将 so 库拷贝到下面的路径

vendor/rockchip/common/phone/lib/libreference-ril.so

4 、打开 device/rockchip/common/device.mk 文件,修改 rild.libpath 路径为 rild.libpath=/system/lib64/libreference-ril.so

diff --git a/device/rockchip/common/device.mk b/device/rockchip/common/device.mk

index be2cb2c..69034a7 100755

--- a/device/rockchip/common/device.mk

+++ b/device/rockchip/common/device.mk

@@ - 699 , 7 + 699 , 7 @@ endif

ifeq ($(strip $(BOARD_HAVE_DONGLE)), true )

ifeq ($(strip $(TARGET_ARCH)), arm64)

PRODUCT_PROPERTY_OVERRIDES += \

- rild.libpath=/system/lib64/libril-rk29-dataonly.so

+ rild.libpath=/system/lib64/libreference-ril.so

else

PRODUCT_PROPERTY_OVERRIDES += \

rild.libpath=/system/lib/libril-rk29-dataonly.so

因为 rk3399 64 CPU ,所以 ifeq ($(strip $(TARGET_ARCH)), arm64) 条件成立。

但是前提都是 BOARD_HAVE_DONGLE 变量值为 true

注:本人测试,修改下面两个文件中的 rild.libpath 不起作用

device/rockchip/rk3399/system.prop

device/rockchip/rk3399/rk3399_all/system.prop

5 、编译时将 so 库拷贝到上面指定目录 /system/lib64/libreference-ril.so

diff --git a/vendor/rockchip/common/phone/phone.mk b/vendor/rockchip/common/phone/phone.mk

index 946aacd..f8fc6e7 100755

--- a/vendor/rockchip/common/phone/phone.mk

+++ b/vendor/rockchip/common/phone/phone.mk

@@ - 8 , 7 + 8 , 8 @@ PRODUCT_COPY_FILES += \

$(CUR_PATH)/phone/etc/ppp/ip-down:system/etc/ppp/ip-down \

$(CUR_PATH)/phone/etc/ppp/ip-up:system/etc/ppp/ip-up \

$(CUR_PATH)/phone/etc/ppp/call-pppd:system/etc/ppp/call-pppd \

- $(CUR_PATH)/phone/etc/operator_table:system/etc/operator_table

+ $(CUR_PATH)/phone/etc/operator_table:system/etc/operator_table \

+ $(CUR_PATH)/phone/lib/libreference-ril.so:system/lib64/libreference-ril.so

ifeq ($(strip $(PRODUCT_MODEM)), DTS4108C)

PRODUCT_COPY_FILES += \

6 、设置 BOARD_HAVE_DONGLE 变量

diff --git a/device/rockchip/rk3399/rk3399_all.mk b/device/rockchip/rk3399/rk3399_all.mk

index 7a2d870..ce5060c 100755

--- a/device/rockchip/rk3399/rk3399_all.mk

+++ b/device/rockchip/rk3399/rk3399_all.mk

@@ - 63 , 7 + 63 , 7 @@ BOARD_NFC_SUPPORT := false

BOARD_HAS_GPS := false

# for 3G/4G modem dongle support

-BOARD_HAVE_DONGLE := false

+BOARD_HAVE_DONGLE := true

BOARD_GRAVITY_SENSOR_SUPPORT := true

此时移植完成,只要 so 库没问题,就可以正常上网。

如果 radio log 中打印如下信息:

RIL_SAP_Init not defined or exported in /system/lib64/libril-rk29-dataonly.so

检查 rild.libpath 的路径和名称是否正确。

No /proc/cmdline exception=java.io.FileNotFoundException: /proc/cmdline (Permission denied)

此报错不影响联网,可以忽略

0