-> Device Drivers
-> -*- Network device support
-> USB Network Adapters
-> -*- Multi-purpose USB Networking Framework
Device Drivers --->
[*] USB support --->
<*> USB Serial Converter support
[*] USB Generic Serail Driver
[*] USB Driver for GSM and CMDA modems
-> Device Drivers
-> [*] USB support
-> <*> Support for Host-side USB
-> <*> USB Modem (CDC ACM) support
Device Drivers --->
[*] Network device support --->
<*> PPP (point-to-point protocol) support
<*> PPP support for async serial ports
<*> PPP support for sync tty ports
<*> PPP Deflate compression
rk3288_Android10:/ $ lsusb
Bus 001 Device 005: ID 2c7c:6005
这里解释一下信息,“2c7c”指的是VID,“6005”指的是PID。
#define QUECTEL_VENDOR_ID 0x2c7c /* VID */
#define QUECTEL_PRODUCT_EC200A_CN 0x6005 /* PID */
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200A_CN) }, /* Quectel EC200A */
#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(MDM9215)'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);
struct usb_interface_descriptor *intf = &serial->interface->cur_altsetting->desc;
if (intf->bInterfaceClass != 0xFF || intf->bInterfaceSubClass == 0x42) {
//ECM, RNDIS, NCM, MBIM, ACM, UAC, ADB
return -ENODEV;
}
if ((idProduct&0xF000) == 0x0000) {
//MDM interface 4 is QMI
if (intf->bInterfaceNumber == 4 && intf->bNumEndpoints == 3
&& intf->bInterfaceSubClass == 0xFF && intf->bInterfaceProtocol == 0xFF)
return -ENODEV;
}
}
#endif
.reset_resume = usb_wwan_resume,
#if 1 //Added by Quectel for Zero Packet
if (dir == USB_DIR_OUT) {
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
[ 2537.919546] option 1-1.4:1.2: GSM modem (1-port) converter detected
[ 2537.920339] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB0
[ 2537.921527] option 1-1.4:1.3: GSM modem (1-port) converter detected
[ 2537.922340] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB1
[ 2537.923486] option 1-1.4:1.4: GSM modem (1-port) converter detected
[ 2537.924214] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB2
再使用ls /dev/ttyUSB*命令查看,如下:
rk3288_Android10:/ $ ls /dev/ttyUSB*
/dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2
BOARD_SELINUX_ENFORCING ?= false
当BOARD_SELINUX_ENFORCING设置为1时,表示SELinux处于强制执行模式;当设置为0时,表示SELinux处于宽松模式。在强制执行模式下,SELinux会严格限制应用程序和系统服务的权限,确保它们只能访问其被授权的资源。
如果编译时报android.hardware.radio.deprecated这个错误,那么就是BOARD_HAS_RK_4G_MODEM引起的错误。
解决方法:
a\device\rockchip\common\manifest.xml
<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>
- <kernel target-level="5"/>
</manifest>
a\device\rockchip\common\4g_modem\manifest.xml
<manifest version="1.0" type="device">
<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>
+ <name>android.hardware.radio</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
- <name>IRadioConfig</name>
+ <name>IRadio</name>
- <instance>default</instance>
+ <instance>slot1</instance>
</interface>
</hal>
</manifest>
如果报的错误是FAILED: out/target/product/rk3568_r/obj/EXECUTABLES/usb_dongle_intermediates/Misc.o
解决方法:
\external\usb_modeswitch\usb_dongle\Android.mk
- common_local_tidy_flags := -warnings-as-errors=clang-analyzer-security*,cert-*
+ #common_local_tidy_flags := -warnings-as-errors=clang-analyzer-security*,cert-*
PRODUCT_PACKAGES += rild
PRODUCT_COPY_FILES += \
device/rockchip/rk3288/rk3288_Android11/modify/xG_module/libquectel-ril/armeabi/libreference-ril-QUECTEL.so:vendor/lib/libreference-ril-QUECTEL.so \
device/rockchip/rk3288/rk3288_Android11/modify/xG_module/libquectel-ril/armeabi/chat:system/bin/chat \
device/rockchip/rk3288/rk3288_Android11/modify/xG_module/libquectel-ril/armeabi/ip-up:system/bin/ip-up \
device/rockchip/rk3288/rk3288_Android11/modify/xG_module/libquectel-ril/armeabi/ip-down:system/bin/ip-down \
device/rockchip/rk3288/rk3288_Android11/apns-conf.xml:system/etc/apns-conf.xml
然后a\device\rockchip\rk3288\device.mk文件下添加如下:
include $(LOCAL_PATH)/rk3288_Android11/modify.mk
a\device\rockchip\common\device.mk
ifeq ($(strip $(BOARD_HAS_RK_4G_MODEM)),true)
PRODUCT_PACKAGES += \
CarrierDefaultApp \
CarrierConfig \
rild \
- librk-ril \
+ libreference-ril-QUECTEL.so \
dhcpcd
PRODUCT_COPY_FILES += vendor/rockchip/common/phone/etc/apns-full-conf.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/apns-conf.xml
PRODUCT_PACKAGES += \
android.hardware.radio@1.2-radio-service \
android.hardware.radio.config@1.0-service
PRODUCT_PROPERTY_OVERRIDES += \
ro.boot.noril=false \
ro.telephony.default_network=9
ifeq ($(strip $(TARGET_ARCH)), arm64)
PRODUCT_PROPERTY_OVERRIDES += \
- vendor.rild.libpath=/vendor/lib64/librk-ril.so
+ vendor.rild.libpath=/vendor/lib64/libreference-ril-QUECTEL.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
else
PRODUCT_PROPERTY_OVERRIDES += \
- vendor.rild.libpath=/vendor/lib/librk-ril.so
+ vendor.rild.libpath=/vendor/lib/libreference-ril-QUECTEL.so
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/4g_modem/bin32/dhcpcd:$(TARGET_COPY_OUT_VENDOR)/bin/dhcpcd \
$(LOCAL_PATH)/4g_modem/lib32/librk-ril.so:$(TARGET_COPY_OUT_VENDOR)/lib/librk-ril.so
endif
endif
a\device\rockchip\rk3288\device.mk
PRODUCT_PROPERTY_OVERRIDES += \
ro.ril.ecclist=112,911 \
ro.opengles.version=196610 \
wifi.interface=wlan0 \
+ ro.telephony.default_network=9 \
+ rild.libpath=/vendor/lib64/libreference-ril-QUECTEL.so \
+ rild.libargs=-d /dev/ttyUSB2 \
ro.audio.monitorOrientation=true \
debug.nfc.fw_download=false \
debug.nfc.se=false \
vendor.hwc.compose_policy=1 \
sys.wallpaper.rgb565=0 \
sf.power.control=2073600 \
sys.rkadb.root=0 \
ro.sf.fakerotation=false \
ro.tether.denied=false \
sys.resolution.changed=false \
ro.default.size=100 \
ro.product.usbfactory=rockchip_usb \
wifi.supplicant_scan_interval=15 \
ro.factory.tool=0 \
ro.kernel.android.checkjni=0 \
ro.build.shutdown_timeout=6 \
persist.enable_task_snapshots=false \
ro.vendor.frameratelock=true
- service ril-daemon /vendor/bin/hw/rild
+ service ril-daemon /vendor/bin/hw/rild -l /vendor/lib/libreference-ril-QUECTEL.so
socket rild stream 660 root radio
socket rild-debug stream 660 radio system
class main
user radio
group radio cache inet misc audio log readproc wakelock
capabilities BLOCK_SUSPEND NET_ADMIN NET_RAW
#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
①查看库是否存在:cd vendor/lib/
②查看加载库:getprop | grep rild
③应用日志:logcat -b radio