Phytec中国的wiki
support@phytec.cn
热线:0755-61802110-803
EC20 R2.0文档说明书:
Quectel_Android_RIL_Driver_User_Guide_V1.8.pdf
Quectel_WCDMA<E_Linux_USB_Driver_User_Guide_V1.8.pdf
Android BSP :
BSP-Android-i.MX6-ALPHA1
kernel配置
配置内核usb serial驱动
根据EC20产品手册, usb serial驱动需要增加对EC20产品支持, 驱动修改如下:
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index e39a6f8..3165047 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -499,6 +499,10 @@ static void option_instat_callback(struct urb *urb); #define INOVIA_VENDOR_ID 0x20a6 #define INOVIA_SEW858 0x1105 +/* Quectel EC20 R2.0 */ +#define QUECTEL_VENDOR_ID 0x2c7c +#define QUECTEL_PRODUCT_EC20R2 0x0125 + /* some devices interfaces need special handling due to a number of reasons */ enum option_blacklist_reason { OPTION_BLACKLIST_NONE = 0, @@ -583,6 +587,7 @@ static const struct option_blacklist_info telit_le920_blacklist = { }; static const struct usb_device_id option_ids[] = { + { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC20R2) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) }, @@ -1767,6 +1772,7 @@ static struct usb_serial_driver option_1port_device = { #ifdef CONFIG_PM .suspend = usb_wwan_suspend, .resume = usb_wwan_resume, + .reset_resume = usb_wwan_resume, #endif }; @@ -1834,6 +1840,24 @@ static int option_probe(struct usb_serial *serial, iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA) return -ENODEV; + /* For Quectel EC20 R2.0 usb auto suspend */ + if (serial->dev->descriptor.idVendor == cpu_to_le16(QUECTEL_VENDOR_ID)) { + pm_runtime_set_autosuspend_delay(&serial->dev->dev, 3000); + usb_enable_autosuspend(serial->dev); + } + + /* For Quectel EC20 R2.0 usb remote wakeup */ + if (serial->dev->descriptor.idVendor == cpu_to_le16(QUECTEL_VENDOR_ID)) { + device_init_wakeup(&serial->dev->dev, 1); + } + /* Store device id so we can use it during attach. */ usb_set_serial_data(serial, (void *)id); diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index 36f6b6a..d18fcab 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -492,6 +492,13 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, usb_sndbulkpipe(serial->dev, endpoint) | dir, buf, len, callback, ctx); + /* Added by Quectel EC20 R2.0 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; + } + return urb; }
menuconfig使能USB serial驱动
使能CONFIG_USB_SERIAL_OPTION,
[*] Device Drivers --->
[*] USB Support --->
[*]USB Serial Converter support --->
[*] USB driver for GSM and CDMA modems
kernel支持PPP
根据手册3.6章节 , 配置menuconfig 使能 CONFIG_PPP_ASYNC, CONFIG_PPP_SYNC_TTY, CONFIG_PPP_DEFALTE
[*]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
android文件系统增加RIL库支持
根据产品文档, 需要把android系统中的以下执行文件和库都替换为ec20产家提供的文件
/system/bin/chat
/system/etc/ppp/ip-down
/system/etc/ppp/ip-up
/system/lib/libreference-ril.so
在BSP的vendor/SIGMA/miraq的目录下新建ec20目录, 把厂家提供的以上四个文件放在ec20目录下,
修改vendor/SIGMA/miraq目录下的BoardConfig.mk文件, 把厂家提供的文件编译进文件系统
diff --git a/BoardConfig.mk b/BoardConfig.mk index ff806c7..8e06075 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -82,6 +82,10 @@ _boardfiles := \ + $(_thisdir)/ec20/ip-up:system/etc/ppp/ip-up \ + $(_thisdir)/ec20/ip-down:system/etc/ppp/ip-down \ + $(_thisdir)/ec20/chat:system/bin/chat \ + $(_thisdir)/ec20/libreference-ril.so:system/lib/libreference-ril.so \ PRODUCT_COPY_FILES += ${_boardfiles}
修改vendor/SIGMA/miraq目录下的miraq.mk文件, 去掉原来系统中执行文件的依赖
diff --git a/miraq.mk b/miraq.mk index 3c75f25..d796694 100644 --- a/miraq.mk +++ b/miraq.mk @@ -48,10 +48,7 @@ PRODUCT_PACKAGES += \ libRS \ librs_jni \ pppd \ - chat \ ip-up-vpn \ - ip-up-ppp0 \ - ip-down-ppp0 \ dispd \ ts_calibrator \ libion \ @@ -278,7 +275,6 @@ PRODUCT_AAPT_CONFIG := normal mdpi # ril related libs PRODUCT_PACKAGES += \ - libreference-ril-zte.so \ libruntime-ril-port PRODUCT_PACKAGES += \
另外, 需要把bsp的hardware/ril目录下的reference-ril整个目录删掉, 否则编译后的libreference-ril.so还是原来的库.
android系统增加ril-daemon service
在bsp的vendor/SIGMA/miraq目录下的init.rc文件中增加ril-daemon service内容
diff --git a/files/init.rc b/files/init.rc index c191bce..6c95869 100755 --- a/files/init.rc +++ b/files/init.rc @@ -129,6 +129,14 @@ on boot #on property:sys.interactive=active start tsuinput +# service ril-daemon + service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so + class main + socket rild stream 660 root radio + socket rild-debug stream 666 radio system + user root + group radio cache inet misc audio sdcard_rw log + # Set watchdog timer to 30 seconds and pet it every 10 seconds to get a 20 second margin service watchdogd /sbin/watchdogd 10 20 class core
另外, 需去掉原来的ril-daemon service, 修改bsp的device/fsl目录下的etc/init.rc文件, 去掉以下内容
diff --git a/imx6/etc/init.rc b/imx6/etc/init.rc index 330ba7a..5990bde 100755 --- a/imx6/etc/init.rc +++ b/imx6/etc/init.rc @@ -800,14 +800,6 @@ service rtl_hostapd /system/bin/hostapd /data/misc/wifi/hostapd.conf oneshot disabled -service ril-daemon /system/bin/rild - class main - socket rild stream 660 root radio - socket rild-debug stream 660 radio system - socket rild-ppp stream 660 radio system - user root - group radio cache inet misc audio sdcard_rw log - service pppd_gprs /etc/ppp/init.gprs-pppd class main user root
以上修改后, 编译后的镜像里内核和文件系统都已经支持了ec20. 但是从log中发现RIL不启动.
android系统还需要以下修改, RIL才能启动成功.
修改bsp包的vendor/SIGMA/miraq/overlay/frameworks/base/core/res/res/values/config.xml文件
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index e9cd8e7..8f3b4a3 100755 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -59,6 +59,7 @@ <!-- the 6th element indicates boot-time dependency-met value. --> <string-array translatable="false" name="networkAttributes"> <item>"ethernet,9,9,2,-1,true"</item> + <item>"mobile,0,0,0,-1,true"</item> </string-array> <bool name="config_automatic_brightness_available">true</bool>
重新编译系统后, RIL就能成功启动.
android配置APN
经过以上修改后的系统, 第一次启动还需要增加APN的配置.
设置->无线和网络->更多->移动网络->接入点名称(APN)→添加APN配置并保存
设置->无线和网络->更多->移动网络->首选网络类型->3G