红联Linux门户
Linux帮助
当前位置: 红联Linux门户 > SuSE

SuSE10.2下配置波乐5100CDMA无线上网卡

发布时间:2007-10-04 16:09:50来源:红联作者:eometry
原文地址:http://blog.sina.com.cn/sunjes

一直用着一款波乐5100的CDMA无线上网卡,PCMCIA插槽式的。早先在WINDOWS下,该卡的安装就特别蹊跷,需要先插卡,然后运行驱动程序安装包,期间需要将卡拔出,再次插卡才能识别。

而现在系统替换为SUSE10.2,我还能方便的使用它吗?我很疑惑。动手之前,我的理解是,首先,该卡插到PCMCIA后,系统应该能够将它识别为一个modem设备,否则就无法拨号。基于这一考虑,我将卡插入了PCMCIA槽。在YaST里,系统似乎没有自动识别出任何modem设备----这很让我遗憾。开始上网查找资料,试图借鉴其它人的成功经验来解决此问题。然而结果更加让我遗憾,大多数的文章似乎都出自一人之手,其它人都只是不加任何修饰的转载抄袭。这些文章主要聚焦于USB口的CDMA上网卡连接LINUX后的上网问题,并不适用于我的情况。仅有一篇文章在提到该问题时提到过,在LINUX下,PCMCIA设备最终也是通过USB设备模拟来工作的,并且提供了一个通过对内核编译加入对PCMCIA支持的链接。

仔细查看了SUSE10。2的内核编译选项,发现它已经支持PCMCIA了。道路似乎已经走到尽头,怎么办?发扬自力更生的精神,自己解决吧!

使用root登录系统后,开个终端窗口,在窗口中运行:
tail -f /var/log/message

将CDMA卡从槽中拔出插入,看到窗口中的输出:
Oct 2 21:20:34 SuSE-Brooks kernel: pccard: card ejected from slot 0
Oct 2 21:20:40 SuSE-Brooks kernel: pccard: PCMCIA card inserted into slot 0
Oct 2 21:20:40 SuSE-Brooks kernel: pcmcia: registering new device pcmcia0.0
Oct 2 21:20:40 SuSE-Brooks kernel: ttyS1: detected caps 00000700 should be 00000100
Oct 2 21:20:40 SuSE-Brooks kernel: 0.0: ttyS1 at I/O 0x6100 (irq = 3) is a 16C950/954

显然,SuSE已经认识我的PCMCIA槽,并且能够将该槽中插入的设备登记到ttyS1上了!这确实是个非常让人振奋的消息,至少说明我并不需要到处去找驱动,到处去编译安装!但是为什么YaST中的modem安装为什么没能找到这个设备呢?我们手工来测试测试吧。测试前需要准备一个软件:wvdial。在我的系统中,安装的是:wvdial-1.54-103。没有安装该软件的话,请到YaST的软件安装中搜索该软件并装上它。

wvdial提供了两个有用的程序:wvdial、wvdialconf,前者用于进行拨号连接,后者用于拨号配置,并产生文件:/etc/wvdial.conf。

在窗口中运行wvdialconf:
wvdialconf /etc/wvdial.conf
Scanning your serial ports for a modem.

ttyS0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyS0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
ttyS0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
ttyS1<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyS1<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
ttyS1<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
Port Scan<*1>: S2 S3
ttyS4: No such device or address
Port Scan<*1>: S4
ttyS5: No such device or address
Port Scan<*1>: S5
ttyS6: No such device or address
Port Scan<*1>: S6
ttyS7: No such device or address
Port Scan<*1>: S7

Sorry, no modem was detected! Is it in use by another program?
Did you configure it properly with setserial?

Please read the FAQ at http://open.nit.ca/wvdial/

If you still have problems, send mail to wvdial-list@lists.nit.ca.

wvdialconf似乎扫描到ttyS0和ttyS1,并依次扫描到ttyS7,从输出中看出,ttyS0和ttyS1设备存在但是设备无法工作,而其它设备不存在。

运行wvdial碰碰运气:
SuSE-Brooks:~ # wvdial
--> WvDial: Internet dialer version 1.54.0
--> Cannot open /dev/modem: No such file or directory
--> Cannot open /dev/modem: No such file or directory
--> Cannot open /dev/modem: No such file or directory

看来wvdial缺省就是使用/dev/modem设备,这可能与wvdialconf产生的/etc/wvdial.conf文件中的
[Dialer Defaults]
Modem = /dev/modem

有关。ll /dev/modem,无此文件或设备。我们来创建一个/dev/modem设备吧:
SuSE-Brooks:~ # ln -sf /dev/ttyS1 /dev/modem
SuSE-Brooks:~ # ll /dev/modem
lrwxrwxrwx 1 root root 10 10-02 21:31 /dev/modem -> /dev/ttyS1

设备有了,再次运行wvdialconf,提示与第一次运行仍然相同。运行wvdial:
SuSE-Brooks:~ # wvdial
--> WvDial: Internet dialer version 1.54.0
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0
--> Re-Sending: ATZ
--> Modem not responding.

看来它能够通过我们上面建立的连接访问ttyS1。为什么会失败呢?会不会与通讯速率有关?要知道我们的波乐5100工作在153600bps上而不是57600bps上。怎样改变ttyS1的通讯速率?试试setserial工具。没装的请使用YaST安装吧,在此略过安装方法。

SuSE-Brooks:~ # setserial /dev/ttyS1 baud_base 153600

接下来我们是否可以手工编辑一下/etc/wvdial.conf:
[Dialer Defaults]
Modem = /dev/modem
Baud = 57600
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2
Init3 =
FlowControl = Hardware (CRTSCTS)
Area Code =
Phone = #777
Username = CARD
Password = CARD
Ask Password = 0
Dial Command = ATDT
Stupid Mode = 1
Compuserve = 0
Force Address =
Idle Seconds = 300
DialMessage1 =
DialMessage2 =
ISDN = 0
Auto DNS = 1

保存退出后,运行:wvdial,还是提示modem not response。怀疑波特率设置有问题,重来一次:
SuSE-Brooks:/ # setserial /dev/ttyS1 baud_base 230400
SuSE-Brooks:/ # --> WvDial: Internet dialer version 1.54.0
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2
ATQ0 V1 E1 S0=0 &C1 &D2
OK
--> Modem initialized.
--> Idle Seconds = 300, disabling automatic reconnect.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Tue Oct 2 22:01:31 2007
--> pid of pppd: 4766
--> Using interface ppp0
--> pppd: Area Code
--> pppd: Area Code
--> pppd: Area Code
--> pppd: Area Code
--> local IP address 220.205.44.39
--> pppd: Area Code
--> remote IP address 220.192.0.5
--> pppd: Area Code
--> primary DNS address 220.192.0.130
--> pppd: Area Code
--> secondary DNS address 220.192.8.58
--> pppd: Area Code
--> Script /etc/ppp/ip-up run successful
--> Default route Ok.
--> Nameserver (DNS) Ok.
--> Connected... Press Ctrl-C to disconnect
--> pppd: Area Code

拨号成功!让我们来上网试试,打开浏览器,无法浏览?再检查:
SuSE-Brooks:/ # route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
220.192.0.5 * 255.255.255.255 UH 0 0 0 ppp0
loopback * 255.0.0.0 U 0 0 0 lo
default * 0.0.0.0 U 0 0 0 ppp0

按说没问题啊,试着:
SuSE-Brooks:/ # route del default
SuSE-Brooks:/ # route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
220.192.0.5 * 255.255.255.255 UH 0 0 0 ppp0
loopback * 255.0.0.0 U 0 0 0 lo
SuSE-Brooks:/ # route add -net default netmask 0.0.0.0 gw 220.192.0.5
SuSE-Brooks:/ # route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
220.192.0.5 * 255.255.255.255 UH 0 0 0 ppp0
loopback * 255.0.0.0 U 0 0 0 lo
default 220.192.0.5 0.0.0.0 UG 0 0 0 ppp0


再来访问,一切OK!我的这张波乐5100PCMCIA的CDMA卡,终于工作在SuSE10.2下了!

值得注意的是,在拨号阶段经常会发现,有时候明明已经开始拨号了,CDMA卡也有响应了,但是就是没有下一步的反应:
SuSE-Brooks:/ # wvdial &

SuSE-Brooks:/ # --> WvDial: Internet dialer version 1.54.0
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0
ATQ0
OK
--> Re-Sending: ATZ
ATZ
OK
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0
ATQ0
OK
--> Re-Sending: ATZ
ATZ
OK
--> Initializing modem.
--> Sending: ATZ
--> Sending: ATQ0
ATQ0
OK
--> Re-Sending: ATZ
ATZ
OK

[1]+ Exit 1 wvdial

只需要将/etc/wvdial.conf中的Init2注销或打开即可。找不到原因,并且发现有时候注释掉是可以拨号的,而有时候打开是可以拨号的,怀疑可能是工作状态不稳定造成的。

综述:
1、检查message中查看pcmcia是否能够被识别,如果能够识别,就不需要去找pcmcia的支持;

2、setserial可以修改modem的通信波特率,注意,由于没有硬件厂商提供的驱动程序,硬件并不一定会工作在它指定的波特率上,多试;

3、硬件工况可能并不稳定,此时需要观察工作状态,再做调整;

4、拨号成功后,只要获得了IP地址就说明连接已经OK了,上不了网的话很可能是你的路由表的问题,注意调整。
文章评论

共有 0 条评论