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

全志A133 android10 适配EC20 4G模块

一,移植适配

1. 驱动移植

代码路径:longan/kernel/linux-4.9/drivers/usb/serial/option.c

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 9f96dd2..2f25466 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -245,6 +245,7 @@ static int  option_probe(struct usb_serial *serial,

#define QUECTEL_VENDOR_ID                      0x2c7c
/* These Quectel products use Quectel's vendor ID */
+#define QUECTEL_PRODUCT_EC20                   0x6002
#define QUECTEL_PRODUCT_EC21                   0x0121
#define QUECTEL_PRODUCT_EC25                   0x0125
#define QUECTEL_PRODUCT_BG96                   0x0296
@@ -1079,6 +1080,7 @@ static int  option_probe(struct usb_serial *serial,
        { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M),
          .driver_info = RSVD(1) | RSVD(3) },
        /* Quectel products using Quectel vendor ID */
+       { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC20)},
        { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
          .driver_info = RSVD(4) },
        { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
@@ -1999,6 +2001,9 @@ static int  option_probe(struct usb_serial *serial,
#ifdef CONFIG_PM
        .suspend           = usb_wwan_suspend,
        .resume            = usb_wwan_resume,
+#if 1 //Added by Quectel
+       .reset_resume = usb_wwan_resume,
+#endif
#endif
};

@@ -2036,6 +2041,15 @@ static int option_probe(struct usb_serial *serial,
            iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA)
                return -ENODEV;

+#if 1 //Added by Quectel
+       if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
+               __u16 idProduct = le16_to_cpu(serial->dev->descriptor.idProduct);
+               //Quectel EC200S's interface 0 can be used as USB Network device (ecm, rndis)
+               if (serial->interface->cur_altsetting->desc.bInterfaceClass != 0xFF)
+                       return -ENODEV;
+       }
+#endif
        /* Store the device flags so we can use them during attach. */
        usb_set_serial_data(serial, (void *)device_flags);

代码路径:longan/kernel/linux-4.9/drivers/usb/serial/usb_wwan.c

diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index 3dfdfc8..0476229 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -505,6 +505,14 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
                          usb_sndbulkpipe(serial->dev, endpoint) | dir,
                          buf, len, callback, ctx);

+#if 1 //Added by Quectel for zero packet
+       if (dir == USB_DIR_OUT) {
+       struct usb_device_descriptor *desc = &serial->dev->descriptor;
+       if (desc->idVendor == cpu_to_le16(0x2C7C))
+       urb->transfer_flags |= URB_ZERO_PACKET;
+       }
+#endif
+
        return urb;
}

2. ril库移植

代码路径:android/device/softwinner/ceres-b6/ceres_b6.mk

diff --git a/android/device/softwinner/ceres-b6/ceres_b6.mk b/android/device/softwinner/ceres-b6/ceres_b6.mk
index 321272978e..8e36d8cd74 100644
--- a/android/device/softwinner/ceres-b6/ceres_b6.mk
+++ b/android/device/softwinner/ceres-b6/ceres_b6.mk
@@ -159,9 +159,9 @@ PRODUCT_PACKAGES += \
#PRODUCT_PACKAGES += AllwinnerGmsIntegration
-############################### 3G Dongle Support ###############################
+############################### 4G Dongle Support ###############################
# Radio Packages and Configuration Flie
-$(call inherit-product-if-exists, vendor/aw/public/prebuild/lib/librild/radio_common.mk)
+$(call inherit-product-if-exists, vendor/quectel/libquectel-ril/radio_common.mk)

代码路径:android/device/softwinner/ceres-b6/configs/manifest.xml

diff --git a/android/device/softwinner/ceres-b6/configs/manifest.xml b/android/device/softwinner/ceres-b6/configs/manifest.xml
index fb82972d59..b9c7cb5178 100644
--- a/android/device/softwinner/ceres-b6/configs/manifest.xml
+++ b/android/device/softwinner/ceres-b6/configs/manifest.xml
@@ -25,6 +25,24 @@
             <name>IUsb</name>
             <instance>default</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.radio</name>
+        <transport>hwbinder</transport>
+        <version>1.0</version>
+        <interface>
+            <name>IRadio</name>
+            <instance>slot1</instance>
+        </interface>
     </hal>
     <hal format="hidl">
         <name>android.hardware.audio.effect</name>

代码路径:android/device/softwinner/ceres-b6/init.device.rc

diff --git a/android/device/softwinner/ceres-b6/init.device.rc b/android/device/softwinner/ceres-b6/init.device.rc
index 1f1e569d15..83185821a6 100644
--- a/android/device/softwinner/ceres-b6/init.device.rc
+++ b/android/device/softwinner/ceres-b6/init.device.rc
@@ -1,3 +1,5 @@
+import /vendor/etc/init/rild.rc
+
on init
     # Load persistent dm-verity state
     verity_load_state

代码路径:android/hardware/ril/rild/Android.mk

diff --git a/android/hardware/ril/rild/Android.mk b/android/hardware/ril/rild/Android.mk
index b8ba508ee9..1b3d5bfa83 100644
--- a/android/hardware/ril/rild/Android.mk
+++ b/android/hardware/ril/rild/Android.mk
@@ -29,7 +29,7 @@ endif
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE:= rild
-LOCAL_VINTF_FRAGMENTS := radio.xml
+#LOCAL_VINTF_FRAGMENTS := radio.xml
ifeq ($(PRODUCT_COMPATIBLE_PROPERTY),true)
LOCAL_INIT_RC := rild.rc
LOCAL_CFLAGS += -DPRODUCT_COMPATIBLE_PROPERTY

3. 添加权限

代码路径:android/device/softwinner/common/sepolicy/vendor/rild.te

diff --git a/android/device/softwinner/common/sepolicy/vendor/rild.te b/android/device/softwinner/common/sepolicy/vendor/rild.te
index 8fdddc57a6..d29b4a2688 100755
--- a/android/device/softwinner/common/sepolicy/vendor/rild.te
+++ b/android/device/softwinner/common/sepolicy/vendor/rild.te
@@ -5,6 +5,7 @@ allow rild vendor_file:file execute_no_trans;
allow rild vendor_ril_prop:file { read getattr open };
allow rild vendor_ril_prop:property_service set;
allow rild vendor_default_prop:file {open read getattr};
+allow rild rild:packet_socket create_socket_perms_no_ioctl;
allow rild vendor_toolbox_exec:file execute_no_trans;
allow rild vendor_shell_exec:file execute_no_trans;

4. ril库存放路径

代码路径:android/vendor/quectel/libquectel-ril/

A133_Android10_b$ ls -l android/vendor/quectel/libquectel-ril/
总用量 224
-rw-rw-r-- 1 fy fy 207092 1230  2020 apns-conf.xml
drwxrwxr-x 2 fy fy   4096 95 14:25 arm64-v8a
drwxrwxr-x 2 fy fy   4096 95 14:25 armeabi
drwxrwxr-x 2 fy fy   4096 95 14:25 doc
-rw-rw-r-- 1 fy fy    959 1224  2020 ql-ril.conf
-rw-rw-r-- 1 fy fy    723 95 14:26 radio_common.mk

libquectel-ril下载链接:https://download.csdn.net/download/weixin_45639314/89774784

二,调试

首先检查电压供电正常;

  • 检查daemon是否运行
getprop init.svc.ril-daemon

在这里插入图片描述

  • 查看so库是否正确配置加载
su
cat /init.rc | grep ril-daemon

在这里插入图片描述

  • 检查permision
ls -l /dev/ttyUSB*

在这里插入图片描述

  • 查看库版本来源
getprop gsm.version.ril-impl

在这里插入图片描述


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

相关文章:

  • 鸿蒙next版开发:订阅应用事件(ArkTS)
  • Android 下内联汇编,Android Studio 汇编开发
  • vue elementui el-dropdown-item设置@click无效的解决方案
  • 计算机网络分析题
  • 从0开始学docker (每日更新 24-11-7)
  • 中兴光猫修改SN,MAC,修改地区,异地注册,改桥接,路由拨号
  • 开源模型应用落地-qwen模型小试-Qwen2.5-7B-Instruct-Gradio快速体验(十四)
  • 音频评价指标
  • MATLAB系列04:循环结构
  • 海外云市场分析
  • Linux编程:解析EAGAIN错误 Resource temporarily unavailable
  • neo4j节点关联路径的表示、节点的增删改查
  • 电线电缆制造5G智能工厂物联数字孪生平台,推进制造业数字化转型
  • 标题:深入理解Linux操作系统:从原理到实践
  • win/mac常用命令
  • 浅谈死锁以及判断死锁的方法
  • Parallels Desktop 20破解版(Mac虚拟机) v20.0.0 for Mac 最新商业版(支持M系列)
  • 揭开数据能力的神秘面纱
  • 当你问AI“有点烦”
  • Python “函数” ——Python面试100道实战题目练习,巩固知识、检查技术、成功就业
  • VSCode的使用
  • 人工智能与量子计算:进展与未来挑战
  • Pyspark dataframe基本内置方法(5)
  • 无线感知会议系列【3】【基于WiFi和4G/5G的非接触无线感知:挑战、理论和应用-1】
  • 【Unity踩坑】UI Image的fillAmount不起作用
  • Oracle 19c异常恢复—ORA-01209/ORA-65088---惜分飞