RK3568 开发板 安卓系统之4G模块驱动调试(十四)-rk3588 开发板

4.11 在RK3568开发板上调试4G(EC20)驱动

4.11.1 查看 RK3568 关于4G模块的原理图,获取需要配置的信息

RK3568 开发板 安卓系统之4G模块驱动调试(十四)-rk3588 开发板

4.11.2 需要配置的信息如下

1 4G模块电源使能引脚GPIO4_C3

2 4G模块W_DISABLE1引脚GPIO4_B5

3 4G模块复位引脚GPIO4_B4

4.11.3 DTS配置如下

{ rk_modem: rk-modem { compatible=”4g-modem-platdata”; pinctrl-names = “default”; pinctrl-0 = <&lte_vbat &lte_reset &lte_pwr>; 4G,vbat-gpios = <&gpio4 RK_PC3 GPIO_ACTIVE_HIGH>; 4G,power-gpios = <&gpio4 RK_PB5 GPIO_ACTIVE_LOW>; 4G,reset-gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; status = “okay”; }; };

4.11.4 内核驱动增加对EC20的支持

由于改动较多,步骤不详细叙说,具体参数移远提供的移植文档《Quectel_LTE&5G_Linux_USB_Driver_User_Guide_V2.0.pdf》,说得很详细。

修改驱动

4.11.5 关闭selinux,打开4G模块支持

diff –git a/device/rockchip/common/BoardConfig.mk b/device/rockchip/common/BoardConfig.mk index e28fd4b43d..5a34fe5996 100755 — a/device/rockchip/common/BoardConfig.mk +++ b/device/rockchip/common/BoardConfig.mk @@ -59,7 +59,7 @@ BOARD_BOOT_HEADER_VERSION ?= 2 BOARD_MKBOOTIMG_ARGS := BOARD_PREBUILT_DTBOIMAGE ?= $(TARGET_DEVICE_DIR)/dtbo.img BOARD_ROCKCHIP_VIRTUAL_AB_ENABLE ?= false -BOARD_SELINUX_ENFORCING ?= true +BOARD_SELINUX_ENFORCING ?= false # Use the non-open-source parts, if theyre present TARGET_PREBUILT_KERNEL ?= kernel/arch/arm/boot/zImage @@ -439,9 +439,9 @@ BOARD_WIFI_SUPPORT ?= true #for rk 4g modem BOARD_HAS_RK_4G_MODEM ?= false -ifeq ($(strip $(BOARD_HAS_RK_4G_MODEM)),true) -DEVICE_MANIFEST_FILE += device/rockchip/common/4g_modem/manifest.xml -endif +# ifeq ($(strip $(BOARD_HAS_RK_4G_MODEM)),true) +# DEVICE_MANIFEST_FILE += device/rockchip/common/4g_modem/manifest.xml +# endif #USE_CLANG_PLATFORM_BUILD ?= true
<

4.11.6 去掉原有vendor.rild.libpath配置

diff –git a/device/rockchip/common/device.mk b/device/rockchip/common/device.mk index 917e8b909a..4d83c11d24 100644 — a/device/rockchip/common/device.mk +++ b/device/rockchip/common/device.mk @@ -273,8 +273,8 @@ PRODUCT_PROPERTY_OVERRIDES += \ ro.telephony.default_network=9 ifeq ($(strip $(TARGET_ARCH)), arm64) -PRODUCT_PROPERTY_OVERRIDES += \ – vendor.rild.libpath=/vendor/lib64/librk-ril.so +# 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 \

4.11.7 去掉电话功能

diff –git a/device/rockchip/common/init.rk30board.rc b/device/rockchip/commo n/init.rk30board.rc index 6b8f9ec25d..cf913d114a 100755 — a/device/rockchip/common/init.rk30board.rc +++ b/device/rockchip/common/init.rk30board.rc @@ -253,9 +253,9 @@ on property:persist.internet_adb_enable=0 restart adbd # for telephony function -on property:ro.boot.noril=true – setprop ro.radio.noril true – stop ril-daemon +#on property:ro.boot.noril=true +# setprop ro.radio.noril true +# stop ril-daemon # set ro.serialno on property:vendor.serialno=*

4.11.8 添加4G模块的hidl配置

diff –git a/device/rockchip/common/manifest.xml b/device/rockchip/common/man ifest.xml index 18ed438f6e..f3c7ce172a 100755 — a/device/rockchip/common/manifest.xml +++ b/device/rockchip/common/manifest.xml @@ -66,6 +66,31 @@ <instance>default</instance> </interface> </hal> + <hal format=”hidl”> + <name>android.hardware.radio</name> + <transport>hwbinder</transport> + <fqname>@1.1::IRadio/slot1</fqname> + <fqname>@1.1::IRadio/slot2</fqname> + <fqname>@1.2::ISap/slot1</fqname> + </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.config</name> + <transport>hwbinder</transport> + <version>1.0</version> + <interface> + <name>IRadioConfig</name> + <instance>default</instance> + </interface> + </hal> <kernel target-level=”5″/> </manifest>
<

4.11.9 修改file_contexts文件

diff –git a/device/rockchip/common/sepolicy/vendor/file_contexts b/device/ro ckchip/common/sepolicy/vendor/file_contexts index 03f49c0111..7db021dc61 100644 — a/device/rockchip/common/sepolicy/vendor/file_contexts +++ b/device/rockchip/common/sepolicy/vendor/file_contexts @@ -222,3 +222,10 @@ /vendor/bin/flash_img.sh u:object_r:vendor_install_recovery_exec:s0 # vibrator aidl /(vendor|system/vendor)/bin/hw/android\.hardware\.vibrator-service\.rockchip u:object_r:hal_vibrator_default_exec:s0 + +/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

4.11.10 添加rild.te文件,内容如下

diff –git a/device/rockchip/common/sepolicy/vendor/rild.te b/device/rockchip /common/sepolicy/vendor/rild.te new file mode 100644 index 0000000000..03ec17da4c — /dev/null +++ b/device/rockchip/common/sepolicy/vendor/rild.te @@ -0,0 +1 @@ +allow rild self:packet_socket { create bind write read }; \ No newline at end of file

4.11.11 修改ueventd.rockchip.rc文件,给4G模块读写权限

diff –git a/device/rockchip/common/ueventd.rockchip.rc b/device/rockchip/com mon/ueventd.rockchip.rc index 8b92518050..ce7e01bb6a 100755 — a/device/rockchip/common/ueventd.rockchip.rc +++ b/device/rockchip/common/ueventd.rockchip.rc @@ -192,3 +192,10 @@ # for sensors /dev/input/event* 0666 input system + +#quectel port +/dev/ttyUSB* 0660 radio radio +/dev/ttyACM* 0660 radio radio +/dev/cdc-wdm* 0660 radio radio +/dev/qcqmi* 0660 radio radio +/dev/cdc-acm* 0660 radio radio \ No newline at end of file

4.11.12 将移植提供的libquectel-ril整个拷贝到device/rockchip/rk356x/目录下并改名为ec20

RK3568 开发板 安卓系统之4G模块驱动调试(十四)-rk3588 开发板

4.11.13 添加4G模块vendor.rild.libpath的配置

diff –git a/device/rockchip/rk356x/rk3568_aybering/rk3568_aybering.mk b/device/rockchip/rk356x/rk3568_aybering/rk3568_aybering.mk index 9f2d30b7dc..5dffe5e74c 100644 — a/device/rockchip/rk356x/rk3568_aybering/rk3568_aybering.mk +++ b/device/rockchip/rk356x/rk3568_aybering/rk3568_aybering.mk @@ -43,3 +43,18 @@ PRODUCT_PROPERTY_OVERRIDES += ro.sf.lcd_density=160 PRODUCT_PROPERTY_OVERRIDES += ro.wifi.sleep.power.down=true PRODUCT_PROPERTY_OVERRIDES += persist.wifi.sleep.delay.ms=0 PRODUCT_PROPERTY_OVERRIDES += persist.bt.power.down=true + +#20220821 hale 添加4g模块 +PRODUCT_MODEM := EC20 +ifeq ($(strip $(PRODUCT_MODEM)), EC20) +BOARD_HAS_RK_4G_MODEM := true + +PRODUCT_PROPERTY_OVERRIDES += \ + vendor.rild.libpath=/vendor/lib64/hw/libreference-ril.so +#PRODUCT_PROPERTY_OVERRIDES += \ +# vendor.rild.libargs=-d /dev/ttyUSB2 + +PRODUCT_COPY_FILES += \ + $(LOCAL_PATH)/../ec20/arm64-v8a/libreference-ril.so:vendor/lib64/hw/libreference-ril.so +endif +#20220821 hale 添加4g模块结束 \ No newline at end of file
<

4.11.14 修改system/core/init/devices.cpp文件

diff –git a/system/core/init/devices.cpp b/system/core/init/devices.cpp index 9fbec641be..feb517fe08 100644 — a/system/core/init/devices.cpp +++ b/system/core/init/devices.cpp @@ -492,6 +492,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 events return;

4.11.15 修改hardware/ril/rild/rild.rc文件

diff –git a/hardware/ril/rild/rild.rc b/hardware/ril/rild/rild.rc index f6beb5468f..d259206f70 100644 — a/hardware/ril/rild/rild.rc +++ b/hardware/ril/rild/rild.rc @@ -1,5 +1,5 @@ service vendor.ril-daemon /vendor/bin/hw/rild class main – user radio – group radio cache inet misc audio log readproc wakelock + user root + group radio cache inet misc audio sdcard_rw log capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW

4.11.16 修改vendor/rockchip/common/phone/etc/apns-full-conf.xml文件,支持物联网卡

diff –git a/vendor/rockchip/common/phone/etc/apns-full-conf.xml b/vendor/rockchip/common/phone/etc/apns-full-conf.xml index 5718e10ae8..67cdc2b1c2 100644 — a/vendor/rockchip/common/phone/etc/apns-full-conf.xml +++ b/vendor/rockchip/common/phone/etc/apns-full-conf.xml @@ -35498,4 +35498,10 @@ mvno_type=”spn” mvno_match_data=”IENTC” /> + <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>

4.11.17 修改device/rockchip/rk356x/overlay/frameworks/base/core/res/res/values/config.xml文件

diff –git a/device/rockchip/rk356x/overlay/frameworks/base/core/res/res/values/config.xml b/device/rockchip/rk356x/overlay/frameworks/base/core/res/res/values/config.xml index 9feb244b2c..2bacfc2ed1 100755 — a/device/rockchip/rk356x/overlay/frameworks/base/core/res/res/values/config.xml +++ b/device/rockchip/rk356x/overlay/frameworks/base/core/res/res/values/config.xml @@ -31,6 +31,14 @@ <!– the 6th element indicates boot-time dependency-met value. –> <string-array translatable=”false” name=”networkAttributes”> <item>”wifi,1,1,2,-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>”bluetooth,7,7,0,-1,true”</item> <item>”ethernet,9,9,9,-1,true”</item> </string-array>

4.11.18 编译固件后,烧写固件验证

在启动的时候,可以看到串口打印有以下信息,说明正常识别到EC20的PID和VID了

[ 8.606334] usb 1-1.2: New USB device found, idVendor=2c7c, idProduct=0125, bcdDevice= 3.18 [ 8.606363] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 8.606370] usb 1-1.2: Product: Android [ 8.606375] usb 1-1.2: Manufacturer: Android [ 8.607844] option 1-1.2:1.0: GSM modem (1-port) converter detected [ 8.608369] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB0 [ 8.608901] option 1-1.2:1.1: GSM modem (1-port) converter detected [ 8.609821] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB1 [ 8.610600] option 1-1.2:1.2: GSM modem (1-port) converter detected [ 8.611158] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB2 [ 8.611731] option 1-1.2:1.3: GSM modem (1-port) converter detected [ 8.612197] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB3 [ 8.613625] qmi_wwan_q 1-1.2:1.4: cdc-wdm0: USB WDM device [ 8.613958] qmi_wwan_q 1-1.2:1.4: Quectel Android work on RawIP mode [ 8.614960] qmi_wwan_q 1-1.2:1.4: rx_urb_size = 1520 [ 8.615723] qmi_wwan_q 1-1.2:1.4 wwan0: register qmi_wwan_q at usb-fd800000.usb-1.2, WWAN/QMI device, b6:5a:cb:79:19:c1

开机会,等一段时间后,可以看到在状态栏上有4G图标了,执行以下操作

rk3568_aybering:/ # ifconfig wwan0 Link encap:Ethernet HWaddr b6:5a:cb:79:19:c1 Driver qmi_wwan_q inet addr:10.9.62.219 Mask:255.255.255.248 inet6 addr: 240e:47d:32e0:527b:b45a:cbff:fe79:19c1/64 Scope: Global inet6 addr: 240e:47d:32e0:527b:557b:bafa:c6e:3fe6/64 Scope: Global inet6 addr: fe80::b45a:cbff:fe79:19c1/64 Scope: Link UP RUNNING NOARP MTU:1500 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:22 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1107 TX bytes:1442 … rk3568_aybering:/ # ping www.baidu.com PING www.a.shifen.com (14.215.177.39) 56(84) bytes of data. 64 bytes from 14.215.177.39: icmp_seq=1 ttl=54 time=65.8 ms 64 bytes from 14.215.177.39: icmp_seq=2 ttl=54 time=69.7 ms 64 bytes from 14.215.177.39: icmp_seq=3 ttl=54 time=69.5 ms 64 bytes from 14.215.177.39: icmp_seq=4 ttl=54 time=76.8 ms 64 bytes from 14.215.177.39: icmp_seq=5 ttl=54 time=71.4 ms ^C — www.a.shifen.com ping statistics — 5 packets transmitted, 5 received, 0% packet loss, time 4006ms rtt min/avg/max/mdev = 65.851/70.665/76.806/3.566 ms rk3568_aybering:/ #
<

通过以上信息,可以看到,已经可以正常联网了。

4.11.19 调试过程中碰到的问题,能正常上网,但没图标

问题是在device/rockchip/rk356x/overlay/frameworks/base/core/res/res/values/config.xml添加信息不全造成的。

注意:以下这一行不加会导致能正常上网,但在状态栏无移动数据的图标

<item>”mobile,0,0,0,-1,true”</item> 特别说明

RK3568开发板产品链接

免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:RK3568 开发板 安卓系统之4G模块驱动调试(十四)-rk3588 开发板 https://www.yhzz.com.cn/a/9700.html

上一篇 2023-04-20 18:01:52
下一篇 2023-04-20 18:04:18

相关推荐

联系云恒

在线留言: 我要留言
客服热线:400-600-0310
工作时间:周一至周六,08:30-17:30,节假日休息。