全志A133平台android10.0移植EC200S-CN 4G模块
驱动移植:
1、$ git diff drivers/usb/serial/option.c
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 9f96dd2..2f25466 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -245,6 +245,7 @@ static int option_probe(struct usb_serial *serial,
#define QUECTEL_VENDOR_ID 0x2c7c
/* These Quectel products use Quectel's vendor ID */
+#define QUECTEL_PRODUCT_EC20 0x6002
#define QUECTEL_PRODUCT_EC21 0x0121
#define QUECTEL_PRODUCT_EC25 0x0125
#define QUECTEL_PRODUCT_BG96 0x0296
@@ -1079,6 +1080,7 @@ static int option_probe(struct usb_serial *serial,
{ USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M),
.driver_info = RSVD(1) | RSVD(3) },
/* Quectel products using Quectel vendor ID */
+ { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC20)},
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
.driver_info = RSVD(4) },
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
@@ -1999,6 +2001,9 @@ static int option_probe(struct usb_serial *serial,
#ifdef CONFIG_PM
.suspend = usb_wwan_suspend,
.resume = usb_wwan_resume,
+#if 1 //Added by Quectel
+ .reset_resume = usb_wwan_resume,
+#endif
#endif
};
@@ -2036,6 +2041,15 @@ static int option_probe(struct usb_serial *serial,
iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA)
return -ENODEV;
+#if 1 //Added by Quectel
+ if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) {
+ __u16 idProduct = le16_to_cpu(serial->dev->descriptor.idProduct);
+ //Quectel EC200S's interface 0 can be used as USB Network device (ecm, rndis)
+ if (serial->interface->cur_altsetting->desc.bInterfaceClass != 0xFF)
+ return -ENODEV;
+ }
+#endif
+
/* Store the device flags so we can use them during attach. */
usb_set_serial_data(serial, (void *)device_flags);
A133-Q-2.2/longan/kernel/linux-4.9$ git diff drivers/usb/serial/usb_wwan.c
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index 3dfdfc8..0476229 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -505,6 +505,14 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
usb_sndbulkpipe(serial->dev, endpoint) | dir,
buf, len, callback, ctx);
+#if 1 //Added by Quectel for zero packet
+ if (dir == USB_DIR_OUT) {
+ struct usb_device_descriptor *desc = &serial->dev->descriptor;
+ if (desc->idVendor == cpu_to_le16(0x2C7C))
+ urb->transfer_flags |= URB_ZERO_PACKET;
+ }
+#endif
+
return urb;
}
ril库移植:
1、cd device/softwinner/ceres-c3
diff --git a/ceres_c3.mk b/ceres_c3.mk
index e2661c2..8a7d841 100644
--- a/ceres_c3.mk
+++ b/ceres_c3.mk
@@ -163,9 +163,9 @@ PRODUCT_PACKAGES += \
#PRODUCT_PACKAGES += AllwinnerGmsIntegration
-############################### 3G Dongle Support ###############################
+############################### 4G Dongle Support ###############################
# Radio Packages and Configuration Flie
-$(call inherit-product-if-exists, vendor/aw/public/prebuild/lib/librild/radio_common.mk)
+$(call inherit-product-if-exists, vendor/quectel/libquectel-ril/radio_common.mk)
PRODUCT_FSTAB := fstab.sun50iw10p1
ifneq ($(BOARD_HAS_SECURE_OS), true)
diff --git a/configs/manifest.xml b/configs/manifest.xml
index 6ecc457..581932d 100644
--- a/configs/manifest.xml
+++ b/configs/manifest.xml
@@ -36,6 +36,24 @@
</interface>
</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</name>
+ <transport>hwbinder</transport>
+ <version>1.0</version>
+ <interface>
+ <name>IRadio</name>
+ <instance>slot1</instance>
+ </interface>
+ </hal>
+ <hal format="hidl">
<name>android.hardware.audio.effect</name>
<transport>hwbinder</transport>
<version>5.0</version>
diff --git a/init.device.rc b/init.device.rc
index 753c741..f8758e5 100644
--- a/init.device.rc
+++ b/init.device.rc
@@ -1,3 +1,5 @@
+import /vendor/etc/init/rild.rc
+
on init
# Load persistent dm-verity state
verity_load_state
2.cd /hardware/ril/rild
diff --git a/rild/Android.mk b/rild/Android.mk
index b8ba508..1b3d5bf 100644
--- a/rild/Android.mk
+++ b/rild/Android.mk
@@ -29,7 +29,7 @@ endif
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE:= rild
-LOCAL_VINTF_FRAGMENTS := radio.xml
+#LOCAL_VINTF_FRAGMENTS := radio.xml
ifeq ($(PRODUCT_COMPATIBLE_PROPERTY),true)
LOCAL_INIT_RC := rild.rc
LOCAL_CFLAGS += -DPRODUCT_COMPATIBLE_PROPERTY
3.添加权限
diff --git a/sepolicy/vendor/rild.te b/sepolicy/vendor/rild.te
index 8fdddc5..d29b4a2 100755
--- a/sepolicy/vendor/rild.te
+++ b/sepolicy/vendor/rild.te
@@ -5,6 +5,7 @@ allow rild vendor_file:file execute_no_trans;
allow rild vendor_ril_prop:file { read getattr open };
allow rild vendor_ril_prop:property_service set;
allow rild vendor_default_prop:file {open read getattr};
+allow rild rild:packet_socket create_socket_perms_no_ioctl;
allow rild vendor_toolbox_exec:file execute_no_trans;
allow rild vendor_shell_exec:file execute_no_trans;
ril库存放路径:
A133-Q-2.2/android/vendor/quectel/libquectel-ril$ ls -l
总用量 224
-rwxr--r-- 1 ksd ksd 207092 12月 30 10:27 apns-conf.xml
drwxr-xr-x 2 ksd ksd 4096 12月 31 10:18 arm64-v8a
drwxr-xr-x 2 ksd ksd 4096 12月 31 15:41 armeabi
drwxr-xr-x 2 ksd ksd 4096 12月 24 09:36 doc
-rwxr--r-- 1 ksd ksd 959 12月 24 09:36 ql-ril.conf
-rw-rw-r-- 1 ksd ksd 723 12月 31 16:28 radio_common.mk
A133-Q-2.2/android/vendor/quectel/libquectel-ril$ cat radio_common.mk
LOCAL_PATH := vendor/quectel/libquectel-ril
# 3G Data Card Packages
PRODUCT_PACKAGES += \
libquectel-ril \
android.hardware.radio@1.0 \
pppd \
rild \
radio_monitor
# 3G Data Card Configuration Flie
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/armeabi/ip-up:system/etc/ppp/ip-up \
$(LOCAL_PATH)/armeabi/ip-down:system/etc/ppp/ip-down \
$(LOCAL_PATH)/armeabi/chat:system/bin/chat \
$(LOCAL_PATH)/ql-ril.conf:system/etc/ql-ril.conf \
$(LOCAL_PATH)/apns-conf.xml:system/etc/apns-conf.xml
# Radio parameter
PRODUCT_PROPERTY_OVERRIDES += \
vendor.rild.libargs=-d/dev/ttyUSB2 \
vendor.rild.libpath=libquectel-ril.so \
ro.radio.noril=false \
ro.radio.noawril=true \
ro.vendor.sw.embeded.telephony=false
库的下载链接如下:
https://download.csdn.net/download/tanjian0110/13993281