首页 > 其他分享 >3568 EC25-G调试4G和GPS功能

3568 EC25-G调试4G和GPS功能

时间:2023-12-21 12:11:25浏览次数:45  
标签:le16 usb 3568 dev EC25 device 4G serial true

一、4G移植:

1.  pid、vid添加:

  drivers/usb/serial/option.c

 驱动里面已经默认有,这一步可以忽略.。

2.

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 6c5a80be371a..fd0d66904cb9 100755
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -2169,6 +2169,9 @@ static struct usb_serial_driver option_1port_device = {
        .suspend           = usb_wwan_suspend,
        .resume            = usb_wwan_resume,
 #endif
+#if 1
+     .reset_resume      = usb_wwan_resume,
+#endif
 };
 
 static struct usb_serial_driver * const serial_drivers[] = {
@@ -2192,6 +2195,31 @@ static int option_probe(struct usb_serial *serial,
                                &serial->interface->cur_altsetting->desc;
        unsigned long device_flags = id->driver_info;
 
+#if 1 //Added by Quectel
+       //Quectel UC20's interface 4 can be used as USB Network device
+       if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9003)
+               && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
+               return -ENODEV;
+
+       //Quectel EC20's interface 4 can be used as USB Network device
+       if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9215)
+               && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
+               return -ENODEV;
+
+       if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
+               __u16 idProduct = le16_to_cpu(serial->dev->descriptor.idProduct);
+
+               //Quectel EC200&UC200's interface 0 can be used as USB Network device (ecm, rndis)
+               if (serial->interface->cur_altsetting->desc.bInterfaceClass != 0xFF)
+                       return -ENODEV;
+
+               //Quectel EC25&EC21&EG91&EG95&EG06&EP06&EM06&BG96&AG35&EG12&EG18's interface 4 can be used as USB network device (qmi,ecm,mbim)
+               if ((idProduct != 0x6026 && idProduct != 0x6126)
+                       && serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
+               return -ENODEV;
+       }
+#endif
+
        /* Never bind to the CD-Rom emulation interface */
        if (iface_desc->bInterfaceClass == USB_CLASS_MASS_STORAGE)

3.

diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index c604ff45461a..581c6d066bea 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -514,6 +514,23 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
                     desc->idProduct == cpu_to_le16(0x4e3c)))
                        urb->transfer_flags |= URB_ZERO_PACKET;
        }
+
+#if 1 //Added by Quectel for Zero Packet
+       if (dir == USB_DIR_OUT) {
+               if ((desc->idVendor == cpu_to_le16(0x1286) &&
+                    desc->idProduct == cpu_to_le16(0x4e3c)))
+                       urb->transfer_flags |= URB_ZERO_PACKET;
+               if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9090))
+                       urb->transfer_flags |= URB_ZERO_PACKET;
+               if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9003))
+                       urb->transfer_flags |= URB_ZERO_PACKET;
+               if (serial->dev->descriptor.idVendor == cpu_to_le16(0x05C6) && serial->dev->descriptor.idProduct == cpu_to_le16(0x9215))
+                       urb->transfer_flags |= URB_ZERO_PACKET;
+               if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C))
+                       urb->transfer_flags |= URB_ZERO_PACKET;
+       }
+#endif 
+
        return urb;
 }

4.添加qmi_wwan_q.c(移远原厂提供)文件,makefile添加qmi_wwan_q.o(特别注意要放在qmi_wwan.o的前面)

diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index 27307a4ab003..da66e2403891 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_USB_NET_CX82310_ETH)     += cx82310_eth.o
 obj-$(CONFIG_USB_NET_CDC_NCM)  += cdc_ncm.o
 obj-$(CONFIG_USB_NET_HUAWEI_CDC_NCM)   += huawei_cdc_ncm.o
 obj-$(CONFIG_USB_VL600)                += lg-vl600.o
+obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan_q.o
 obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan.o
 obj-$(CONFIG_USB_NET_CDC_MBIM) += cdc_mbim.o
 obj-$(CONFIG_USB_NET_CH9200)   += ch9200.o

*实际调试发现,没有用这个驱动时候,有4G信号和图标出来,但是不能上网,替换完这个驱动就可以正常上网了。

5.添加cdc-wdm0节点:

调试过程看adb shell logcat -b radio,报错:

 按照报错提示,把path补丁加上:

diff --git a/system/core/init/devices.cpp b/system/core/init/devices.cpp
index ada1e28..812c60d 100755
 --- a/system/core/init/devices.cpp
 +++ b/system/core/init/devices.cpp
 @@ -407,6 +407,10 @@ void DeviceHandler::HandleDeviceEvent(const Uevent& uevent) {
          int device_id = uevent.minor % 128 + 1;
          devpath = StringPrintf("/dev/bus/usb/%03d/%03d", bus_id, device_id);
         }
 +#if 1 //add by quectel for mknod /dev/cdc-wdm0
 +       } else if (uevent.subsystem == "usbmisc" && !uevent.device_name.empty()) {
+        devpath = "/dev/" + uevent.device_name;
+#endif
      } else if (StartsWith(uevent.subsystem, "usb")) {
          // ignore other USB events
          return;

这时就会生产一个/dev/cdc-wdm0节点,还需要添加权限:

diff --git a/ueventd.rockchip.rc b/ueventd.rockchip.rc
index 9a6843c..0b1c30e 100755
--- a/ueventd.rockchip.rc
+++ b/ueventd.rockchip.rc
@@ -88,6 +88,7 @@
 /dev/ttyUSB7              0660   radio         radio
 /dev/ttyUSB8              0660   radio         radio
 /dev/ttyUSB9              0660   radio         radio
+/dev/cdc-wdm*             0660   radio      radio

 

移植完以上,开机log会有以下信息:

 

5.4g默认是关闭的,需要打开:

diff --git a/BoardConfig.mk b/BoardConfig.mk
index 41b34e1..d9a3e4e 100755
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -437,7 +437,7 @@ BOARD_BLUETOOTH_LE_SUPPORT ?= true
 BOARD_WIFI_SUPPORT ?= true
 
 #for rk 4g modem
-BOARD_HAS_RK_4G_MODEM ?= false
+BOARD_HAS_RK_4G_MODEM ?= true

6.为了方便,直接用移远提供的库文件替换rk系统默认自带的:

  device/rockchip/common/4g_modem/lib64/librk-ril.so

  这个编译出来会拷贝到/vendor/lib64下

7.完成以上步骤,就可以正常上网,但设置里面关于4G网络的业务显示以及状态栏的信号图标都是没有的。

diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index 9feb244..515c6be 100755
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -32,6 +32,14 @@
     <string-array translatable="false" name="networkAttributes">
         <item>"wifi,1,1,2,-1,true"</item>
         <item>"bluetooth,7,7,0,-1,true"</item>
+               <item>"mobile,0,0,0,-1,true"</item>
+               <item>"mobile_mms,2,0,2,60000,true"</item>
+               <item>"mobile_supl,3,0,2,60000,true"</item>
+               <item>"mobile_dun,4,0,2,60000,true"</item>
+               <item>"mobile_hipri,5,0,3,60000,true"</item>
+               <item>"mobile_fota,10,0,2,60000,true"</item>
+               <item>"mobile_ims,11,0,2,60000,true"</item>
+               <item>"mobile_cbs,12,0,2,60000,true"</item>
         <item>"ethernet,9,9,9,-1,true"</item>
     </string-array>

 

8.添加4G物联网卡APN

vendor/rockchip/common/phone/etc/apns-full-conf.xml
+  
+  <apn carrier="China Telecom" mcc="460" mnc="11" apn="ctnet" type="default,supl" />
+  <apn carrier="中国移动物联网4G" mcc="460" mnc="04" apn="cmiot" type="default,supl" />
+  <apn carrier="中国移动物联网2G" mcc="460" mnc="04"  apn="cmmtm" type="default,supl" />
+  <apn carrier="中国联通物联网gzm2mapn" mcc="460" mnc="06" apn="unim2m.gzm2mapn" port="80" type="default,supl" />
+  <apn carrier="中国联通物联网njm2mapn" mcc="460" mnc="06" apn="unim2m.njm2mapn"  type="default,supl" />
+  <apn carrier="中国电信物联网m2m" mcc="460" mnc="03" apn="CTNET" user="m2m" password="vnet.mobi" type="default" />
+  
 </apns>

9.没接4G模块时候,一直报错:

 init: Control message: Could not find '[email protected]::IRadio/slot1' for ctl.interface_start from pid: 149 (/system/bin/hwservicemanager)

需要修改以下2点:

a.system/core/

diff --git a/init/init.cpp b/init/init.cpp
old mode 100644
new mode 100755
index 29859c5..ff83b9f
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -421,9 +421,11 @@ static bool HandleControlMessage(std::string_view message, const std::string& na
         return false;
     }
 
-    LOG(INFO) << "Control message: Processed ctl." << message << " for '" << name
-              << "' from pid: " << from_pid << " (" << process_cmdline << ")";
-    return true;
+    if(strcmp(name.c_str(),"[email protected]::IRadio/slot1") != 0) {
+        LOG(INFO) << "Control message: Processed ctl." << message << " for '" << name
+                << "' from pid: " << from_pid << " (" << process_cmdline << ")";
+    }
+    return true; 
 }

 

b./system/libhidl

diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
old mode 100644
new mode 100755
index a7e9626..0ace37b
--- a/transport/ServiceManagement.cpp
+++ b/transport/ServiceManagement.cpp
@@ -625,8 +625,9 @@ struct Waiter : IServiceNotification {
             if (mRegistered) {
                 break;
             }
-
-            LOG(WARNING) << "Waited one second for " << mInterfaceName << "/" << mInstanceName;
+            if(strcmp(mInterfaceName.c_str(),"[email protected]::IRadio") != 0) { 
+                LOG(WARNING) << "Waited one second for " << mInterfaceName << "/" << mInstanceName;
+            }
         } while (!timeout);
     }
 
@@ -800,7 +801,9 @@ sp<::android::hidl::base::V1_0::IBase> getRawServiceInternal(const std::string&
         if (vintfLegacy || !retry) break;
 
         if (waiter != nullptr) {
-            ALOGI("getService: Trying again for %s/%s...", descriptor.c_str(), instance.c_str());
+            if(strcmp(descriptor.c_str(),"[email protected]::IRadio") != 0) { 
+                ALOGI("getService: Trying again for %s/%s...", descriptor.c_str(), instance.c_str());
+            }
             waiter->wait(true /* timeout */);
         }

 

二、GPS移植:

  1.文件准备:

    device\rockchip\common目录下文件夹quectel-gps,里面包含GPS需要的库文件gps.default.so、gps_cfg.inf(移远提供)

  2.支持打开GPS:

device/rockchip/rk356x/BoardConfig.mk
wangmc@m5280:~/sata/rk3568-11.0-hhx/device/rockchip/rk356x$ git diff
diff --git a/BoardConfig.mk b/BoardConfig.mk
index e2773c1..dfa41ba 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -65,7 +65,7 @@ ENABLE_CPUSETS := true
 WITH_DEXPREOPT := true
 
 BOARD_NFC_SUPPORT := false
-BOARD_HAS_GPS := false
+BOARD_HAS_GPS := true
 
 BOARD_GRAVITY_SENSOR_SUPPORT := true
 BOARD_COMPASS_SENSOR_SUPPORT := false

 

  3.修改device/rockchip/common/device.mk 

diff --git a/device.mk b/device.mk
index 782b0fd..6123734 100755
--- a/device.mk
+++ b/device.mk
@@ -371,7 +371,13 @@ PRODUCT_COPY_FILES += \
 endif
 
 ifeq ($(BOARD_HAS_GPS),true)
+PRODUCT_PACKAGES += \
+     [email protected] \
+     [email protected]
+     
 PRODUCT_COPY_FILES += \
+    $(LOCAL_PATH)/quectel-gps/gps.default.so:$(TARGET_COPY_OUT_VENDOR)/lib64/hw/gps.default.so \
+    $(LOCAL_PATH)/quectel-gps/gps_cfg.inf:$(TARGET_COPY_OUT_VENDOR)/etc/gps_cfg.inf \
     frameworks/native/data/etc/android.hardware.location.gps.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.gps.xml
 endif

  4.添加了PRODUCT_PACKAGES += [email protected] [email protected],编译时会有大量报错,需要修改

  /hardware/interfaces/compatibility_matrices/compatibility_matrix.5.xml

diff --git a/compatibility_matrices/compatibility_matrix.5.xml b/compatibility_matrices/compatibility_matrix.5.xml
index a535a2a..03b395b 100644
--- a/compatibility_matrices/compatibility_matrix.5.xml
+++ b/compatibility_matrices/compatibility_matrix.5.xml
@@ -202,7 +202,7 @@
     </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.gnss</name>
-        <version>2.0-1</version>
+        <version>1.0</version>
         <interface>
             <name>IGnss</name>
             <instance>default</instance>

此时GPS移植就已经完毕,接下来就是测试。

5.apk测试数据如下:

 

 测试需要注意:

  1.如果室内没有gps的信号放大器,需要把设备天下移到靠室外的窗户边

  2.GPS天线尽量朝上对着天空,不要朝下

  3.信号条件如果,时间需要等久一点,apk就会有数据出来

标签:le16,usb,3568,dev,EC25,device,4G,serial,true
From: https://www.cnblogs.com/wmc245376374/p/17918630.html

相关文章

  • CH582,CH583,CH32V208等IC低功耗蓝牙系列2.4G例程RF_PHY/RF_PHY_Hop配对示例
    RF_PHY和RF_PHY_Hop两个例程均可以采用这种思路,甚至可以组合使用,比如RF_PHY用来配对,RF_PHY_Hop用来数据通讯,思路简介:该例程只要收发双方的地址,跳频频道等基础配置项一致即可进行无线通讯,因此可以衍生出其中一种较简单的配对思路,即:1、初始化代码中使用默认地址,例如0x71764129,这样......
  • iTOP-RK3568开发板实时系统编译,Preemption系统/Xenomai系统编译,获取Linux源码包
    1获取Linux源码包编译环境说明:本手册使用的是迅为提供的编译环境ubuntu20.04,在网盘资料“iTOP-3568开发板\03_【iTOP-RK3568开发板】指南教程\05_NPU开发配套资料\03_RKNN_Toolkit2环境搭建\01课程用到的资料\01_初始Ubuntu20虚拟机”路径下。这里的ubuntu20默认开发......
  • 恒创科技:云服务器1核2G和2核4G差距大吗?
    ​云服务器是运行在云计算平台上的虚拟服务器,当您创建云服务器时,云提供商会为您分配一定数量的虚拟化硬件,例如CPU、内存等,而在这些分配的配置中,1核2G和2核4G通常算是主流的选择,那么,这些配置参数到底是什么意思呢?它们之间差距大吗?本文主要从处理器核心数量、内存容量、建站选......
  • RK3568 android12 动态替换开机logo
    前言:最近客户有个需要,通过adbpush来动态替换开机logo。通过网上查阅相关资料,现整理如下。参考:RK3568Android/Linux系统动态更换U-Boot/KernelLogo解决方法:通过自定义一个分区来存储开机logo,这样在恢复出厂时不会丢失开机logo。然后通过修改u-boot/drivers/video/drm/rock......
  • rk3568移植搭建Ubuntu20.04.5根文件系统
    一.下载ubuntu-base https://cdimage.ubuntu.com/ubuntu-base/releases/20.04.5/release/ 下载固件:buntu-base-20.04.5-base-arm64.tar.gz 根文件系统创建目录ubuntu_rootfs,并解压到该目录:mkdirubuntu_rootfstar-zxvfubuntu-base-20.04.5-base-arm64.tar.gz-Cubuntu_root......
  • RK3568行业定制主板信号抗扰传导实验整改方案验证
    为了整改验证RK3568行业定制主板CAN口的抗干扰能力,在可靠性测试实验室内对定制主板进行了信号抗扰传导实验,其测试环境如下图所示。1. 实验目的图1.1测试实验环境 为了滤波,起到一个抗干扰的作用,需要对RK3568定制主板CAN口进行调整,如下图所示需要在L11位置的C82、C84增加两个......
  • 硬件开发笔记(十六):RK3568底板电路mipi摄像头接口原理图分析、mipi摄像头详解
    前言  本篇继续分析底板原理图mipi电路原理图、mipi摄像头输入硬件接口详解。<br>RK3568芯片摄像头接口  查看RK3568的芯片手册,摄像头接口并不支持直接sensor模拟信号输入,只能接收mipi信号,RK3568的摄像头接口引脚如下:    只支持mipi的数字信号摄像头。  本来计划......
  • 硬件开发笔记(十六):RK3568底板电路mipi摄像头接口原理图分析、mipi摄像头详解
    前言  本篇继续分析底板原理图mipi电路原理图、mipi摄像头输入硬件接口详解。 RK3568芯片摄像头接口  查看RK3568的芯片手册,摄像头接口并不支持直接sensor模拟信号输入,只能接收mipi信号,RK3568的摄像头接口引脚如下:    只支持mipi的数字信号摄像头。  本......
  • RK3568 AMP测试验证说明
    本文基于HD-RK3568-IOT评估板进行验证。1. RK3568 AMP SDK获取在虚拟机内创建rk356x-amp-sdk目录,后续在该目录下执行命令,在rockchip git库下载AMP SDK。 2. AMP功能验证目前在RK3568上分别验证了1linux+3hal、1linux+3rtt、3linux+1hal、3linux+1rtt一共4种模式;4种模......
  • Si24R03—低功耗 SOC 芯片(集成RISC-V内核+2.4GHz无线收发器)
    Si24R03是一款高度集成的低功耗SOC芯片,其集成了基于RISC-V核的低功耗MCU和工作在2.4GHzISM频段的无线收发器模块。MCU模块具有低功耗、LowPinCount、宽电压工作范围,集成了13/14/15/16位精度的ADC、LVD、UART、SPI、I2C、TIMER、WUP、IWDG、RTC等丰富的外设。内核采用RISC-VRV......