附文档 1. 添加 VID 和 PID static const struct usb_device_id option_ids[] = { #if 1 //Added by Quectel { USB_DEVICE(0x2C7C, 0x6002) }, /* Quectel EC200S */ #endif 2.添加USB零包 [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 *)) { …… 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.增加复位恢复机制 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 }; 接下来使能一些内核配置项 TODO...... 烧录内核成功后 ls /dev/ttyUSB* 可以看到下面的3个模拟的usb设备 2.之后执行获取到IP地址 ifconfig usb1 up udhcpc -i usb1 3.使用AT指令使模块拨号 cat /dev/ttyUSB2 & # 设置为RNDIS模式 echo -e "AT+QCFG=\"usbnet\",3\r\n" > /dev/ttyUSB2 # 查询指令是否生效 echo -e "AT+QCFG=\"usbnet\"\r\n" > /dev/ttyUSB2 # 发送 AT 指令拨号上网指令 echo -e "AT+qnetdevctl=1,1\r\n" > /dev/ttyUSB2 4.执行ping指令测试拨号是否成功 附一些常用的AT指令 echo -e "AT+QCCID\r\n" >/dev/ttyUSB2 //查询SIM卡 echo -e "AT+CFUN=1,1\r\n" >/dev/ttyUSB2 //重启模块 echo -e "AT+QSIMDET=1\r\n" >/dev/ttyUSB2 //开启SIM卡热插拔状态报告 echo -e "AT+QSIMDET=1,1\r\n" >/dev/ttyUSB2 //开启SIM卡检测功能 echo -e "AT+CSQ\r\n" >/dev/ttyUSB2 //查询信号强度 echo -e "AT+QNWINFO\r\n" >/dev/ttyUSB2 //查询网络状态 echo -e "AT+QCFG=\"NWSCANMODE\",3,1\r\n" >/dev/ttyUSB2 //设置4G LTE only echo -e "AT+QCFG=\"NWSCANMODE\",2,1\r\n" >/dev/ttyUSB2 //设置3G WCDMA only echo -e "AT+QCFG=\"NWSCANMODE\",1,1\r\n" >/dev/ttyUSB2 //设置2G GSM only echo -e "AT+QCFG=\"NWSCANMODE\",0,1\r\n" >/dev/ttyUSB2 //设置自动搜索网络 # AT+QSIMDET=1,1或AT+QSIMDET=1,0开启 可以设置高电平 或者低电平有效//SIM卡热拔插,同一个电路 肯定不可以设置两种sim卡检测状态 要么高电平有效 要么低电平有效 # AT+QSIMDET=0 关闭热拔插功能 # 通过AT命令开启SIM卡检查功能 # 举例: # AT+QSIMSTAT=1 //开启SIM卡热拔插状态报告 # AT+QSIMDET=1,1或AT+QSIMDET=1,0//开启 SIM卡检测功能 # 当SIM卡拔出或者插上的时候,模块会有相应的提示: # +CPIN:NOT READY # AT+QSIMSTAT=1,1或AT+QSIMSTAT=1,0 # Call Ready (责任编辑:) |