I. Arm-Linux
ARM-Linux-2.6.17
3G usb modem: huaweie220 (WCDMA), huaweiec156 (evdo)
Arm-Linux must support at least USB host, USB storage, usb fs, and USB serial
Ii. Linux driver
Option. c
In Linux, option. c is the driver for 3G modem. You can modify it to support most of the 3G usb modem.
Currently, the USB option PCMCIA serial driver of my current version depends on usb_serial & usb_ohci_hcd & pccard. Therefore, make sure you have selected these three options. If the host is different, you can modify the dependency of usb_ohci_hcd on your own. I have modified this dependency because I currently use the ISP chip. In short, USB host is required.
Add the following sub-item to the option_ids array:
#define HUAWEI_PRODUCT_E220 0x1003#define HUAWEI_PRODUCT_EC156 0x140c
{ USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220) },{ USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_EC156)},
Iii. Tools
Usb_switchmode-1.2.4
This is the latest version. This tool is used to convert the 3G usb modem identified as a storage device by default to multiple serial devices that can communicate with each other for PPP dial-up connections.
This tool depends on linusb, all of which are cross-compiled ,.
1. Download and cross-compile libusb-0.1.12:
./Configure -- Build = i686-linux -- Host = arm-Linux -- prefix = $ PWD/install
Make
Make-N install (confirm the installation directory)
Make install
Now, libusb compilation is complete.
2. Cross-compile usb_switchmode
Modify makefile:
Cc = arm-Linux-gcc
Export dedir =/home/Jay/tools/3g/libusb-0.1.12/install/include
Libdir =/home/Jay/tools/3g/libusb-0.1.12/install/lib
$ (CC)-I $ (includedir)-L $ (libdir)-o $ (Prog) $ (objs) $ (cflags) $ (libs) $ (ldflags)-static
Make
Successful, so far the static compiled usb_switchmode is obtained
3. Move usb_switchmode to the ARM Linux File System, and copy the usb_switchmode.conf folder to the/etc/directory in ARM Linux. There are many configuration files for 3G usb modem.
4. pppd dialing software
Port pppd2.4.5
./Configure
Make cc = arm-Linux-gcc
What is needed is: pppd chat pppdump pppstats executable programs pppd, chat, pppdump, pppstats
Create the/etc/PPP/peers folder in the embedded file system.
4. Use
When a 3G usb modem is inserted, it is identified as a USB flash drive by default. In this case, the USB _ switchmode tool is used for conversion and is bound to multiple serial ports,
Usb_modeswitch-w-C/etc/usb_modeswitch.d/12d00001505
Among them,-w only displays detailed configuration information.-C refers to the specified configuration file. The configuration file that comes with usb_switchmode seems to be more or less problematic to be used in embedded systems. You must specify
Defaultvendor and defaproduct product parameters.
USB 1-1: new full speed USB device using isp1362-hcd and address 8
USB 1-1: configuration #1 chosen from 1 choice
Option 1-1:1. 0: Option 3G data card converter Detected
USB 1-1: Option 3G data card converter now attached to ttyusb0
Option 1-1:1. 1: Option 3G data card converter Detected
USB 1-1: Option 3G data card converter now attached to ttyusb1
Option 1-1:1. 2: Option 3G data card converter Detected
USB 1-1: Option 3G data card converter now attached to ttyusb2
Option 1-1:1. 3: Option 3G data card converter Detected
USB 1-1: Option 3G data card converter now attached to ttyusb3
Scsi6: SCSI emulation for USB Mass Storage Devices
If you do not have a device node such as ttyusb0, You can manually create it,
Mknod/dev/ttyusb0 C 188 0
Mknod/dev/ttyusb0 C 188 1
....
You can
Echo atz>/dev/ttyusb0. If there is no error, the conversion is basically OK.
The last step is PPP dialing.
Currently, I use e220 in WCDMA and ec156 in evdo. the dialing script is rarely different (the driver is just a bit different from the device number)
1. WCDMA:
debugnodetachlock/dev/ttyUSB0115200user "14522023288"password "******"crtsctsshow-passwordusepeerdnsnoauthnoipdefaultnovjnovjccompnoccpdefaultrouteipcp-accept-localipcp-accept-remoteconnect '/usr/sbin/chat -s -v -f chat-wcdma-connect'disconnect '/usr/sbin/chat -s -v -f chat-wcdma-disconnect'
Chat-WCDMA-Connect:
TIMEOUT 5ABORT 'NO CARRIER'ABORT 'ERROR'ABORT 'NO DIALTONE'ABORT 'BUSY'ABORT 'NO ANSWER''' /rATOK /rATZOK /rAT+CGDCONT=1,"IP","3gnet",,0,0OK-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"
2. evdo
debugnodetachlock/dev/ttyUSB0115200user "ctnet@mycdma.cn"password "vnet.mobi"crtsctsshow-passwordusepeerdnsnoauthnoipdefaultnovjnovjccompnoccpdefaultrouteipcp-accept-localipcp-accept-remoteconnect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-evdo-connect'disconnect '/usr/sbin/chat -s -v -f /etc/ppp/peers/chat-evdo-disconnect'
Chat-evdo-Connect:
TIMEOUT 60ABORT 'NO CARRIER'ABORT 'ERROR'ABORT 'NO DIALTONE'ABORT 'BUSY'ABORT 'NO ANSWER''' /rATZOK-AT-OK ATD#777CONNECT /d/c
Chat-evdo-Disconnect:
ABORT 'NO CARRIER'ABORT 'ERROR'ABORT 'NO DIALTONE'ABORT 'BUSY'ABORT 'NO ANSWER'SAY "/nSending break to the modem/n"'' "/K"'' "+++ATH"SAY "/nGoodbay/n"
Background Dialing:
Pppd call WCDMA &
Pppd call evdo &
Telecom ecdo looks like the account password must use ctnet@mycdma.cn vnet.mobi, not the phone number and the given password.
If the dial is successful, ifconfig shows ppp0.
Ppp0 link encap: Point-to-Point Protocol
Inet ADDR: 183.43.180.134 p-t-P: 113.115.0.1 mask: 255.255.255.255
Up pointopoint running noarp multicast MTU: 1500 Metric: 1
RX packets: 4 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 4 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 3
RX Bytes: 70 (70.0 B) TX Bytes: 64 (64.0 B)
Test network:
# Ping www.baidu.com
Ping www.a.shifen.com (220.181.111.148): 56 data bytes
64 bytes from 220.181.111.148: icmp_seq = 0 TTL = 55 time = 91.3 MS
64 bytes from 220.181.111.148: icmp_seq = 1 TTL = 55 time = 105.3 MS
64 bytes from 220.181.111.148: icmp_seq = 2 TTL = 55 time = 93.9 MS
64 bytes from 220.181.111.148: icmp_seq = 3 TTL = 55 time = 98.9 MS
64 bytes from 220.181.111.148: icmp_seq = 4 TTL = 55 time = 95.4 MS
During Ping, block other network nodes such as eth0: ifconfig eth0 down.
If the domain name cannot be resolved, most of them should be a DNS problem. Originally, the ppp dns was automatically obtained, but the saved path is/etc/PPP/resolv. conf, but Linux uses/etc/resolv. conf, so we can establish a soft connection:
Ln-S/etc/PPP/resolv. CONF/etc/resolv. conf
So far, the use of 3G usb modem in embedded systems has come to an end.
References:
Http://blog.chinaunix.net/uid-20759926-id-3335762.html