1.添加PID和VID drivers/usb/serial/option.c
(1)
#define QUECTEL_VENDOR_ID 0x2C7C
#define QUECTEL_PRODUCT_EC200T 0x6026
(2)
static const struct usb_device_id option_ids[] = {
…
{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T)}, /* QUECTEL UC200T */
…
}
static int option_probe(struct usb_serial *serial,const struct usb_device_id *id)
{
…
#if 1//def CONFIG_SUPPORT_QUECTE_EC200T//add for Quectel
if(serial->dev->descriptor.idVendor == cpu_to_le16(0x2c7c) &&
serial->dev->descriptor.idProduct != cpu_to_le16(0x6026) &&
serial->interface->cur_altsetting->desc.bInterfaceNumber >= 4) {
return -ENODEV;
}
if(serial->dev->descriptor.idVendor == cpu_to_le16(0x2c7c) &&
serial->dev->descriptor.idProduct == cpu_to_le16(0x6026) &&
serial->interface->cur_altsetting->desc.bInterfaceNumber <= 1) {
return -ENODEV;
}
#endif
…
}
2.增加0包反馈
Add the Zero Packet Mechanism
As required by the USB protocol, you need to add the mechanism for processing zero packets during bulk out transmission.
For Linux Kernel Version newer than 2.6.34
/drivers/usb/serial/usb_wwan.c
usb_fill_bulk_urb(urb, serial->dev,
usb_sndbulkpipe(serial->dev, endpoint) | dir,
buf, len, callback, ctx);
#if 1//def CONFIG_SUPPORT_QUECTE_EC200T // YIYUAN add
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
很多博客上面说做完这两步骤就可以识别到usb设备了,打印会打出ttyUSB0 ttyUSB1 ttyUSB2 ttyUSB3(也可在dev目录下查看),但是本人的还是不行,
3.如果你的内核代码中存在以下东西,请删掉
If you are using EC20 and following files and statements exist
in your kernel source files, please delete them, as they will conflict with EC20’s USB Drivers
(1)/drivers/usb/serial/qcserial.c
{USB_DEVICE(0x05c6, 0x9214)}, /* Acer Gobi 2000 QDL device (VP413) /
{USB_DEVICE(0x05c6, 0x9215)}, / Acer Gobi 2000 Modem device (VP413) */
(2)/drivers/net/usb/qmi_wwan.c
{QMI_GOBI_DEVICE(0x05c6, 0x9215)}, /* Acer Gobi 2000 Modem device (VP413) */
4.make linux-menuconfig
将内核烧进板子或挂载应该就可以看到识别ttyUSB*了
如何测试拨号呢?
这有一个测试好的包,按提示就可以进行测试拨号
https://download.csdn.net/download/qq_21948547/11924440点这里