二、配置内核:
DeviceDrivers---→
USBsupport---→
<*>USB SerialConverter support--→
[*]USBGeneric Serial Driver
<*>USBdriver for GSM and CDMA modems
Network devicesupport---→
<*> PPP (point-to-point protocol) support
[*] PPP multilink support (EXPERIMENTAL)
<*> PPP support for async serial ports
<*> PPP support for sync tty ports
<*> PPP Deflate compression
<*> PPP BSD-Compress compression
添加设备ID(如果有就不用添加):
vim drivers/usb/serial/option.c
#define ZTE_VENDOR_ID 0x19d2m drivers/usb/serial/option.c
#define ZTE_PRODUCT_MF626 0x0031
编译内核,下载到开发板重新启动,注意如果用不是ubifs文件系统,记得在启动时把ubifs文件系统挂在上,应为后面使用usb_modeswitch工具时必须挂在ubifs文件系统。
三、制作usb转串口工具
因为我们的3G模块是插在usb串口上的,所以需要制作usb转串口工具
mkdir usb-modeswitch
cd usb-modeswitch
wget http://pkgs.fedoraproject.org/repo/pkgs/libusb1/libusb-1.0.0.tar.bz2/df2447c23750ef2b4a314200feacc2ee/libusb-1.0.0.tar.bz2
wgethttp://jaist.dl.sourceforge.net/project/libusb/libusb-compat-0.1/libusb-compat-0.1.5/libusb-compat-0.1.5.tar.bz2
wgethttp://pkgs.fedoraproject.org/repo/pkgs/usb_modeswitch/usb-modeswitch-1.2.4.tar.bz2/dbd4ce7966d7b4a5a0604a8280f7164d/usb-modeswitch-1.2.4.tar.bz2wgethttp://www.draisberghof.de/usb_modeswitch/usb-modeswitch-data-20130607.tar.bz2
以上这些下载地址如果有失效的,搜索相应的文件下载,即可下载再解压即可。
tar xjf libusb-1.0.0.tar.bz2
tar xjf libusb-compat-0.1.5.tar.bz2
tar xjf usb-modeswitch-1.2.4.tar.bz2
tar xjf usb-modeswitch-data-20130607.tar.bz2
[skyyang@centos6 usbmodeswitch]$ cd libusb-1.0.0
[skyyang@centos6libusb-1.0.0]$exportCC=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc
[skyyang@centos6libusb-1.0.0]$exportCXX=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-g++
[skyyang@centos6 libusb-1.0.0]$export AR=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-ar
[skyyang@centos6 libusb-1.0.0]$export AS=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-as
[skyyang@centos6 libusb-1.0.0]$export LD=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-ld
[skyyang@centos6libusb-1.0.0]$exportSTRIP=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-strip
[skyyang@centos6libusb-1.0.0]$exportRANLIB=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-ranlib
[skyyang@centos6libusb-1.0.0]$exportnm=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-nm
[skyyang@centos6libusb-1.0.0]$./configureCC=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc--prefix=/home/skyyang/systools/usbmodeswitch/install --disable-shared--enable-static --build=arm --host=arm-linux
[skyyang@centos6libusb-1.0.0]$make
[skyyang@centos6libusb-1.0.0]$makeinstall
[skyyang@centos6 libusb-1.0.0]$cd ../libusb-compat-0.1.5
[skyyang@centos6libusb-compat-0.1.5]$./configureCC=/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc--prefix=/home/skyyang/systools/usbmodeswitch/install --disable-shared --enable-static--build=arm --host=arm-linux
PKG_CONFIG_PATH=/home/skyyang/systools/usbmodeswitch/libusb-1.0.0
[skyyang@centos6libusb-1.0.0]$make
[skyyang@centos6libusb-1.0.0]$make install
[skyyang@centos6 usbmodeswitch]$ cdusb-modeswitch-1.2.4
[skyyang@centos6usb-modeswitch-1.2.4]$exportCFLAGS='-I/home/skyyang/systools/usbmodeswitch/install/include'
[skyyang@centos6usb-modeswitch-1.2.4]$exportLDFLAGS='-L/home/skyyang/systools/usbmodeswitch/install/lib'
[skyyang@centos6 usb-modeswitch-1.2.4]$sed -i -e 's|^CC.*|CC =/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc|g' Makefile
[skyyang@centos6 usb-modeswitch-1.2.4]$sed -i -e 's|^CFLAGS.*|CFLAGS += -Wall -I../install/include -static|g' Makefile
[skyyang@centos6 usb-modeswitch-1.2.4]$sed -i -e 's|^LIBS.*|LIBS =-L../install/lib/ -l usb -l usb-1.0 -l pthread|g' Makefile
[skyyang@centos6 usb-modeswitch-1.2.4]$make
/opt/buildroot-2012.08/arm920t/usr/bin/arm-linux-gcc-o usb_modeswitch usb_modeswitch.c-I/home/skyyang/systools/usbmodeswitch/install/include -Wall-I../install/include -static -L../install/lib/ -l usb -l usb-1.0 -l pthread-L/home/skyyang/systools/usbmodeswitch/install/lib
[skyyang@centos6 usb-modeswitch-1.2.4]$ls
ChangeLog dispatcher.c Makefile make_string.tcl usb_modeswitch usb_modeswitch.c usb_modeswitch.h usb_modeswitch.tcl
COPYING jim make_static_dispatcher.sh README usb_modeswitch.1 usb_modeswitch.conf usb_modeswitch.sh
然后将生成的可执行文件usb_modeswitch 下载到开发板上,插上3G模块:四、添加必要配置文件:
首先添加zte_mf626.conf配置文件:
vim /apps/etc/ppp/zte_mf626.conf
# ZTE devices
#
DefaultVendor= 0x19d2
DefaultProduct= 0x2000
TargetVendor= 0x19d2
TargetProductList='0001,0002,0015,0016,0017,0031,0037,0052,0055,0063,0064,0066,0091,0108,0117,0128,0157
MessageContent='5553424312345678000000000000061e000000000000000000000000000000'
MessageContent2='5553424312345679000000000000061b000000020000000000000000000000'
MessageContent3='55534243123456702000000080000c85010101180101010101000000000000'
NeedResponse=1
下面三个是拨号上网需要的配置文件:
[root@root /]# vim etc/ppp/peers/wcdma-chat-connect
BORT 'BUSY'
ABORT 'NO CARRIER'
ABORT 'NO DIALTONE'
ABORT 'ERROR'
ABORT 'NO ANSWER'
TIMEOUT 120
'' AT
OK \rATZ
OK \rAT+CGDCONT=1,'IP','3gnet',,0,0
OK-AT-OK ATDT*99#
CONNECT \d\c
[root@root /]# vim etc/ppp/peers/wcdma
s is pppd script for China liantong
# Usage: root>pppd call cdma
hide-password
noauth
connect '/usr/sbin/chat -s -v -f /etc/ppp/peers/wcdma-chat-connect'
disconnect '/usr/sbin/chat -s -v -f /etc/ppp/peers/wcdma-chat-disconnect'
debug
/dev/ttyUSB2
115200
defaultroute
noipdefault
novj
novjccomp
noccp
ipcp-accept-local
ipcp-accept-remote
local
lock
dump
nodetach
user'card'
[root@root /]# vim etc/ppp/peers/wcdma-chat-disconnect
BORT 'ERROR'
ABORT 'NO DIALTONE'
SAY 'INSending break to the modem\n'
''\k'
''+++ATH'
SAY '\nGood bye\n'
挂在ubifs文件系统
[root@root /]#mount -t usbfs usbfs /proc/bus/usb/
[root@root /]# lsusb
Bus 001 Device 001: ID 1d6b:0001
Bus 001 Device 002: ID 05e3:0606
Bus 001 Device 006: ID 19d2:0031
usb转串口命令:
[root@root /]# ./usb_modeswitch -c /apps/etc/ppp/zte_mf626.conf
Looking for target devices ...
No devices in target mode or class found
Looking for default devices ...
found matching product ID
adding device
Found device in default mode, class or configuration (1)
Accessing device 003 on bus 001 ...
Getting the current device configuration ...
OK, got current device configuration (1)
Using interface number 0
Using endpoints 0x01 (out) and 0x81 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
OK, driver found; name unknown, limitation of libusb1
OK, driver 'unkown' detached
SCSI inquiry data (for identification)
-------------------------
Vendor String: ZTE
Model String: USB SCSI CD-ROM
Revision String: 2.31
-------------------------
USB description data (for identification)
-------------------------
Manufacturer: ZTE,Incorporated
Product: ZTE CDMA Technologies MSM
Serial No.: 1234567890ABCDEF
-------------------------
Setting up communication with interface 0
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
OK, message successfully sent
Reading the response to message 1 (CSW) ...
OK, response successfully read (13 bytes).
Trying to send message 2 to endpoint 0x01 ...
OK, message successfully sent
Reading the response to message 2 (CSW) ...
OK, response successfully read (13 bytes).
Trying to send message 3 to endpoint 0x01 ...
OK, message successfully sent
Reading the response to message 3 (CSW) ...
OK, response successfully read (0 bytes).
Resetting response endpoint 0x81
Resetting message endpoint 0x01
Device is gone, skipping any further commands
-> Run lsusb to note any changes. Bye.
成功后/dev目录会有:
[root@root /]# ls /dev/ttyUSB
ttyUSB0 ttyUSB1 ttyUSB2
后面的收发短信、打电话和拨号过程和前面GPRS模块完全一样。
联系客服