RK3399 4G模組移遠EC20移植除錯

tt7643066發表於2020-02-24

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)

此報錯不影響聯網,可以忽略

 

 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69948385/viewspace-2677005/,如需轉載,請註明出處,否則將追究法律責任。

相關文章