移远4G模组调试 USB连接 EC200M-CN
模组上电 并 reset下
连接成功后,在终端输入“lsusb”命令即可显示移远的模组。
如下图 2c7c 即表示识别到了移远的模组
marconi:/ $ lsusb Bus 001 Device 001: ID 1d6b:0002 Bus 001 Device 004: ID 2c7c:6002 Bus 002 Device 001: ID 1d6b:0003 Bus 001 Device 002: ID 1a40:0801 marconi:/ $
驱动:
1. Add VID and PID
Linux内核中添加EC20的USB信息,这样内核启动后,才能正确识别EC20 4G模块
在 common/drivers/usb/serial/option.c里
usb_device_id option_ids[] = { #if 1 //Added by Quectel { USB_DEVICE(0x05C6, 0x9090) }, /* Quectel UC15 */ { USB_DEVICE(0x05C6, 0x9003) }, /* Quectel UC20 */ { USB_DEVICE(0x2C7C, 0x0125) }, /* Quectel EC25 */ { USB_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21 */ { USB_DEVICE(0x05C6, 0x9215) }, /* Quectel EC20 */ { USB_DEVICE(0x2C7C, 0x0191) }, /* Quectel EG91 */ { USB_DEVICE(0x2C7C, 0x0195) }, /* Quectel EG95 */ { USB_DEVICE(0x2C7C, 0x0306) }, /* Quectel EG06/EP06/EM06 */ { USB_DEVICE(0x2C7C, 0x0296) }, /* Quectel BG96 */ { USB_DEVICE(0x2C7C, 0x0435) }, /* Quectel AG35 */ { USB_DEVICE(0x2C7C, 0x0512) }, /* Quectel EG12/EG18 */ { USB_DEVICE(0x2C7C, 0x6026) }, /* Quectel EC200 */ { USB_DEVICE(0x2C7C, 0x6120) }, /* Quectel UC200 */ { USB_DEVICE(0x2C7C, 0x6000) }, /* Quectel EC200/UC200 */ { USB_DEVICE(0x2C7C, 0x6002) }, /* Quectel EC200M*/ #endif
本产品的Vid = 2c7c, Pid =6002
-----
2. 增加零包机制
drivers/usb/serial/usb_wwan.c.
static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint, int dir, void *ctx, char *buf, int len,void (*callback) (struct urb *)) { …… usb_fill_bulk_urb(urb, serial->dev, 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; }
3 Add Reset-resume Mechanism
在/drivers/usb/serial/option.c
static struct usb_serial_driver option_1port_device = { …… #ifdef CONFIG_PM .suspend = usb_wwan_suspend, .resume = usb_wwan_resume, #if 1 //Added by Quectel .reset_resume = usb_wwan_resume, #endif #endif };
4. Use ECM or RNDIS
/drivers/usb/serial/option.c
使用ECM
static int option_probe(struct usb_serial *serial, const struct usb_device_id *id) { struct usb_wwan_intf_private *data; …… #if 1 //Added by Quectel if (serial->dev->descriptor.idVendor == cpu_to_le16(0x2C7C)) { //__u16 idProduct = le16_to_cpu(serial->dev->descriptor.idProduct); //Quectel EC200T's interface 0 can be used as USB Network device (ecm, rndis) if (serial->interface->cur_altsetting->desc.bInterfaceClass != 0xFF) return -ENODEV; } #endif /* Store device id so we can use it during attach. */ usb_set_serial_data(serial, (void *)id); return 0; }
5.在内核配置表中
PPP模式拨号的话:
CONFIG_PPTP=y
CONFIG_PPP_SYNC_TTY=y
ECM或者RNDIS模式:
CONFIG_USB_NET_DRIVERS=y
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_NET_RNDIS_HOST=y
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_SERIAL_WWAN=y
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_OPTION=y
----
6 在device下配置
/device/amlogic/marconi/device.mk中复制文件
device/amlogic/$(PRODUCT_DIR)/files/4gmodule/libreference-ril.so:vendor/lib/libreference-ril.so \ device/amlogic/$(PRODUCT_DIR)/files/4gmodule/chat:system/bin/chat \ device/amlogic/$(PRODUCT_DIR)/files/4gmodule/ip-up:system/