OpenWrt21 EC20 R2.0驱动添加

本文档详细介绍了如何在OpenWrt21内核版本5.4上针对Quectel EC20R2.0模块进行内核修改,包括USB串口驱动、添加零包处理、添加ResetResume功能、使用GobiNet或QMI WWAN,并提供了相应的菜单config配置选择。拨号方法包括quectel-CM和ppp方式,最后展示了成功拨号后的设备信息。

1、OpenWrt21内核版本为5.4,EC20R2.0的VID、PID为0x2C7C, 0x0125,可以使用qmi拨号或者ppp拨号

2、内核修改

        1、修改USB串口驱动

                File : [KERNEL]/drivers/usb/serial/option.c

static const struct usb_device_id option_ids[] = {
#if 1 //Added by Quectel
	{ USB_DEVICE(0x05C6, 0x9090) }, /* Quectel UC15 */
	{ USB_DEVICE(0x05C6, 0x9003) }, /* Quectel UC20 */
	{ USB_DEVICE(0x05C6, 0x9215) }, /* Quectel EC20 */
	{ USB_DEVICE(0x2C7C, 0x0125) }, /* Quectel EC25/EC20 R2.0 */
	{ USB_DEVICE(0x2C7C, 0x0121) }, /* Quectel EC21 */
#endif

        2.1、添加零包处理

                File:[KERNEL]/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 *))
{
……
#if 1 //Added by Quectelfor Zero Packet
	if (dir == USB_DIR_OUT) {
		struct usb_device_descriptor*desc = &serial->dev->descriptor;
		if (desc->idVendor ==cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9090))
			urb->transfer_flags|= URB_ZERO_PACKET;
		if (desc->idVendor ==cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9003))
			urb->transfer_flags|= URB_ZERO_PACKET;
		if (desc->idVendor ==cpu_to_le16(0x05C6) && desc->idProduct == cpu_to_le16(0x9215))
			urb->transfer_flags|= URB_ZERO_PACKET;
		if (desc->idVendor ==cpu_to_le16(0x2C7C))
			urb->transfer_flags|= URB_ZERO_PACKET;
 
}
#endif
	return urb;
}

        2.2、Add Reset Resume

                File: [KERNEL]/drivers/usb/serial/option.c

static struct usb_serial_driveroption_1port_device = {
……

#
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值