安卓tv 移植移远4G模组调试

移远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/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值