drivers/usb/serial/option.c:
626 static const struct usb_device_id option_ids[] = {
627 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
628 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
629 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },
...
1808 #if 1 //Added by Quectel
1809 { USB_DEVICE(0x05C6, 0x9090) }, /* Quectel UC15 */
1810 { USB_DEVICE(0x05C6, 0x9003) }, /* Quectel UC20 */
1811 { USB_DEVICE(0x2C7C, 0x0125) }, /* Quectel EC25/EC20 R2.0 */
1812 { USB_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21 */
1813 { USB_DEVICE(0x05C6, 0x9215) }, /* Quectel EC20 */
1814 { USB_DEVICE(0x2C7C, 0x0191) }, /* Quectel EG91 */
1815 { USB_DEVICE(0x2C7C, 0x0195) }, /* Quectel EG95 */
1816 { USB_DEVICE(0x2C7C, 0x0306) }, /* Quectel EG06/EP06/EM06 */
1817 { USB_DEVICE(0x2C7C, 0x0296) }, /* Quectel BG96 */
1818 #endif 1830 static struct usb_serial_driver option_1port_device = {
1831 .driver = {
1832 .owner = THIS_MODULE,
1833 .name = "option1",
1834 },
1835 .description = "GSM modem (1-port)",
1836 .id_table = option_ids,
1837 .num_ports = 1,
...
1853 #ifdef CONFIG_PM
1854 .suspend = usb_wwan_suspend,
1855 .resume = usb_wwan_resume,
1856 #if 1 //Added by Quectel & Air720
1857 .reset_resume = usb_wwan_resume,
1858 #endif
1859 #endif
drivers/usb/serial/usb_wwan.c
474 static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
475 int endpoint,
476 int dir, void *ctx, char *buf, int len,
477 void (*callback) (struct urb *))
478 {
479 struct usb_serial *serial = port->serial;
480 struct urb *urb;
...
495#if 1 //Added by Quectel for Zero Packet
496 if (dir == USB_DIR_OUT) {
497 struct usb_device_descriptor *desc = &serial->dev->descriptor;
498 if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9090))
499 urb->transfer_flags |= URB_ZERO_PACKET;
500 if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9003))
501 urb->transfer_flags |= URB_ZERO_PACKET;
502 if (desc->idVendor == cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9215))
503 urb->transfer_flags |= URB_ZERO_PACKET;
504 if (desc->idVendor == cpu_to_le16(0x2C7C))
505 urb->transfer_flags |= URB_ZERO_PACKET;
506 }
507 #endif
make menuconfig:
Device Drivers --->
[*] USB support --->
<*> USB Serial Converter support --->
<*> USB driver for GSM and CDMA modems
[*] Network device support --->
<*> PPP (point-to-point protocol) support
<*> PPP BSD-Compress compression
<*> PPP Deflate compression
[*] PPP filtering
<*> PPP MPPE compression (encryption)
[*] PPP multilink support
<*> PPP over Ethernet
<*> PPP support for async serial ports
<*> PPP support for sync tty ports 当系统启动后,可以看到/dev/目录下产生ttyUSB0-3节点,说明驱动移植成功:
获取模块的IMEI号:
echo -e "AT+CPIN?\r\n" > /dev/ttyUSB2
获取信号质量:
cat /dev/ttyUSB2 &
echo -e "AT+CSQ\r\n" > /dev/ttyUSB2
在/etc/ppp/目录下创建quectel目录,并在quectel目录下新建 quectel-chat-connect、quectel-ppp、quectel-pppd.sh、quectel-chat-disconnect和quectel-ppp-kill拨号脚本:
拨号测试:
/etc/ppp/quectel/quectel-pppd.sh
取消拨号:
/etc/ppp/quectel/quectel-ppp-kill
从嵌入式的角度来看,EC20 4G模块的功耗是很高的,因此在我们不需要使用模块的时候,我们可以将模块关闭,达到节能的目的。
可以通过控制模块的PWR引脚来控制模块的工作状态,在内核中增加实现该功能的驱动(源码参考附件/drivers/misc/ido_4g_ctrl.c)。
dts的配置:
ido_4g_ctrl {
compatible = "quectel,4g_ec20";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ido_4g_ctrl>;
gpio-reset = <&gpio3 2 0>;
gpio-power-en = <&gpio3 0 0>;
status = "okay";
};
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!