一、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