1. 高通9x25芯片系列4G dongle
2. MTK7620 SDK
3. kernel版本 2.6.36
Config开启部分内核相关的参数选项
CONFIG_USB_NET_GOBINET=y
CONFIG_USB_USBNET=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_NET_NET1080=y
CONFIG_USB_NET_MCS7830=y
CONFIG_USB_NET_RNDIS_HOST=y
CONFIG_USB_NET_CDC_SUBSET=y
CONFIG_USB_BELKIN=y
CONFIG_USB_ARMLINUX=y
CONFIG_USB_NET_ZAURUS=y
CONFIG_USB_SIERRA_NET=y
CONFIG_PPP=y
CONFIG_PPP_MULTILINK=y
CONFIG_PPP_FILTER=y
CONFIG_PPP_ASYNC=y
CONFIG_PPP_SYNC_TTY=y
CONFIG_PPP_DEFLATE=y
CONFIG_PPP_BSDCOMP=y
CONFIG_PPP_MPPE=y
CONFIG_PPPOE=y
CONFIG_PPPOPPTP=y
CONFIG_PPPOL2TP=y
CONFIG_SLIP=y
CONFIG_SLIP_COMPRESSED=y
CONFIG_SLHC=y
CONFIG_USB_DEVICEFS=y
CONFIG_USB_MON=y
CONFIG_USB_ACM=y
CONFIG_USB_STORAGE=y
CONFIG_USB_STORAGE_DEBUG=y
#
# USB port drivers
#
CONFIG_USB_SERIAL=y
CONFIG_USB_SERIAL_WWAN=y
CONFIG_USB_SERIAL_OPTION=y
#
# USB Miscellaneous drivers
#
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VBUS_DRAW=2
CONFIG_USB_GADGET_SELECTED=y
CONFIG_USB_GADGET_R8A66597=y
CONFIG_USB_R8A66597=y
CONFIG_USB_GADGET_DUALSPEED=y
CONFIG_USB_ETH=y
kernel 修改
1.修改drivers/usb/serial/option.c
static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(0x2020, 0x2033) }, // 新增加的一行 dongle的vid和pid
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
2.修改drivers/usb/serial/generic.c
static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */
改为
static struct usb_device_id generic_device_ids[] = {
{USB_DEVICE(0x2020, 0x2033)}
}; /* Initially all zeroes. */
设备插入dongle
4G dongle 接入时会识别为cd-rom模式,如果没有识别到
进入内核 kernel执行make menuconfig
选中SCSI CDROM support等选项
将cd-rom模式弹出(eject /dev/sr0)
这样就会加载dongle的驱动Gobinet,生成usb0
usb 2-1: GSM modem (1-port) converter now attached to ttyUSB*
这样的打印会产生。
驱动加载OK
如果设备模块sr0和ttyUSB*不存在,自行手动创建,命令行生成设备文件的方式有 insf,mksf,mknod等等
拨号过程
我使用的是联通的流量卡测试
拨号使用pppd+chat
通用脚本
1 pppd call WCDMA&
成功拨号会生成ppp0且获取地址,域名等信息
2.脚本如下:
WCDMA:
nodetach
/dev/ttyUSB1
115200
user "card"
password "card"
crtscts
show-password
usepeerdns
noauth
noipdefault
novj
novjccomp
noccp
debug #打开调试信息便于调试,拨号是否成功
defaultroute
ipcp-accept-local
ipcp-accept-remote
connect '/bin/chat -s -v -f /etc/ppp/chat-wcdma-connect'
#disconnect '/bin/chat -s -v -f /etc/ppp/chat-wcdma-disconnect'
chat-wcdma-connect:
ABORT 'NO CARRIER'
ABORT 'ERROR'
ABORT 'NO DIALTONE'
ABORT 'BUSY'
ABORT 'NO ANSWER'
'' /rAT
OK /rATZ
OK /rAT+CGDCONT=1,"IP","3gnet",,0,0
OK-AT-OK ATDT*99#
CONNECT /d/c
chat-wcdma-disconnect:
ABORT "BUSY"
ABORT "ERROR"
ABORT "NO DIALTONE"
SAY "/nSending break to the modem/n"
'' "/K"
'' "+++ATH"
SAY "/nGoodbay/n"