感谢支持
我们一直在努力

Linux环境下CDMA 1X 无线上网的实现

因工作需要,最近为笔记本配备了CDMA无线上网卡,从此网络无处不在~~~~


偶使用的是联通 CDMA 1X 世界风 USB接口的无线网卡,很小,比普通U盘宽一点,此网卡估计是联通找厂商专门OEM的,采用的是美国 Silicon Labs 生产的 CP2101/CP2102 芯片,在 Linux 下驱动很简单。


CP2102简介:该芯片的功能是实现USB 和UART格式间数据的转换. CP2102是全新的UART转USB的单芯片解决方案。该芯片集成了一个符合USB2.0标准的全速功能控制器、EEPROM、缓冲器、和带有调制解调器


对于Linux 2.6.18 的内核,需要配置的地方如下:


1. USB 支持肯定是要的


    Device Drivers -> USB Support ->


        <M> Support for Host-side USB
        [*]   USB device filesystem 
        <M>   EHCI HCD (USB 2.0) support
        <M>   OHCI HCD support
        <M>   UHCI HCD (most Intel and VIA) support
        <M>   USB Modem (CDC ACM) support


        USB Serial Converter support  —>
             <M> USB Serial Converter support
             [*]   USB Generic Serial Driver
             <M>   USB CP2101 UART Bridge Controller
             <M>   USB driver for GSM and CDMA modems
             
             如果使用其他芯片的无线网卡,在这里将它们选上


2.  PPP 模块


    Device Drivers -> Network device support –>


           <M> PPP (point-to-point protocol) support                                         
           [*]   PPP multilink support (EXPERIMENTAL)                                        
           [*]   PPP filtering                                                               
           <M>   PPP support for async serial ports                                          
           <M>   PPP support for sync tty ports                                              
           <M>   PPP Deflate compression                                                     
           <M>   PPP BSD-Compress compression                                                
           <M>   PPP MPPE compression (encryption) (EXPERIMENTAL)                            
           <M>   PPP over Ethernet (EXPERIMENTAL) ~

如果内核已经包含上诉驱动,在插入USB网卡后,通过 dmesg 可以看到相应的网卡硬件信息


hub 2-0:1.0: state 7 ports 2 chg 0000 evt 0006
uhci_hcd 0000:00:1d.1: port 1 portsc 0c80,00
hub 2-0:1.0: over-current change on port 1
hub 2-0:1.0: trying to enable port power on non-switchable hub
uhci_hcd 0000:00:1d.1: port 2 portsc 0893,00
hub 2-0:1.0: over-current change on port 2
hub 2-0:1.0: trying to enable port power on non-switchable hub
hub 2-0:1.0: port 2, status 0101, change 0009, 12 Mb/s
hub 2-0:1.0: debounce: port 2: total 100ms stable 100ms status 0x101
usb 2-2: new full speed USB device using uhci_hcd and address 5
usb 2-2: default language 0x0409
usb 2-2: new device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-2: Product: CP2102 USB to UART Bridge Controller
usb 2-2: Manufacturer: Silicon Labs
usb 2-2: SerialNumber: 0001
usb 2-2: uevent
usb 2-2: configuration #1 chosen from 1 choice
usb 2-2: adding 2-2:1.0 (config #1, interface 0)
usb 2-2:1.0: uevent
usbserial_generic 2-2:1.0: usb_probe_interface
usbserial_generic 2-2:1.0: usb_probe_interface – got id
cp2101 2-2:1.0: usb_probe_interface
cp2101 2-2:1.0: usb_probe_interface – got id
cp2101 2-2:1.0: cp2101 converter detected
usb 2-2: reset full speed USB device using uhci_hcd and address 5
usb 2-2: cp2101 converter now attached to ttyUSB0
drivers/usb/core/inode.c: creating file ‘005’
hub 2-0:1.0: state 7 ports 2 chg 0000 evt 0004


然后安装拨号程序 (ppp、wvdial)


创建拨号配置文件 /etc/wvdial.conf


[Modem0]
Modem = /dev/ttyUSB0
Baud = 230400
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
FlowControl = Hardware (CRTSCTS)


[Dialer cdma]
Username = CARD
Password = CARD
Phone = #777
Stupid Mode = 1
Inherits = Modem0


这个配置文件应该是联通通用的,拨号用户名和密码都是固定的,它的计费是通过插在USB网卡里面的SIM卡对应的手机号码来的。


注意:上面的 Baud (传输速率) 后面的值很重要,如果设置错误,将无法拨号,提示下面的错误:


–> Initializing modem.
–> Sending: ATZ
–> Sending: ATQ0
–> Re-Sending: ATZ
–> Modem not responding.


因为偶用的这个无线网卡的上网速率为 230.4Kbps (包装盒上面有),所以对应的 Baud 值应设为 230400,有的地方可能不同,根据情况适当调整即可,将上网速率 x 1000 即可


最后输入 wvdial cdma 开始拨号


# wvdial cdma
–> WvDial: Internet dialer version 1.54.0
–> Cannot get information for serial port.
–> Initializing modem.
–> Sending: ATZ
ATZ
OK
–> Modem initialized.
–> Sending: ATDT#777
–> Waiting for carrier.
ATDT#777
CONNECT
$DCON
$DCONTYPE:2,2
–> Carrier detected.  Starting PPP immediately.
–> Starting pppd at Thu Jan 24 10:58:41 2008
–> pid of pppd: 4964
–> Using interface ppp0
–> Authentication (CHAP) started
–> Authentication (CHAP) successful
–> local  IP address 220.203.36.20
–> remote IP address 220.192.136.5
–> primary   DNS address 220.192.8.58
–> secondary DNS address 220.192.32.103
–> Script /etc/ppp/ip-up run successful
–> Default route Ok.
–> Nameserver (DNS) Ok.
–> Connected… Press Ctrl-C to disconnect


可以看到拨号成功了,哈哈~~~~ 享受无线上网的乐趣吧~~~


后记:


    原以为很麻烦,没想到如此简单,呵呵~~~~ 还是老子那句话:
    “世上事有难易乎?为之,则难者亦易矣,不为,则易者亦难矣。”


    要是上网速度再快一点就好了,230.4Kbps 只能看看网页、聊聊天,真实下载速度只有 230.4/8 = 28 Kbyte/s 左右,要更快,估计要等 CDMA 2x/3x 或 3G了

赞(0) 打赏
转载请注明出处:服务器评测 » Linux环境下CDMA 1X 无线上网的实现
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏