硬件:A83T
--- a/lichee/linux-3.4/drivers/usb/serial/option.c
+++ b/lichee/linux-3.4/drivers/usb/serial/option.c
@@ -948,6 +948,7 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x3197)},
+ { USB_DEVICE(0x1c9e, 0x9b3c)},
Device Drivers --->
-*-Network device support --->
{*}ppp(point-to-point protocol) support
[*] ppp support for async serial ports
[*] ppp support for sync tty ports
配置USB MODEM
Device Drivers --->
[*]USB support --->
[*]USB Serial Conerter support --->
[*]USB Generic Serial Driver
……
[*]USB driver for GSM and CDMA modems
重新编译内核。设备正常加载后,输入命令“ls /dev/ttyUSB*”后会看到有ttyUSB(0,1,2,-,-)映射出来。
root@octopus-f1:/system/vendor/modules # ls /dev/ttyUSB* -l
crwxrwxrwx system system 188, 0 1970-01-01 09:00 ttyUSB0
crwxrwxrwx system system 188, 1 1970-01-01 09:00 ttyUSB1
crwxrwxrwx system system 188, 2 1970-01-01 09:00 ttyUSB2
crwxrwxrwx system system 188, 3 1970-01-01 09:00 ttyUSB3
crw------- root root 188, 4 1970-01-01 09:00 ttyUSB4
先确保插入SIM卡和天线
1)查询版本信息
echo AT+LCTSW > /dev/ttyUSB2
AT+LCTSW
SoftwareVersion: QB30001.1.0_MX10
InnerVersion: QB30001_0016_1.0.6_L0919_EFS1.6
AP: QB30001_0016_1.0.6_L0919_MX10
2)查询信号,将会得到信号强度和误码率信息
echo AT+CSQ > /dev/ttyUSB2
AT+CSQ
+CSQ: 25,63
3)注册状态
echo AT+CREG? > /dev/ttyUSB2
AT+CREG?
+CREG: 0,1
OK
4)网络运营商信息
echo AT+COPS? > /dev/ttyUSB2
AT+COPS?
+COPS: 0,0,"CHINA MOBILE",7
OK
联通
+COPS: 0,0,"CHN-UNICOM",7
+COPS: 0,1,"UNICOM",7
+COPS: 0,2,"46001",7
确保信号强度CSQ返回的第一个参数在13以上
1)建立拨号配置文件/etc/ppp/gprs-connect-chat
gprs-connect-char它是在ppp层会话时给chat进程的参数,每行
是一个"期望/发送" 的组合序列
TIMEOUT 15 ;超时控制
ABORT "DELAYED" ;如果收到字符串"DELAYED" "BUSY" "ERROR"...就退出执行
ABORT "BUSY"
ABORT "ERROR"
ABORT "NO DIALTONE"
ABORT "NO CARRIER"
TIMEOUT 40
"" \rAT ;modem不管收到会么字符串,先发送AT指令
OK ATS0=0 ;期望收到OK,然后发送ATS0=0
OK ATE0V1 ;期望收到OK,然后发送ATE0V1
OK AT+CGDCONT=1,"IP","CMNET" ;最后一个参数为中国移动的apn
OK ATDT*99***1# ;*99***1#为中国移动的拨号号码
CONNECT "" ;如果收到CONNECT,就不再发送,认为数据链路已建立
中国联通(WCDMA) APN: 3GNET 拨号号码:*99#
中国电信(CDMA200/EVDO) APN: 无 拨号号码:#777 帐号:[email protected] 密码:vnet.mobi
中国移动(TD-SCDMA) APN: CMNET 拨号号码:*98*1#
中国移动(GPRS/EGDE) APN: CMNET 拨号号码:*99***1#
2)建立拨号配置文件 /etc/ppp/peers/gprs
#Usage: root > pppd call gprs
/dev/ttyUSB1
9600
crtscts
modem
#noauth
debug
nodetach
#hide-password
usepeerdns
noipdefault
defaultroute
0.0.0.0:0.0.0.0
ipcp-accept-local
ipcp-accept-remote
#lcp-echo-failure 12
#icp-echo-interval 3
#noccp
#novj
#novjccomp
#persist
connect '/system/bin/chat -s -v -f /etc/ppp/gprs-connect-chat'
pppd 调用chat会话进程接入对端isp,启动对端的pppd,然后本地pppd与
对端pppd一起进行协商网络参数和chap/pap认证,成功后,再进行ip的分配
3)测试
# pppd call gprs &
出现ppp0节点
ppp0 Link encap:Point-to-Point Protocol
inet addr:10.32.54.229 P-t-P:10.64.64.64 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:62 (62.0 B) TX bytes:129 (129.0 B)
# busybox ping 119.75.217.56 //百度IP
PING 119.75.217.56 (119.75.217.56): 56 data bytes
64 bytes from 119.75.217.56: seq=0 ttl=54 time=181.708 ms
64 bytes from 119.75.217.56: seq=1 ttl=54 time=69.901 ms