亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2525 | 回復(fù): 0
打印 上一主題 下一主題

7405 平臺(tái)移植華為EC122上網(wǎng)卡 [復(fù)制鏈接]

論壇徽章:
1
技術(shù)圖書徽章
日期:2013-10-29 15:46:41
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2011-12-21 08:41 |只看該作者 |倒序?yàn)g覽
一、 開發(fā)環(huán)境
板子:海思3716C 
dongle:華為EC122
虛擬機(jī):ubuntu10.10
在這里參照了一篇博文,由于所移植的上網(wǎng)卡是一個(gè)型號(hào),省去了找資料的很多麻煩,蒼天啊,大地啊,感動(dòng)。呵呵
http://blog.csdn.net/liuming_3385/archive/2011/02/24/6206306.aspx
二、以前也移植過一個(gè)dongle,那次是稀里糊涂的搞了半個(gè)月,最后雖然能夠撥號(hào)上網(wǎng)了,但是不穩(wěn)定,在移植中對一些知識(shí)的了解也是一知半解。通過這次的移植,了解了3G上網(wǎng)卡的工作流程。需要的工具:ppp-2.3.5.tar.gz  udev-100.tar.bz2
1、libusb-0.1.12.tar.gz   下載地址:http://www.libusb.org/
       libusb 是一個(gè)用C語言開發(fā)的跨平臺(tái)的USB設(shè)備訪問接口庫。libusb 設(shè)計(jì)了一系列的外部API 為應(yīng)用程序所調(diào)用,通過這些API應(yīng)用程序可以操作硬件,從libusb的源代碼可以看出,這些API 調(diào)用了內(nèi)核的底層接口,和kernel driver中所用到的函數(shù)所實(shí)現(xiàn)的功能差不多,只是libusb更加接近USB 規(guī)范。使得libusb的使用也比開發(fā)內(nèi)核驅(qū)動(dòng)相對容易的。需要注意的是libusb有兩個(gè)版本,0.1 和 1.0版本,usb-modeswitch依賴libusb,但是1.0版本的編譯不過。源碼里有標(biāo)準(zhǔn)的automake 工具生成的configure文件,直接交叉編譯。
2、usb-modeswitch-1.1.7.tar.bz2   下載地址:http://www.draisberghof.de/usb_modeswitch/
主頁說明:
    USB_ModeSwitch is (surprise!) a mode switching tool for controlling "flip flop" (multiple device) USB gear.
Several new USB devices (especially high-speed WAN stuff, based on cell phone chipsets containing that feature) have their MS Windows drivers onboard; when plugged in for the first time they act like a flash storage and start installing the driver from there. After installation (and on every consecutive plugging) the driver switches the mode internally, the storage device vanishes (in most cases), and a new device (like an USB modem) shows up. Modem maker "Option" calls that feature "ZeroCD (TM)" since it eliminates the need for shipping a separate driver carrier.

In the beginning, nothing of this was documented in any form and there was hardly any Linux support available.
On the good side, most of the known devices do work in both modes with the available Linux drivers like "usb-storage" or "option" (an optimized serial driver for high-speed modems).That leaves only the problem of the mode switching from storage to modem or whatever the thing is supposed to do.

Fortunately there are things like human reason, USB sniffing programs and "libusb". It is possible to eavesdrop the communication of the MS Windows driver, to isolate the command or action that does the switching and to reproduce the same thing under the rule of Linux or the BSD variants.

USB_ModeSwitch makes this process easy to handle by taking the important parameters from a configuration file and doing all the initialization and communication stuff, with heavy help from "libusb".
It is mainly used automatically - via udev events and rules - to do the switch without any user interaction. But it can also be run as a command line tool, usually when trying to make unknown devices work with it.
USB_ModeSwitch 是控制"flip flop"(多重設(shè)備)USB裝置的模式轉(zhuǎn)換工具, 現(xiàn)在一些新的USB 設(shè)備(特別是一些高速 WAN 設(shè)備,如3G數(shù)據(jù)卡)都有MS Windows的驅(qū)動(dòng)程序,當(dāng)?shù)谝淮尾迦霗C(jī)子的時(shí)候,它們處于閃存模式,并從中提取和安裝驅(qū)動(dòng)。在驅(qū)動(dòng)安裝完畢之后,驅(qū)動(dòng)馬上轉(zhuǎn)換模式,儲(chǔ)存設(shè)備消失(基本上都是這樣的),然后一個(gè)新的設(shè)備(比如一個(gè)USB modem)出現(xiàn)。有些人把這個(gè)特性叫做"ZeroCD"。
1.   Usb 閃存模式:提取和安裝驅(qū)動(dòng)
2.   轉(zhuǎn)換模式:儲(chǔ)存設(shè)備模式轉(zhuǎn)換為所需(如3G)設(shè)備模式
3.   所需設(shè)備模式:使用設(shè)備新的功能
 編譯修改Makefile ,指定交叉編譯工具鏈和libusb的頭文件和庫的位置:
root@wang:/work/dongle/usb-modeswitch-1.1.7# cat Makefile  -n
     1 DESTDIR     = /work/dongle/rootfs
     2 PROG        = usb_modeswitch
     3 VERS        = 1.1.7
     4 CC          = mipsel-linux-gcc
     5 STRIP       = mipsel-linux-strip
     6 CFLAGS      += -Wall
     7 LIBS        = -l usb
     8 RM          = /bin/rm -f
     9 OBJS        = usb_modeswitch.c
    10 PREFIX      = $(DESTDIR)/usr
    11 ETCDIR      = $(DESTDIR)/etc
    12 UDEVDIR     = $(DESTDIR)/lib/udev
    13 SBINDIR     = $(PREFIX)/sbin
    14 MANDIR      = $(PREFIX)/share/man/man1
    15 CFLAGS      += -I /work/dongle/rootfs/include
    16 CFLAGS      += -L /work/dongle/rootfs/lib
      修改 usb_modeswitch.conf 文件,加入設(shè)備的信息:這一步很關(guān)鍵,資料不好找啊,除非生產(chǎn)廠提供支持。在usb-modeswitch-1.1.7目錄下有device_reference.txt文件,在這里可以查到一些設(shè)備的信息,但不完整。關(guān)于設(shè)備的Vendor  Product可以通過另外一種方法,在后邊會(huì)看到。
root@wang:/work/dongle/usb-modeswitch-1.1.7# cat usb_modeswitch.conf 
# Configuration for the usb_modeswitch package, a mode switching tool for
# USB devices providing multiple states or modes
#
# This file is evaluated by the wrapper script "usb_modeswitch_dispatcher"
# in /usr/sbin
# To enable an option, set it to "1", "yes" or "true" (case doesn't matter)
# Everything else counts as "disable"
# Disable automatic mode switching globally (e.g. to access the original
# install storage)
DisableSwitching=0
# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_<interface-name>" (and probably others)

EnableLogging=0
# Huawei EC122
#
# #
#
# # Contributor: Anders Blomdell, Ahmed Soliman
#
DefaultVendor= 0x12d1
DefaultProduct= 0x1446
TargetVendor= 0x12d1
TargetProduct= 0x140c
MessageContent="55534243123456780000000000000011060000000000000000000000000000"
3、udev-100.tar.bz2 下載地址:http://www.kernel.org/pub/linux/utils/kernel/hotplug/
使用更高版本的udev沒編譯過。
udev是一個(gè)工作在用戶空間的設(shè)備管理工具。在USB_ModeSwitch 的介紹中我們已經(jīng)知道,USB_ModeSwitch 依賴于udev實(shí)現(xiàn)熱插熱拔。
修改Makefile:
    93 prefix ?=$(PWD)/rootfs
    94 etcdir = ${prefix}/etc
    95 sbindir = ${prefix}/sbin
    96 usrbindir = ${prefix}/usr/bin
    97 usrsbindir = ${prefix}/usr/sbin
    98 libudevdir = ${prefix}/lib/udev
    99 mandir = ${prefix}/usr/share/man
   100 configdir = ${etcdir}/udev
   101 udevdir = /dev
   102 DESTDIR =
   103
   104 INSTALL = /usr/bin/install -c
   105 INSTALL_PROGRAM = ${INSTALL}
   106 INSTALL_DATA = ${INSTALL} -m 644
   107 INSTALL_SCRIPT = ${INSTALL_PROGRAM}
   108 PWD = $(shell pwd)
   109
   110 CROSS_COMPILE ?=mipsel-linux-
   111 CC = $(CROSS_COMPILE)gcc
   112 LD = $(CROSS_COMPILE)gcc
   113 AR = $(CROSS_COMPILE)ar
4、完事具備,還欠東風(fēng)。設(shè)備節(jié)點(diǎn)準(zhǔn)備完以后,還需要撥號(hào)工具上網(wǎng)。這就需要PPPD工具上場了。
修改configure文件:
root@wang:/work/dongle/ppp-2.4.5# cat configure -n
     1 #!/bin/sh
     2 # $Id: configure,v 1.38 2008/06/15 07:08:49 paulus Exp $
     3
     4 # Where to install stuff by default
     5 export CC=mipsel-linux-gcc
     6 DESTDIR=$PWD/rootfs/usr/local
     7 SYSCONF=$PWD/rootfs/etc
運(yùn)行 ./configure 生成Makefile。
修改Makefile 將install 命令中的 -s 選項(xiàng)去掉。
生成的工具和庫中我們需要的是pppd chat  rp-pppoe.so
 
5、將生成的可執(zhí)行文件和庫復(fù)制到根文件系統(tǒng)。將各種配置文件復(fù)制到根文件系統(tǒng)。usb_modeswitch.conf  將安裝udev時(shí)生成的/etc/udev目錄復(fù)制到根文件系統(tǒng)的/etc 下;將、ppp-2.4.5/etc.ppp 目錄下的內(nèi)容復(fù)制到/etc/ppp目錄下。根據(jù)上邊介紹的攻略生成PPPD 的配置文件并放到根文件系統(tǒng)的相應(yīng)目錄。

6、掛載根文件系統(tǒng)
# mount -t usbfs none  /proc/bus/usb
# mount -t nfs 172.16.7.153:/nfs/7550B/rootfs/dev/ /dev/
# mount -t nfs 172.16.7.153:/nfs/7550B/rootfs/usr/ /usr/
# mount -t nfs 172.16.7.153:/nfs/7550B/rootfs/etc/ /etc/
# cat /proc/bus/usb/devices 

T:  Bus=04 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.06
S:  Manufacturer=Linux 2.6.18-7.5 ohci_hcd
S:  Product=BRCM OHCI
S:  SerialNumber=ohci-brcm
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.06
S:  Manufacturer=Linux 2.6.18-7.5 ohci_hcd
S:  Product=BRCM OHCI
S:  SerialNumber=ohci-brcm
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 2
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.06
S:  Manufacturer=Linux 2.6.18-7.5 ehci_hcd
S:  Product=BRCM EHCI
S:  SerialNumber=ehci-brcm
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=256ms

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 2
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 2.06
S:  Manufacturer=Linux 2.6.18-7.5 ehci_hcd
S:  Product=BRCM EHCI
S:  SerialNumber=ehci-brcm
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=256ms

7、安裝設(shè)備驅(qū)動(dòng)。
# lsmod
swsysdrv 2416 0 - Live 0xc0060000
bcmdriver 15904 0 - Live 0xc0064000
yaffs 125840 2 - Live 0xc00bf000
brcmnand 94000 4 - Live 0xc0079000
# cd /usr/local/bin/
# ls
chat                 pppoe-discovery      udevtest
comgt                swapp                udevtrigger
fat32format          swppp-off            unzip
fdisk                udevcontrol          usb_modeswitch
libusb-config        udevd                usb_modeswitch.conf
mke2fs               udevinfo             zip
option.ko            udevmonitor
pppd                 udevsettle
# insmod option.ko 
drivers/usb/serial/usb-serial.c: USB Serial support registered for GSM modem (1-port)
usbcore: registered new driver option
drivers/usb/serial/option.c: USB Driver for GSM modems: v0.7.1
# lsmod
option 7360 0 - Live 0xc005d000
swsysdrv 2416 0 - Live 0xc0060000
bcmdriver 15904 0 - Live 0xc0064000
yaffs 125840 2 - Live 0xc00bf000
brcmnand 94000 4 - Live 0xc0079000
8、運(yùn)行udevd 工具,以守護(hù)進(jìn)程運(yùn)行。
# udevd -h
Usage: udevd [--help] [--daemon] [--debug-trace] [--verbose] [--version]
# udevd --daemon
# ps
  PID USER       VSZ STAT COMMAND
    1 root      1200 S    init       
    2 root         0 SW   [migration/0]
    3 root         0 SWN  [ksoftirqd/0]
    4 root         0 SW   [migration/1]
    5 root         0 SWN  [ksoftirqd/1]
    6 root         0 SW<  [events/0]
    7 root         0 SW<  [events/1]
    8 root         0 SW<  [khelper]
    9 root         0 SW<  [kthread]
   10 root         0 SW<  [kblockd/0]
   11 root         0 SW<  [kblockd/1]
   12 root         0 SW<  [khubd]
   13 root         0 SW<  [kseriod]
   14 root         0 SW   [pdflush]
   15 root         0 SW   [pdflush]
   16 root         0 SW<  [kswapd0]
   17 root         0 SW<  [aio/0]
   18 root         0 SW<  [aio/1]
   19 root         0 SW<  [ata/0]
   20 root         0 SW<  [ata/1]
   21 root         0 SW<  [ata_aux]
   22 root         0 SW<  [scsi_eh_0]
   23 root         0 SW<  [scsi_eh_1]
   24 root         0 SW   [mtdblockd]
   25 root         0 SW   [romblockd]
   26 root         0 SW<  [pegasus]
   27 root         0 SW<  [kpsmoused]
   47 bin        824 S    portmap 
   48 root      1188 S    telnetd 
   67 root       956 S    /usr/bin/swsyscmd 
   97 root         0 SW<  [kjournald]
  105 root      1236 S    -/bin/ash 
  108 root         0 SW<  [rpciod/0]
  109 root         0 SW<  [rpciod/1]
  110 root         0 SW   [lockd]
  122 root       900 S <  udevd --daemon 
  123 root      1192 R    ps 
9、在U口插上dongle。
# usb 3-2: new full speed USB device using brcm-ohci-0 and address 2
usb 3-2: configuration #1 chosen from 1 choice
scsi2 : SCSI emulation for USB Mass Storage devices
isa bounce pool size: 16 pages
  Vendor: HUAWEI    Model: Mass Storage      Rev: 2.31
  Type:   CD-ROM                             ANSI SCSI revision: 00
scsi 2:0:0:0: Attached scsi generic sg1 type 5

# cd /usr/local/bin/
# ls
chat                 pppoe-discovery      udevtest
comgt                swapp                udevtrigger
fat32format          swppp-off            unzip
fdisk                udevcontrol          usb_modeswitch
libusb-config        udevd                usb_modeswitch.conf
mke2fs               udevinfo             zip
option.ko            udevmonitor
pppd                 udevsettle
10、轉(zhuǎn)化ROM設(shè)備為usb設(shè)備。
# usb_modeswitch -c usb_modeswitch.conf 

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
 Found devices in default mode, class or configuration (1)
Accessing device 002 on bus 003 ...
Getting the current device configuration ...
 OK, got current device configuration (1)
Using endpusb 3-2: usbfs: process 138 (usb_modeswitch) did not claim interface 0 before use
oints 0x08 (out) and 0x87 (in)
Using endpoints 0x08 (out) and 0x87 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached

SCSI inquiry data (for identification)
-------------------------
  Vendor String: HUAWEI  
   Model String: Mass Storage    
Revision String: 2.31
-------------------------

USB description data (for identification)
-------------------------
Manufacturer: HUAECHNOLOGIES
     Product: HUAWEI Mobile
  Serial No.: ----------------------
Setting up communication with interface 0 ...
Using endpoint 0x08 for message sending ...
Trying to send message 1 to endpoint 0x08 ...
 OK, message successfully sent
Resetting response endpoint 0x87
 Error resetting endpoint: -145
Resetting message endpoint 0x08
 Error resetting endpoint: -145
usb 3-2: USB disconnect, address 2
 Device is gone, skipping any further commands
-> Run lsusb to note any changes. Bye.

# usb 3-2: new full speed USB device using brcm-ohci-0 and address 3
usb 3-2: configuration #1 chosen from 1 choice
option 3-2:1.0: GSM modem (1-port) converter detected
usb 3-2: GSM modem (1-port) converter now attached to ttyUSB0
option 3-2:1.1: GSM modem (1-port) converter detected
usb 3-2: GSM modem (1-port) converter now attached to ttyUSB1
option 3-2:1.2: GSM modem (1-port) converter detected
usb 3-2: GSM modem (1-port) converter now attached to ttyUSB2
option 3-2:1.3: GSM modem (1-port) converter detected
usb 3-2: GSM modem (1-port) converter now attached to ttyUSB3
scsi3 : SCSI emulation for USB Mass Storage devices

#   Vendor: HUAWEI    Model: Mass Storage      Rev: 2.31
  Type:   CD-ROM                             ANSI SCSI revision: 00
scsi 3:0:0:0: Attached scsi generic sg1 type 5


 ls /dev/
bcmdebug         hdc6             mtdr2            strm9
bcmdma           input            mtdr3            sysdev
bcmgraphics_0    intdev           mtdr4            tty
bcmgraphics_1    kf2x00           mtdr5            tty0
bcmindex_0       kf2x01           mtdr6            tty1
bcmindex_1       kfir0            mtdr7            tty2
bcmindex_2       kmem             mtdr8            tty3
bcmindex_3       loop0            mtdr9            tty4
bcmio            loop1            null             tty5
bcmkeypad        loop10           pod              ttyS0
bcmleds          loop11           ppp              ttyS1
bcmmessage       loop12           ptmx             ttyS2
bcmoutput_0      loop13           pts              ttyS64
bcmoutput_1      loop14           ram0             ttyUSB0
bcmpaxel         loop15           ram1             ttyUSB1
bcmpcm_0         loop2            random           ttyUSB2
bcmpcm_1         loop3            scarda           ttyUSB3
bcmpcmcapture_0  loop4            scardb           urandom
bcmpcmcapture_1  loop5            scd0             usbdev3.2
bcmplay_0        loop6            scd1             usbdev3.2_ep00
bcmplay_1        loop7            sda              usbdev3.2_ep08
bcmplayes_0      loop8            sda1             usbdev3.2_ep87
bcmplayes_1      loop9            sda2             usbdev3.3
bcmplayes_2      Makefile         sda3             usbdev3.3_ep00
bcmplayes_3      mem              sda4             usbdev3.3_ep02
bcmqamoob        mtd0             sda5             usbdev3.3_ep03
bcmrecord_0      mtd1             sda6             usbdev3.3_ep04
bcmrecord_1      mtd10            sdb              usbdev3.3_ep06
bcmrecord_2      mtd11            sdb1             usbdev3.3_ep08
bcmrecord_3      mtd12            sdb2             usbdev3.3_ep81
bcmremote_a      mtd2             sdb3             usbdev3.3_ep82
bcmremote_b      mtd3             sdb4             usbdev3.3_ep83
bcmsejinkbd      mtd4             sdb5             usbdev3.3_ep84
bcmsejinrem      mtd5             sdb6             usbdev3.3_ep85
bcmsettopapi     mtd6             sdc              usbdev3.3_ep86
bcmtransport     mtd7             sdc1             usbdev3.3_ep87
bcmtuner         mtd8             sdc2             usbdev3.5
bcmupggpio       mtd9             sdc3             usbdev3.5_ep00
bcmupgi2c        mtdblock0        sdc4             usbdev3.5_ep08
bcmvbi           mtdblock1        sdc5             usbdev3.5_ep87
brcm0            mtdblock10       sdc6             usbdev3.6
console          mtdblock11       sg1              usbdev3.6_ep00
docsisio         mtdblock12       sr0              usbdev3.6_ep02
hda              mtdblock2        sr1              usbdev3.6_ep03
hda1             mtdblock3        strm0            usbdev3.6_ep04
hda2             mtdblock4        strm1            usbdev3.6_ep06
hda3             mtdblock5        strm10           usbdev3.6_ep08
hda4             mtdblock6        strm11           usbdev3.6_ep81
hda5             mtdblock7        strm12           usbdev3.6_ep82
hda6             mtdblock8        strm2            usbdev3.6_ep83
hdc              mtdblock9        strm3            usbdev3.6_ep84
hdc1             mtdr0            strm4            usbdev3.6_ep85
hdc2             mtdr1            strm5            usbdev3.6_ep86
hdc3             mtdr10           strm6            usbdev3.6_ep87
hdc4             mtdr11           strm7            zero
hdc5             mtdr12           strm8
到此為止生成了設(shè)別節(jié)點(diǎn),下面我們撥號(hào):


11、pppd撥號(hào):
# pppd call cdma2000&
# No Rx Descriptor, disabling rx DMA
No Rx Descriptor, disabling rx DMA
Can't create lock file /var/lock/LCK..ttyUSB0: No such file or directory
在/var 目錄下生成lock目錄。
# pppd call cdma2000&
# Warning: couldn't open ppp database /var/run/pppd2.tdb
Can't create lock file /var/lock/LCK..ttyUSB0: No such file or directory

# mkdir /var/lock/
# pppd call cdma2000&
# Warning: couldn't open ppp database /var/run/pppd2.tdb
Fatal signal 11
Script /usr/local/bin/chat -s -v -f /etc/ppp/cdma2000-connect-chat finished (pid 202), status = 0x7f
Connect script failed

[1] + Done(8)                    pppd call cdma2000
# mkdir /var/run
# pppd call cdma2000&
# lockd: cannot monitor 172.16.7.153
lockd: failed to monitor 172.16.7.153
Warning: couldn't open ppp database /var/run/pppd2.tdb
Fatal signal 11
Script /usr/local/bin/chat -s -v -f /etc/ppp/cdma2000-connect-chat finished (pid 205), status = 0x7f
Connect script failed

# touch /var/run/pppd2.tdb
[1] + Done(8)                    pppd call cdma2000

# pppd call cdma2000&
# timeout set to 5 seconds
abort on (NO CARRIER)
abort on (ERROR)
abort on (NO DIALTONE)
abort on (BUSY)
abort on (NO ANSWER)
send (^MATZ^M)
expect (OK)
ATZ^M^M
OK
 -- got it

send (ATD#777^M)
expect (CONNECT)
^M
ATD#777^M^M
CONNECT
 -- got it

send (\d)
Script /usr/local/bin/chat -s -v -f /etc/ppp/cdma2000-connect-chat finished (pid 218), status = 0x0
Serial connection established.
using channel 1
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x522db7d5> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x522db7d5> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x2 <mru 1448> <asyncmap 0x0> <auth chap MD5> <magic 0x30404dbb> <pcomp> <accomp>]
sent [LCP ConfAck id=0x2 <mru 1448> <asyncmap 0x0> <auth chap MD5> <magic 0x30404dbb> <pcomp> <accomp>]
rcvd [CHAP Challenge id=0x3 <22527ee4763d952b0c8c1faf57230286>, name = "utstar.com"]
sent [CHAP Response id=0x3 <832bf64c4a5451605c7cb078c90a9480>, name = "CARD"]
rcvd [CHAP Success id=0x3 "\000"]
CHAP authentication succeeded: 
CHAP authentication succeeded
sent [IPCP ConfReq id=0x1 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [IPCP ConfReq id=0x4 <compress VJ 07 00> <addr 115.168.64.83>]
sent [IPCP ConfRej id=0x4 <compress VJ 07 00>]
rcvd [IPCP ConfReq id=0x6 <addr 115.168.64.83>]
sent [IPCP ConfAck id=0x6 <addr 115.168.64.83>]
rcvd [IPCP ConfNak id=0x1 <addr 115.171.106.187> <ms-dns1 219.141.140.10> <ms-dns2 219.141.136.10>]
sent [IPCP ConfReq id=0x2 <addr 115.171.106.187> <ms-dns1 219.141.140.10> <ms-dns2 219.141.136.10>]
rcvd [IPCP ConfAck id=0x2 <addr 115.171.106.187> <ms-dns1 219.141.140.10> <ms-dns2 219.141.136.10>]
local  IP address 115.171.106.187
remote IP address 115.168.64.83
primary   DNS address 219.141.140.10
secondary DNS address 219.141.136.10

# ps
  PID USER       VSZ STAT COMMAND
    1 root      1200 S    init       
    2 root         0 SW   [migration/0]
    3 root         0 SWN  [ksoftirqd/0]
    4 root         0 SW   [migration/1]
    5 root         0 SWN  [ksoftirqd/1]
    6 root         0 SW<  [events/0]
    7 root         0 SW<  [events/1]
    8 root         0 SW<  [khelper]
    9 root         0 SW<  [kthread]
   10 root         0 SW<  [kblockd/0]
   11 root         0 SW<  [kblockd/1]
   12 root         0 SW<  [khubd]
   13 root         0 SW<  [kseriod]
   14 root         0 SW   [pdflush]
   15 root         0 SW   [pdflush]
   16 root         0 SW<  [kswapd0]
   17 root         0 SW<  [aio/0]
   18 root         0 SW<  [aio/1]
   19 root         0 SW<  [ata/0]
   20 root         0 SW<  [ata/1]
   21 root         0 SW<  [ata_aux]
   22 root         0 SW<  [scsi_eh_0]
   23 root         0 SW<  [scsi_eh_1]
   24 root         0 SW   [mtdblockd]
   25 root         0 SW   [romblockd]
   26 root         0 SW<  [pegasus]
   27 root         0 SW<  [kpsmoused]
   47 bin        824 S    portmap 
   48 root      1188 S    telnetd 
   67 root       956 S    /usr/bin/swsyscmd 
   97 root         0 SW<  [kjournald]
  105 root      1236 S    -/bin/ash 
  108 root         0 SW<  [rpciod/0]
  109 root         0 SW<  [rpciod/1]
  110 root         0 SW   [lockd]
  122 root       900 S <  udevd --daemon 
  157 root         0 SW<  [scsi_eh_3]
  158 root         0 SW<  [usb-storage]
  217 root      1480 S    pppd call cdma2000 
  221 root      1192 R    ps 
# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:07:63:00:00:0B  
          inet addr:172.16.7.155  Bcast:172.16.7.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7281 errors:2 dropped:2 overruns:0 frame:2
          TX packets:2630 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1850283 (1.7 MiB)  TX bytes:437288 (427.0 KiB)
          Interrupt:16 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1344 (1.3 KiB)  TX bytes:1344 (1.3 KiB)

ppp0      Link encap:Point-to-Point Protocol  
          inet addr:115.171.106.187  P-t-P:115.168.64.83  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1448  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)


12、拔掉網(wǎng)線測試,主意這里的網(wǎng)線是交換機(jī)的廣域網(wǎng)口,如果是lan口的話,NFS服務(wù)不可用。

# ps
  PID USER       VSZ STAT COMMAND
    1 root      1200 S    init       
    2 root         0 SW   [migration/0]
    3 root         0 SWN  [ksoftirqd/0]
    4 root         0 SW   [migration/1]
    5 root         0 SWN  [ksoftirqd/1]
    6 root         0 SW<  [events/0]
    7 root         0 SW<  [events/1]
    8 root         0 SW<  [khelper]
    9 root         0 SW<  [kthread]
   10 root         0 SW<  [kblockd/0]
   11 root         0 SW<  [kblockd/1]
   12 root         0 SW<  [khubd]
   13 root         0 SW<  [kseriod]
   14 root         0 SW   [pdflush]
   15 root         0 SW   [pdflush]
   16 root         0 SW<  [kswapd0]
   17 root         0 SW<  [aio/0]
   18 root         0 SW<  [aio/1]
   19 root         0 SW<  [ata/0]
   20 root         0 SW<  [ata/1]
   21 root         0 SW<  [ata_aux]
   22 root         0 SW<  [scsi_eh_0]
   23 root         0 SW<  [scsi_eh_1]
   24 root         0 SW   [mtdblockd]
   25 root         0 SW   [romblockd]
   26 root         0 SW<  [pegasus]
   27 root         0 SW<  [kpsmoused]
   47 bin        824 S    portmap 
   48 root      1188 S    telnetd 
   67 root       956 S    /usr/bin/swsyscmd 
   97 root         0 SW<  [kjournald]
  105 root      1236 S    -/bin/ash 
  108 root         0 SW<  [rpciod/0]
  109 root         0 SW<  [rpciod/1]
  110 root         0 SW   [lockd]
  122 root       900 S <  udevd --daemon 
  157 root         0 SW<  [scsi_eh_3]
  158 root         0 SW<  [usb-storage]
  217 root      1480 S    pppd call cdma2000 
  228 root      1192 R    ps 
# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
115.168.64.83   0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
172.16.7.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp0
# ping www.baidu.com
PING www.baidu.com (61.135.169.105): 56 data bytes
64 bytes from 61.135.169.105: seq=0 ttl=54 time=174.563 ms
64 bytes from 61.135.169.105: seq=1 ttl=54 time=176.748 ms
64 bytes from 61.135.169.105: seq=2 ttl=54 time=176.766 ms
64 bytes from 61.135.169.105: seq=3 ttl=54 time=188.764 ms
64 bytes from 61.135.169.105: seq=4 ttl=54 time=174.761 ms
64 bytes from 61.135.169.105: seq=5 ttl=54 time=177.752 ms
64 bytes from 61.135.169.105: seq=6 ttl=54 time=188.751 ms
64 bytes from 61.135.169.105: seq=7 ttl=54 time=193.745 ms

--- www.baidu.com ping statistics ---
8 packets transmitted, 8 packets received, 0% packet loss
round-trip min/avg/max = 174.563/181.481/193.745 ms
總結(jié)一下,其實(shí)借助udev設(shè)備,可以實(shí)現(xiàn)dongle的熱插熱拔,這需要編寫udev腳本。以后在學(xué)習(xí)了。
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP