Android SDK:imx8_13.0.0_1.2.0(android 13 + u-boot 2022.04 + kernel 5.15.74)
一、内核修改
添加PID、VID。在“drivers/usb/serial/option.c”中可以看到EC25的PID和VID已经添加,而且这个EC25的PID和VID与EC20的相同,所以这里可以不用修改。
为了能支持QMI驱动还需要添加"drivers/net/usb/qmi_wwan_q.c",这个驱动可以向模块厂家索要。在合入下面patch。
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 697683e3f..3e1bb9881 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -2237,6 +2246,10 @@ static int option_probe(struct usb_serial *serial,if (iface_desc->bInterfaceClass == USB_CLASS_MASS_STORAGE)return -ENODEV;+ if (serial->dev->descriptor.idVendor == QUECTEL_VENDOR_ID &&
+ serial->dev->descriptor.idProduct == QUECTEL_PRODUCT_EC25 &&
+ serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4)
+ return -ENODEV;/** Don't bind reserved interfaces (like network ones) which often have* the same class/subclass/protocol as the serial interfaces. Look atdiff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index f21f25a8c..547ffee88 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -423,6 +423,7 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,struct usb_serial *serial = port->serial;struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);struct urb *urb;
+ struct usb_device_descriptor *desc = &serial->dev->descriptor;urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */if (!urb)
@@ -435,6 +436,13 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,if (intfdata->use_zlp && dir == USB_DIR_OUT)urb->transfer_flags |= URB_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 (desc->idVendor == cpu_to_le16(0x2c7c))
+ urb->transfer_flags |= URB_ZERO_PACKET;
+ }return urb;}diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index 4964f7b32..22386d8ef 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -37,7 +37,7 @@ obj-$(CONFIG_USB_NET_CX82310_ETH) += cx82310_eth.oobj-$(CONFIG_USB_NET_CDC_NCM) += cdc_ncm.oobj-$(CONFIG_USB_NET_HUAWEI_CDC_NCM) += huawei_cdc_ncm.oobj-$(CONFIG_USB_VL600) += lg-vl600.o
-obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan.o
+obj-$(CONFIG_USB_NET_QMI_WWAN) += qmi_wwan_q.oobj-$(CONFIG_USB_NET_CDC_MBIM) += cdc_mbim.oobj-$(CONFIG_USB_NET_CH9200) += ch9200.oobj-$(CONFIG_USB_NET_AQC111) += aqc111.o
二、Android修改
1.添加IRadio
diff --git a/imx8q/mek_8q/manifest.xml b/imx8q/mek_8q/manifest.xml
index 4bdd35f..d37f2ca 100644
--- a/imx8q/mek_8q/manifest.xml
+++ b/imx8q/mek_8q/manifest.xml
@@ -1,4 +1,10 @@<manifest version="1.0" type="device" target-level="7">
+ <hal format="hidl">
+ <name>android.hardware.radio</name>
+ <transport>hwbinder</transport>
+ <fqname>@1.5::IRadio/slot1</fqname>
+ <fqname>@1.2::ISap/slot1</fqname>
+ </hal><hal format="hidl"><name>android.hardware.graphics.allocator</name><transport>hwbinder</transport>diff --git a/imx8q/mek_8q/mek_8q.mk b/imx8q/mek_8q/mek_8q.mk
index 826b7f7..1c6716b 100644
--- a/imx8q/mek_8q/mek_8q.mk
+++ b/imx8q/mek_8q/mek_8q.mk
@@ -246,6 +261,37 @@ PRODUCT_PACKAGES += \PRODUCT_PROPERTY_OVERRIDES += \ro.rebootescrow.device=/dev/block/pmem0+PRODUCT_PACKAGES += \
+ libhidlbase.vendor \
+ libhwbinder.vendor \
+ android.hardware.secure_element@1.0 \
+ android.hardware.secure_element@1.1 \
+ android.hardware.secure_element@1.2 \
+ android.hardware.radio.config@1.0 \
+ android.hardware.radio.config@1.1 \
+ android.hardware.radio.config@1.2 \
+ android.hardware.radio@1.5-radio-service \
+ android.hardware.radio.config@1.2-service \
+ android.hardware.radio.config@1.0-service \
+ android.hardware.radio@1.5.vendor \
+ android.hardware.radio@1.3.vendor \
+ android.hardware.radio@1.4.vendor \
+ android.hardware.radio.deprecated@1.0.vendor \
+ android.hardware.radio.config@1.0.vendor \
+ android.hardware.radio.config@1.1.vendor \
+ android.hardware.radio.config@1.2.vendor \
+ android.hardware.radio@1.5-radio-service \
+ android.hardware.radio.config@1.2-service \
+ android.hardware.radio.config@1.0-service \
+ android.hardware.radio.config@1.0.vendor \
+ android.hardware.radio.config@1.2.vendor \
+ android.hardware.radio@1.5.vendor \
+ android.hardware.radio@1.5.vendor \
+ android.hardware.radio@1.6.vendor
+#DRM Widevine 1.4 L3 supportPRODUCT_PACKAGES += \android.hardware.drm-service.widevine \
还需要修改“hardware/interfaces/compatibility_matrices”中文件,不然编译的时候会提示“error:files are incompatible”。如下:
diff --git a/compatibility_matrices/compatibility_matrix.7.xml b/compatibility_matrices/compatibility_matrix.7.xml
index 26b8d63..dd86e9b 100644
--- a/compatibility_matrices/compatibility_matrix.7.xml
+++ b/compatibility_matrices/compatibility_matrix.7.xml
@@ -584,6 +584,20 @@<instance>slot3</instance></interface></hal>
+ <hal format="hidl" optional="true">
+ <name>android.hardware.radio</name>
+ <version>1.0</version>
+ <version>1.1</version>
+ <version>1.2</version>
+ <version>1.4</version>
+ <version>1.5</version>
+ <interface>
+ <name>IRadio</name>
+ <instance>slot1</instance>
+ <instance>slot2</instance>
+ <instance>slot3</instance>
+ </interface>
+ </hal><hal format="hidl" optional="true"><name>android.hardware.radio</name><version>1.2</version>
2.配置SELinux 权限
diff --git a/imx8q/mek_8q/sepolicy/file_contexts b/imx8q/mek_8q/sepolicy/file_contexts
index e72e8b9..fa6cdca 100644
--- a/imx8q/mek_8q/sepolicy/file_contexts
+++ b/imx8q/mek_8q/sepolicy/file_contexts
@@ -35,3 +35,11 @@/sys/devices/platform/bus@5f000000/5f000000.pcie/pci0000:00/0000:00:00.0/0000:01:00.1/wakeup u:object_r:sysfs_wakeup:s0#mek_8qxp/sys/devices/platform/bus@5f000000/5f010000.pcie/pci0000:00/0000:00:00.0/0000:01:00.1/wakeup u:object_r:sysfs_wakeup:s0
+
+# 4G module
+/dev/ttyUSB[0-9] u:object_r:radio_device:s0
+/dev/ttyACM[0-9] u:object_r:radio_device:s0
+/dev/cdc-wdm[0-9] u:object_r:radio_device:s0
+/dev/qcqmi[0-9] u:object_r:radio_device:s0
+/vendor/bin/hw/rild u:object_r:rild_exec:s0
+/dev/socket/rildOemHook u:object_r:rild_socket:s0--- a/imx8q/mek_8q/ueventd.nxp.rc
+++ b/imx8q/mek_8q/ueventd.nxp.rc
@@ -18,6 +18,10 @@/dev/dma_heap/reserved 0666 system system/dev/dma_heap/reserved-uncached 0666 system system/dev/dma_heap/secure 0666 system system
+/dev/ttyUSB* 0666 radio radio
+/dev/ttyACM* 0666 radio radio
+/dev/cdc-wdm* 0666 radio radio
+/dev/qcqmi* 0666 radio radio# iio sensor sysfs properities/dev/iio:device* 0660 system systemdiff --git a/system/core/init/devices.cpp b/system/core/init/devices.cpp
index d4a3cb9..52f3eaf 100644
--- a/system/core/init/devices.cpp
+++ b/system/core/init/devices.cpp
@@ -550,6 +550,8 @@ void DeviceHandler::HandleUevent(const Uevent& uevent) {int device_id = uevent.minor % 128 + 1;devpath = StringPrintf("/dev/bus/usb/%03d/%03d", bus_id, device_id);}
+ } else if (uevent.subsystem == "usbmisc" && !uevent.device_name.empty()) {
+ devpath = "/dev/" + uevent.device_name;} else if (StartsWith(uevent.subsystem, "usb")) {// ignore other USB eventsreturn;
添加"device/nxp/imx8q/sepolicy/rild.te"
allow rild usb_serial_device:chr_file { read write open ioctl };
allow rild rild:packet_socket { create bind write read };
3.添加ibreference-ril.so
diff --git a/imx8q/mek_8q/mek_8q.mk b/imx8q/mek_8q/mek_8q.mk
index 826b7f7..541e81f 100644
--- a/imx8q/mek_8q/mek_8q.mk
+++ b/imx8q/mek_8q/mek_8q.mk
@@ -94,8 +91,20 @@ PRODUCT_COPY_FILES += \$(CONFIG_REPO_PATH)/common/init/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh
+BOARD_HAVE_VENDOR_RIL := true #添加的目的是为了避开SDK中libreference.so的编译。
+PRODUCT_COPY_FILES += \
+ $(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/obj_arm/SHARED_LIBRARIES/android.hardware.secure_element@1.0_intermediates/android.hardware.secure_element@1.0.so:$(TARGET_COPY_OUT_VENDOR)/lib/android.hardware.secure_element@1.0.so \
+ $(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/obj_arm/SHARED_LIBRARIES/android.hardware.secure_element@1.1_intermediates/android.hardware.secure_element@1.1.so:$(TARGET_COPY_OUT_VENDOR)/lib/android.hardware.secure_element@1.1.so \
+ $(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/obj_arm/SHARED_LIBRARIES/android.hardware.secure_element@1.2_intermediates/android.hardware.secure_element@1.2.so:$(TARGET_COPY_OUT_VENDOR)/lib/android.hardware.secure_element@1.2.so \
+ $(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/obj/SHARED_LIBRARIES/android.hardware.secure_element@1.0_intermediates/android.hardware.secure_element@1.0.so:$(TARGET_COPY_OUT_VENDOR)/lib64/android.hardware.secure_element@1.0.so \
+ $(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/obj/SHARED_LIBRARIES/android.hardware.secure_element@1.1_intermediates/android.hardware.secure_element@1.1.so:$(TARGET_COPY_OUT_VENDOR)/lib64/android.hardware.secure_element@1.1.so \
+ $(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/obj/SHARED_LIBRARIES/android.hardware.secure_element@1.2_intermediates/android.hardware.secure_element@1.2.so:$(TARGET_COPY_OUT_VENDOR)/lib64/android.hardware.secure_element@1.2.so \
+ $(CONFIG_REPO_PATH)/common/lib/lib32/libreference-ril-ec20.so:$(TARGET_COPY_OUT_VENDOR)/lib/libreference-ril.so \
+ $(CONFIG_REPO_PATH)/common/lib/lib64/libreference-ril-ec20.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libreference-ril.so \
+ $(CONFIG_REPO_PATH)/common/lib/lib32/libril.so:$(TARGET_COPY_OUT_VENDOR)/lib/libril.so \
+ $(CONFIG_REPO_PATH)/common/lib/lib64/libril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libril.so \
+ $(CONFIG_REPO_PATH)/common/config/apns-conf.xml:$(TARGET_COPY_OUT_VENDOR)/etc/apns-conf.xml \
+ $(CONFIG_REPO_PATH)/common/config/ql-ril.conf:$(TARGET_COPY_OUT_VENDOR)/etc/ql-ril.conf# -------@block_storage-------# support metadata checksum during first stage mount@@ -246,6 +255,37 @@ PRODUCT_PACKAGES += \PRODUCT_PROPERTY_OVERRIDES += \ro.rebootescrow.device=/dev/block/pmem0+PRODUCT_PROPERTY_OVERRIDES += \
+ vendor.rild.libpath=/vendor/lib64/libreference-ril.so
+diff --git a/imx8q/ProductConfigCommon.mk b/imx8q/ProductConfigCommon.mk
index 4bbd20e..9a16c65 100644
--- a/imx8q/ProductConfigCommon.mk
+++ b/imx8q/ProductConfigCommon.mk
@@ -370,7 +370,7 @@ PRODUCT_PACKAGES += \# wifionly devicePRODUCT_PROPERTY_OVERRIDES += \
- ro.radio.noril=yes
+ ro.radio.noril=no# -------@block_bluetooth-------PRODUCT_PACKAGES += \
另外:因为没有用到SDK编译出来的"ibreference-ril.so",所以在mek_8q.mk中添加“BOARD_HAVE_VENDOR_RIL := true”,并修改"hardware/ril/reference-ril/Android.mk",进行条件编译。
diff --git a/reference-ril/Android.mk b/reference-ril/Android.mk
index 8aeba23..b7648ef 100644
--- a/reference-ril/Android.mk
+++ b/reference-ril/Android.mk
@@ -2,6 +2,7 @@# XXX using libutils for simulator build only...#
+ifneq ($(BOARD_HAVE_VENDOR_RIL),true)LOCAL_PATH:= $(call my-dir)include $(CLEAR_VARS)@@ -56,3 +57,4 @@ elseLOCAL_NOTICE_FILE:= $(LOCAL_PATH)/NOTICEinclude $(BUILD_EXECUTABLE)endif
+endif
4.其它修改
diff --git a/imx8q/mek_8q/overlay/frameworks/base/core/res/res/values/config.xml b/imx8q/mek_8q/overlay/frameworks/base/core/res/res/values/config.xml
index 298d50c..98fb56c 100755
--- a/imx8q/mek_8q/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/imx8q/mek_8q/overlay/frameworks/base/core/res/res/values/config.xml
@@ -76,6 +76,17 @@<item>"wifi,1,1,1,-1,true"</item><item>"bluetooth,7,7,2,-1,true"</item><item>"ethernet,9,9,2,-1,true"</item>
+ <item>"mobile,0,0,0,-1,true"</item>
+ <item>"mobile_mms,2,0,4,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>"wifi_p2p,13,1,0,-1,true"</item>
+ <item>"mobile_ia,14,0,2,-1,true"</item>
+ <item>"mobile_emergency,15,0,2,-1,true"</item></string-array><!-- Array of light sensor LUX values to define our levels for auto backlight brightness support.
@@ -189,13 +200,15 @@If true, this means that the device supports data connectivity throughthe telephony network.This can be overridden to false for devices that support voice and/or sms . -->
- <bool name="config_mobile_data_capable">false</bool>
+ <bool name="config_mobile_data_capable">true</bool>
+ <bool name="config_sms_capable">true</bool><!-- Boolean indicating whether system support sustained performance mode. --><bool name="config_sustainedPerformanceModeSupported">true</bool><!-- If the system has the input method for each display - enable per-display focus. --><bool name="config_perDisplayFocusEnabled">true</bool>
+ <bool name="config_enableWifiDisplay">true</bool><!-- show global actions menu when long press power button --><integer name="config_longPressOnPowerBehavior">1</integer>
5.修改默认网络
“imx8q/mek_8q/mek_8q.mk”中添加下面的内容可以修改“default_network”
PRODUCT_PROPERTY_OVERRIDES += ro.telephony.default_network=33,33,33,33
注意:后面的值在“frameworks/base/telephony/java/com/android/internal/telephony/RILConstants.java”中有定义,如下:
/* NETWORK_MODE_* See ril.h RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE *//** GSM, WCDMA (WCDMA preferred) */int NETWORK_MODE_WCDMA_PREF = 0;/** GSM only */int NETWORK_MODE_GSM_ONLY = 1;/** WCDMA only */int NETWORK_MODE_WCDMA_ONLY = 2;/** GSM, WCDMA (auto mode, according to PRL) */int NETWORK_MODE_GSM_UMTS = 3;/** CDMA and EvDo (auto mode, according to PRL) */int NETWORK_MODE_CDMA = 4;/** CDMA only */int NETWORK_MODE_CDMA_NO_EVDO = 5;/** EvDo only */int NETWORK_MODE_EVDO_NO_CDMA = 6;
....../** NR 5G, LTE, TD-SCDMA, CDMA, EVDO, GSM and WCDMA */int NETWORK_MODE_NR_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = 33;@UnsupportedAppUsageint PREFERRED_NETWORK_MODE = Optional.of(TelephonyProperties.default_network()).filter(list -> !list.isEmpty()).map(list -> list.get(0)).orElse(NETWORK_MODE_WCDMA_PREF); # 这里TelephonyProperties.default_network()对应的"system/libsysprop/srcs/android/sysprop/TelephonyProperties.sysprop"中的
prop {api_name: "default_network"type: IntegerListscope: Internalaccess: Readonlyprop_name: "ro.telephony.default_network"
}
从最后一段代码可以看到,当ro.telephony.default_network没有指定时,系统默认用的是“NETWORK_MODE_WCDMA_PREF”。所以通过指定ro.telephony.default_network的值可以修改默认网络。
三、遇到问题的解决
1.编译过程copy出错。
这种错误的原因是系统已经编译过需要的库了,如果需要用自己的去替换原来的,或者将原来的移动位置,都会上报这个错误。
解决办法:
在BoardConfigCommon.mk中添加下面内容:
BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true #这个不是为了解决上面的问题,但是建议一起添加
BUILD_BROKEN_DUP_RULES := true
2.编译出错log如下:
这个错误是因为编译过程中会对"device/nxp/imx8q/mek_8q/manifest.xml"和"hardware/interfaces/compatibility_matrices/compatibility_matrix.7.xml"进行匹配,如果匹配失败会报错。另外"hardware/interfaces/compatibility_matrices"这个下面有多个xml文件,具体和哪个匹配取决于"manifest.xml"第一行中"target-level"对应的值。
解决办法:
device/nxp/imx8q/mek_8q/manifest.xml添加如下代码:
hardware/interfaces/compatibility_matrices/compatibility_matrix.7.xml中做如下修改:
3.ril运行提示找不到android.hardware.secure_element@1.0.so
解决办法:
先去系统的"/system/lib64"和"/vendor/lib64"目录下找一些看有没有响应的库,如果没有,在"mek_8q.mk"中添加如下内容:
PRODUCT_PACKAGES += \libhidlbase.vendor \libhwbinder.vendor \android.hardware.secure_element@1.0 \android.hardware.secure_element@1.1 \android.hardware.secure_element@1.2 \android.hardware.radio.config@1.0 \android.hardware.radio.config@1.1 \android.hardware.radio.config@1.2 \android.hardware.radio@1.5-radio-service \android.hardware.radio.config@1.2-service \android.hardware.radio.config@1.0-service \android.hardware.radio@1.5.vendor \android.hardware.radio@1.3.vendor \android.hardware.radio@1.4.vendor \android.hardware.radio.deprecated@1.0.vendor \android.hardware.radio.config@1.0.vendor \android.hardware.radio.config@1.1.vendor \android.hardware.radio.config@1.2.vendor \android.hardware.radio@1.5-radio-service \android.hardware.radio.config@1.2-service \android.hardware.radio.config@1.0-service \android.hardware.radio.config@1.0.vendor \android.hardware.radio.config@1.2.vendor \android.hardware.radio@1.5.vendor \android.hardware.radio@1.5.vendor \android.hardware.radio@1.6.vendor
如果还提示错误,参照下面的修改"mek_8q.mk"将"android.hardware.secure_element@1.*“复制到”/vendor/lib64"目录下。
PRODUCT_COPY_FILES += \$(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/obj_arm/SHARED_LIBRARIES/android.hardware.secure_element@1.0_intermediates/android.hardware.secure_element@1.0.so:$(TARGET_COPY_OUT_VENDOR)/lib/android.hardware.secure_element@1.0.so \$(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/obj_arm/SHARED_LIBRARIES/android.hardware.secure_element@1.1_intermediates/android.hardware.secure_element@1.1.so:$(TARGET_COPY_OUT_VENDOR)/lib/android.hardware.secure_element@1.1.so \$(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/obj_arm/SHARED_LIBRARIES/android.hardware.secure_element@1.2_intermediates/android.hardware.secure_element@1.2.so:$(TARGET_COPY_OUT_VENDOR)/lib/android.hardware.secure_element@1.2.so \$(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/obj/SHARED_LIBRARIES/android.hardware.secure_element@1.0_intermediates/android.hardware.secure_element@1.0.so:$(TARGET_COPY_OUT_VENDOR)/lib64/android.hardware.secure_element@1.0.so \$(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/obj/SHARED_LIBRARIES/android.hardware.secure_element@1.1_intermediates/android.hardware.secure_element@1.1.so:$(TARGET_COPY_OUT_VENDOR)/lib64/android.hardware.secure_element@1.1.so \$(OUT_DIR)/target/product/$(firstword $(PRODUCT_DEVICE))/obj/SHARED_LIBRARIES/android.hardware.secure_element@1.2_intermediates/android.hardware.secure_element@1.2.so:$(TARGET_COPY_OUT_VENDOR)/lib64/android.hardware.secure_element@1.2.so
4.系统提示找不到android.hardware.radio@1.5::IRadio/slot1。
解决办法:
利用移远提供的’libril.so"替换系统原有的’libril.so"。修改"mek_8q.mk"中添加如下内容:
PRODUCT_COPY_FILES += \$(CONFIG_REPO_PATH)/common/lib/lib32/libril.so:$(TARGET_COPY_OUT_VENDOR)/lib/libril.so \$(CONFIG_REPO_PATH)/common/lib/lib64/libril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libril.so
另外如果libreference-ril.so和libril.so不匹配的时候好像也报这个错误。网上有通过修改init.cpp、ServiceManager.cpp、ServiceManagement.cpp来解决这个错误,但看了下都是对输出log的操作。调试过程中我遇到这个错误的时候系统的4G图标不能显示,"logcat -b radio"查看log,发现ril库已经跑起来了,有AT命令的输出结果,但是就是无法上网。ifconfig查看相应的网卡也没有自动获取到IP。
5.有显示信号图标,但是无法上网,也不显示3G、4G的图标。手动添加APN后恢复正常。
解决办法:
"logcat -v time | grep apns"看一下"apns-conf.xml"放的位置是不是正常。
如果位置错误的话修改"imx8q/mek_8q/mek_8q.mk"中"apns-conf.xml"的copy位置。
PRODUCT_COPY_FILES += \$(CONFIG_REPO_PATH)/common/config/apns-conf.xml:system/etc/apns-conf.xml \
另外就是查看SIM卡对应的APN是否被正常识别。下图是一个46008未被识别的错误log。
其中46008在“apns-config.xml”对应的字段是mcc=“460” mnc=“07”。然后参考xml中其它的配置,将新的APN添加到“apns-config.xml”中。这里可以通过“adb push”推入系统中进行验证,但是需要删除系统的“telephony.db”,重启系统,才能生效。