调试前先找模块厂获取相关资料
Kernel修改:
可用RK的参考配置来控制,把原理图对应角位配置上就行。
rk_modem: rk-modem {compatible="4g-modem-platdata";pinctrl-names = "default";pinctrl-0 = <<e_vbat <e_power_en <e_reset>;4G,vbat-gpio = <&gpio4 RK_PD0 GPIO_ACTIVE_HIGH>;4G,power-gpio = <&gpio4 RK_PC6 GPIO_ACTIVE_LOW>;4G,reset-gpio = <&gpio4 RK_PD4 GPIO_ACTIVE_LOW>;status = "okay";};
添加模块VID,PID
kernel-5.10:--- a/drivers/usb/serial/option.c+++ b/drivers/usb/serial/option.c@@ -97,6 +97,18 @@ static void option_instat_callback(struct urb *urb); #define YISO_VENDOR_ID 0x0EAB #define YISO_PRODUCT_U893 0xC893 ++#define FIBOCOM_VENDOR_ID 0x2cb7+#define FIBOCOM_PRODUCT_L71X 0x0001++#define FIBOCOM_USB_VENDOR_AND_INTERFACE_INFO(vend, cl, sc, pr) \+.match_flags = USB_DEVICE_ID_MATCH_INT_INFO \+| USB_DEVICE_ID_MATCH_VENDOR, \+.idVendor = (vend), \+.bInterfaceClass = (cl), \+.bInterfaceSubClass = (sc), \+.bInterfaceProtocol = (pr)+ @@ -2188,6 +2205,16 @@ static int option_probe(struct usb_serial *serial, if (iface_desc->bInterfaceClass == USB_CLASS_MASS_STORAGE) return -ENODEV; + if(serial->dev->descriptor.idVendor == FIBOCOM_VENDOR_ID &&+ serial->dev->descriptor.idProduct == FIBOCOM_PRODUCT_L71X &&+ serial->interface->cur_altsetting->desc.bInterfaceClass == 0x7)+ return -ENODEV;++ if(serial->dev->descriptor.idVendor == ZTE_VENDOR_ID &&+ serial->dev->descriptor.idProduct == 0x0579 &&+ serial->interface->cur_altsetting->desc.bInterfaceClass == 0x6)+ return -ENODEV;+ if ((dev->driver_info->flags & FLAG_WLAN) != 0) strcpy(net->name, "wlan%d");
以上修改完成后编译烧录进机器查看是否生成对应设备
console:/ # lsusb Bus 006 Device 003: ID 2cb7:0001console:/ # ifconfig -ausb0 Link encap:Ethernet HWaddr 34:4b:50:00:00:00 Driver cdc_ether BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 TX bytes:0console:/ # ls /dev/ttyUSB* /dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2 /dev/ttyUSB3
问题排查:
如未生成对应节点先排查供电是否正常。
在排查主控对应USB phy节点是否打开
模块需保证 VBUS 信号连接到 5V 供电,若此信号悬空,USB 口无法正常枚举
Android修改:
1.启动ril进程
hardware/ril--- a/rild/rild.rc+++ b/rild/rild.rc@@ -1,5 +1,6 @@-service vendor.ril-daemon /vendor/bin/hw/rild+service ril-daemon /vendor/bin/hw/rild -l /vendor/lib64/libreference-ril-l716.so class main- user radio- group radio cache inet misc audio log readproc wakelock- capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW+ socket rild stream 660 root radio+ socket rild-debug stream 660 radio system+ user root+ group radio cache inet misc audio sdcard_rw log启动rild进程加载对应ril库-l 指定 RIL 库加载路径
2.打开系统4G服务
device/rockchip/common/BoardConfig.mkBOARD_HAS_RK_4G_MODEM ?= true
3.打开BOARD_HAS_RK_4G_MODEM选项后会有一些报错,添加如下补丁:(如打开宏没有报错不用添加下面补丁,rk3568可以直接编译,目前发现rk3588 android12会报错)
/vendor/rockchip/common:--- a/phone/phone.mk+++ b/phone/phone.mk@@ -26,8 +26,8 @@ PRODUCT_PACKAGES += \ chat PRODUCT_PROPERTY_OVERRIDES +=ro.boot.noril=false-else-PRODUCT_PROPERTY_OVERRIDES +=ro.boot.noril=true+# else+# PRODUCT_PROPERTY_OVERRIDES +=ro.boot.noril=true endif
/device/rockchip/common:--- a/modules/4g_modem.mk+++ b/modules/4g_modem.mk@@ -38,8 +38,8 @@ PRODUCT_PROPERTY_OVERRIDES += \ vendor.rild.libpath=/vendor/lib64/librk-ril.so PRODUCT_COPY_FILES += \- $(LOCAL_PATH)/4g_modem/bin64/dhcpcd:$(TARGET_COPY_OUT_VENDOR)/bin/dhcpcd \- $(LOCAL_PATH)/4g_modem/lib64/librk-ril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/librk-ril.so+ $(LOCAL_PATH)/../4g_modem/bin64/dhcpcd:$(TARGET_COPY_OUT_VENDOR)/bin/dhcpcd \+ $(LOCAL_PATH)/../4g_modem/lib64/librk-ril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/librk-ril.so
hardware/interfaces:--- a/compatibility_matrices/compatibility_matrix.6.xml+++ b/compatibility_matrices/compatibility_matrix.6.xml@@ -434,6 +434,11 @@ android.hardware.radio + 1.1 + 1.2 + 1.3 + 1.4 + 1.5 1.6 IRadio @@ -450,11 +455,20 @@ slot1 + + android.hardware.radio.deprecated + 1.0 + + IOemHook + slot1 + + android.hardware.radio.config + 1.0 1.1 IRadioConfig
4.添加模块厂提供ril库编译并指定ril库路径
所需文件:libreference-ril-l716.so
ght_ril_config.ini
将文件拷贝到/device/rockchip/common/lib64目录
添加如下代码拷贝到系统
/device/rockchip/common:--- a/modules/4g_modem.mk+++ b/modules/4g_modem.mk@@ -35,11 +35,12 @@ DEVICE_MANIFEST_FILE += device/rockchip/common/4g_modem/manifest.xml ifeq ($(strip $(TARGET_ARCH)), arm64) PRODUCT_PROPERTY_OVERRIDES += \- vendor.rild.libpath=/vendor/lib64/librk-ril.so+ vendor.rild.libpath=/vendor/lib64/libreference-ril-l716.so PRODUCT_COPY_FILES += \- $(LOCAL_PATH)/4g_modem/bin64/dhcpcd:$(TARGET_COPY_OUT_VENDOR)/bin/dhcpcd \- $(LOCAL_PATH)/4g_modem/lib64/librk-ril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/librk-ril.so+ $(LOCAL_PATH)/../4g_modem/bin64/dhcpcd:$(TARGET_COPY_OUT_VENDOR)/bin/dhcpcd \+ $(LOCAL_PATH)/../4g_modem/lib64/libreference-ril-l716.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libreference-ril-l716.so \+ $(LOCAL_PATH)/../4g_modem/lib64/ght_ril_config.ini:system/etc/ght_ril_config.ini else PRODUCT_PROPERTY_OVERRIDES += \ vendor.rild.libpath=/vendor/lib/librk-ril.so
5.修改模块所需prop属性
device/rockchip/rk3588:--- a/device.mk+++ b/device.mk@@ -82,6 +82,9 @@ PRODUCT_PROPERTY_OVERRIDES += \ ro.ril.ecclist=112,911 \ ro.opengles.version=196610 \ wifi.interface=wlan0 \+ rild.libargs=-d /dev/ttyUSB2 \+ ril.fibocom.dialmode=1 \+ ril.fibocom.NetifName=usb0 \参数说明:rild.libargs AT指令端口,可询问模块厂或向端口发送AT指令可得知,一般只ttyUSB1 ttyUSB2ril.fibocom.dialmode 拨号模式 / 0 : ppp 拨号, 1 : ECM 拨号 //推荐使用ECMril.fibocom.NetifName 自定义拨号网卡,根据实际生成网卡填写
6.添加信号图标,4G图标
/device/rockchip/common:--- a/overlay_wifi_only/frameworks/base/core/res/res/values/config.xml+++ b/overlay_wifi_only/frameworks/base/core/res/res/values/config.xml@@ -22,5 +22,5 @@ If true, this means that the device supports data connectivity through the telephony network. This can be overridden to false for devices that support voice and/or sms . -->- false + true /device/rockchip/rk3588:--- a/overlay/frameworks/base/core/res/res/values/config.xml+++ b/overlay/frameworks/base/core/res/res/values/config.xml@@ -31,6 +31,14 @@ - "wifi,1,1,2,-1,true"
+ - "mobile,0,0,0,-1,true"
+ - "mobile_mms,2,0,2,60000,false"
+ - "mobile_supl,3,0,2,60000,true"
+ - "mobile_dun,4,0,2,60000,true"
+ - "mobile_hipri,5,0,3,60000,true"
+ - "mobile_fota,10,0,2,60000,true"
+ - "mobile_ims,11,0,2,60000,true"
+ - "mobile_cbs,12,0,2,60000,true"
- "bluetooth,7,7,0,-1,true"
- "ethernet,9,9,9,-1,true"
7.编译Android烧录
8.系统界面显示
FAQ:如有问题按如下方式排查:
9.编译完成后查看系统属性是否已经设置成功
console:/ # getprop | grep ril [init.svc.ril-daemon]: [running][init.svc_debug_pid.ril-daemon]: [505][ril.currentapntype]: [default][ril.fibocom.NetifName]: [usb0][ril.fibocom.dialmode]: [1][ril.fibocom.version]: [Fibocom_RIL_V12X.06.V1.0.7][ril.function.dataonly]: [1][rild.libargs]: [-d][ro.boot.noril]: [false][ro.boottime.ril-daemon]: [5861295027][ro.ril.ecclist]: [112,911][vendor.rild.libpath]: [/vendor/lib64/libreference-ril-l716.so]
9.1查看rild进程是否启动
console:/ # ps -ef | grep rildroot 505 1 0 10:03:39 ? 00:00:00 rild -l /vendor/lib64/libreference-ril-l716.soroot 19667 2210 3 10:43:59 ttyFIQ0 00:00:00 grep rild
9.2AT指令排查
输入AT指令到对应端口号查看是否检测到SIM卡开两个adb端口,一个执行echo,一个执行catecho -e "AT+CPIN?" > /dev/ttyUSB2cat /dev/ttyUSB2CPIN: READY查看信号强度:echo -e "AT+CSQ\r\n" >/dev/ttyUSB2cat /dev/ttyUSB2+CSQ: 14,99
9.3 ifconfig -a查看网卡是否启动,如未启动,手动执行ifoconfig usb0 up,或者进入设置--网络选项
9.4 ping网络测试
如有问题请确认ril库是否对应模块及Android版本,系统是否已经加载上了ril库
adb logcat –b radio –v time 分析日志,结合AT指令排查,或将log发给模块厂帮忙看看。
来源地址:https://blog.csdn.net/qq1226176787/article/details/129715489