Linux Unwired [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Linux Unwired [Electronic resources] - نسخه متنی

Edd Dumbill, Brian Jepson, Roger Weeks

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








9.3 Phones and Cards


The following sections describe the cards and phones that we tested
with Linux. They include an assortment of devices that can talk CDMA
1xRTT, GPRS, and EDGE. Each section includes the information you need
to make a data call.

Table 9-1 contains the results of the testing with
these devices. In each download test, we moved a 384 KB compressed
datafile down from an HTTP server using wget 1.8.1
(wget_1.8.1-6.1_i386.deb) and recorded the
transfer rate. In each upload test, we uploaded the same file using
Debian's ftp client
(ftp_0.17-9_i386.deb) and recorded the
transfer rate.

Table 9-1. Download and upload speeds with various devices

Device


Carrier


Signal[1]


Download test 1


Upload test 1


Download test 2


Upload test 2


Merlin C201


Sprint


65%


12.64 KB/sec


8.7 KB/sec


12.86 KB/sec


9.0 KB/sec


Motorola v120e


Verizon Wireless


97%


13.94 KB/sec


5.7 KB/sec


13.3 KB/sec


7.5 KB/sec


Nokia 6200


AT&T Wireless[2]


55%


11.05 KB/sec


6.0 KB/sec


11.31 KB/sec


6.0 KB/sec


Nokia 6200


T-Mobile[3]


65%


2.61 KB/sec


2.8 KB/sec


1.74 KB/sec


2.6 KB/sec


Merlin G100


T-Mobile


32-54%


4.26 KB/sec


1.4 KB/sec


5.09 KB/sec


1.4 KB/sec

[1] Reported by AT+CSQ and divided by 31.


[2] Connected in an EDGE-enabled
AT&T Wireless market.

[3] At the time of this writing, T-Mobile does
not support EDGE.


These devices use a basic Hayes command set but also support an
extended command set (IS-707 AT command set). You can use this
command set to ask the modem about signal strength and the type of
network to which it's connected. For example, if you
issue the command AT+CSQ?, the phone will respond
with the signal strength (on a scale of 0-31) and the frame error
rate, which will be zero if you haven't had any
network activity.

Table 9-2 shows some of the commands and sample
responses from the Novatel Wireless Merlin C201 (you should be able
to use these commands with any CDMA or GPRS device described later in
this chapter). To issue one of these commands, use minicom or Kermit;
type the command and then press Enter. Example 9-1
shows a session where we set the serial speed and then run Kermit to
have a conversation with the modem. If your user account does not
have the correct permissions, you must set the permisions
appropriately (on Debian, we add the bjepson user to the dialout
group).

Example 9-1. Kermit session with the Novatel Wireless Merlin C201

bjepson@debian:~$ setserial /dev/ttyS2 baud_base 230400
bjepson@debian:~$ kermit
C-Kermit 7.0.196, 1 Jan 2000, for Linux
Copyright (C) 1985, 2000,
Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/home/bjepson/) C-Kermit>set line /dev/ttyS2
(/home/bjepson/) C-Kermit>set speed 115200
/dev/ttyS2, 115200 bps
(/home/bjepson/) C-Kermit>connect
Connecting to /dev/ttyS2, speed 115200.
The escape character is Ctrl-\ (ASCII 28, FS)
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
at
OK
at+csq?
+CSQ: 22, 00000000,00000000
OK


If you can't see the commands you are typing but are
still getting a response, the modem is probably set to not echo the
commands that you type. You can reset this with the command ATE1 or
reset the modem to its defaults with ATZ.

Table 9-2. Some of the AT commands recognized by cellular modems

Command


Syntax


Sample response from C201


Get battery charge information


AT+CBC?[4]


+CBC: 0,65 (First integer: 0=running on battery,
1=charging, 2=status no available, 3=power fault; second integer:
percentage charge remaining) Not applicable to the C201, because
it's powered by the PCMCIA bus


Get manufacturer information


AT+GMI


+GMI: Novatel Wireless Inc.


Get mobile model


AT+GMM


+GMM: CDMA Merlin 1900MHz


Get model revision


AT+GMR


+GMR: F/W VER: 1065 S/W VER: BM3.0.10 Jun
11 03 14:45:56 BOOT VER: 1-1


Get serial number


AT+GSN


+GSN: 00000000


Get service information (analog or digital)


AT+CAD?[5]


+CAD: 1 (0=no service, 1=CDMA digital, 2=TDMA
digital, 3=analog)


Get serving system information


AT+CSS?Footnote 5


+CSS: 1,1 4106 (First integer: 0=unknown band,
1=800MHz, 2=1900MHz; second integer: mobile station block; third
integer: system identifier)


Get signal quality


AT+CSQ?Footnote 4


+CSQ: 5, 00000291,00000241
(First integer: signal strength from 0-31; last integers:
frame error rate)

[4] Do not include the ? for
GSM phones or modems.

[5] Not supported by the GSM
phones or modems that we tested.


The Tao of Mac maintains a list of GSM AT commands at http://the.taoofmac.com/space/AT%20Commands.

Although the example PPP peers file and chat scripts show examples
for a particular provider, you should be able to adapt these to
providers and phones other than the ones covered in this chapter. If
you decide to change the name of the files, be sure that the connect
and disconnect entries in your peers file match the new filenames.
For CDMA providers, you shouldn't need to make any
change unless your cellular carrier requires a username and password.
For GSM providers other than the ones described in this chapter, you
need to change the APN (and perhaps set a username and password). If
you are using a different type of phone that uses a different file in
the /dev directory, you need to change the
device name.

When you make a connection as directed in the following sections
(running the command pppd
call

provider as root), you should see
something similar to the following:

Serial port initialized.
Starting CDMA connect script
Dialing...
Serial connection established.
Using interface ppp0
Connect: ppp0 <--> /dev/ttyS2
kernel does not support PPP filtering
Cannot determine ethernet address for proxy ARP
local IP address 68.29.37.40
remote IP address 68.28.97.6
primary DNS address 68.28.122.11
secondary DNS address 68.28.114.11

When you're done with your connection, press Ctrl-C
to disconnect.


9.3.1 PPP Troubleshooting


If you see a message that the pppd command is
"not replacing existing default
route," it means you have another network connection
active. You should temporarily bring this network connection down
before making the
PPP
connection or manually adjust the routing to your liking.

If your link is dropping due to LCP Echo errors, try setting the
interval to something really high in the
/etc/ppp/peers file:

lcp-echo-failure 4
lcp-echo-interval 65535

Also, some phones may have trouble with the default compression
scheme that PPP uses. If you are having problems negotiating a
connection, try adding novj and
novjccomp, as shown in Example 9-5 later in this chapter.

For more information on PPP configuration, see the
Linux PPP
HOWTO:

9.3.2 CDMA PC Card


The Novatel
Wireless Merlin C201 (Figure 9-2) is a CDMA 1xRTT PC Card offered by Sprint that
is automatically recognized by all the versions of Linux we tested
(Mandrake 9.2, Gentoo 1.4, and Debian 3.0). It appears as two serial
ports starting at the highest unused serial port. So, on a ThinkPad
A20m running Debian 3.0, there were already two serial ports
(ttyS0 and ttyS1). When we
plugged in the C201 card, two more were detected:
ttyS2, which is the CDMA modem, and
ttyS3, a status port for the modem (whose
purpose is unknown to us but is not necessary to connect to the
Internet).


Figure 9-2. The Novatel Wireless Merlin C201 card


As of this writing, there is no way to provision (perform the initial
activation with the Sprint network) this card without a PC running
Microsoft Windows. Novatel Wireless technical support confirmed this
but mentioned that upcoming firmware may come out that supports
provisioning on any operating system. Unless that happens, you must
get access to a Windows notebook long enough to install the software
that comes with the card, activate it, and verify that you can
connect to the network before trying it with Linux.

To get online with the Merlin C201, use a PPP connection and the
phone number #777. If you use a regular phone number,
you'll end up making a CSD call, which may incur
per-minute charges. When you dial #777, you'll incur
whatever charges are applicable under your data plan. To set up a
data connection with the C201, first create the
/etc/ppp/peers/sprint-pcs file shown in Example 9-2. You must change the first two lines to
specify your device (for example, /dev/ttyS2).

Example 9-2. PPP peer settings for Sprint PCS and the Merlin C201

# File: /etc/ppp/peers/sprint-pcs
#
/dev/YOUR_DEVICE # device
init "setserial /dev/YOUR_DEVICE baud_base 230400"
115200 # speed
defaultroute # use the cellular network for the default route
usepeerdns # use the DNS servers from the remote network
nodetach # keep pppd in the foreground
crtscts # hardware flow control
lock # lock the serial port
noauth # don't expect the modem to authenticate itself
# scripts for connection/disconnection
connect "/usr/sbin/chat -v -f /etc/chatscripts/sprint-connect"
disconnect "/usr/sbin/chat -v -f /etc/chatscripts/sprint-disconnect"


The Merlin C201 is a bit of an oddball. You must use
setserial to specify twice the actual speed you
want to use. (Thanks to the folks at tummy.com for this information,
found on http://www.tummy.com/articles/laptops/merlin-c201/)

Next, create the /etc/chatscripts/sprint-connect
and /etc/chatscripts/sprint-disconnect scripts,
shown in Example 9-3 and Example 9-4.

Example 9-3. PPP connect script for Sprint PCS and the Merlin C201

# File: /etc/chatscripts/sprint-connect
#
TIMEOUT 10
ABORT 'BUSY'
ABORT 'NO ANSWER'
ABORT 'NO CARRIER'
SAY 'Starting CDMA connect script\n'
# Get the modem's attention and reset it.
'' 'ATZ'
# E0=No echo, V1=English result codes
OK 'ATE0V1'
# Dial the number
SAY 'Dialing...\n'
OK 'ATD#777'
CONNECT ''

Example 9-4. PPP disconnect script for Sprint PCS and the Merlin C201

# File: /etc/chatscripts/sprint-disconnect
#
" "\K"
" "+++ATH0"
SAY "CDMA disconnected."

After you've set up these scripts, issue the command
pppd call sprint-pcs as root. Press Ctrl-C to
invoke the disconnect script and hang up the PPP connection.


If your carrier requires a username and password, set the
user and remote_name options as
shown in Example 9-5, and create a
chap_secrets file, as shown in Example 9-6.


9.3.3 CDMA Phone with Data Cable


The Motorola v120e (see Figure 9-3) is a CDMA 1xRTT phone offered by Verizon
Wireless. You must modprobe or
insmod the acm.o (the USB
Abstract Control Model drive) module for this phone to be recognized.
The v120e appears as a serial port named
/dev/ttyACM0
.


Figure 9-3. The Motorola v120e CDMA phone



The Motorola v120e does not require the provisioning step typically
required of PCMCIA cards (see Section 9.3.2 earlier in this chapter).
Simply using the data connection for the first time provisions the
phone.

To get online with this phone, create a PPP
connection using the phone number #777. You can also use this phone
to connect to dial-up service (see Section 9.1.1 earlier in this chapter),
but per-minute charges will apply, and you'll get a
maximum speed of 14.4 kbps. To set up a data connection for this
phone, first create the /etc/ppp/peers/verizon
file shown in Example 9-5. Be sure the device name
corresponds to that of your phone (use dmesg to see which device the
phone was associated with), although it will probably be
/dev/ttyACM0. You must supply your phone number
followed by @vzw3g.com as your username in the
verizon file, and specify vzw
as your password in the /etc/ppp/chap-secrets
file shown in Example 9-6 (the
verizon in the server column in
chap-secrets corresponds to the
remote_name specified in the
/etc/ppp/peers/verizon file).

Example 9-5. PPP peer settings for Verizon Wireless and the Motorola v120e

# File: /etc/ppp/peers/verizon
#
/dev/ttyACM0 # device
# The following two settings need a corresponding entry in
# /etc/ppp/chap-secrets.
user YOUR_CELLULAR_PHONE_NUMBER@vzw3g.com
remotename verizon
115200 # speed
defaultroute # use the cellular network for the default route
usepeerdns # use the DNS servers from the remote network
nodetach # keep pppd in the foreground
crtscts # hardware flow control
lock # lock the serial port
noauth # don't expect the modem to authenticate itself
novj
novjccomp
# scripts for connection/disconnection
connect "/usr/sbin/chat -v -f /etc/chatscripts/verizon-connect"
disconnect "/usr/sbin/chat -v -f /etc/chatscripts/verizon-disconnect"

Example 9-6. CHAP password for Verizon wireless connection

# File: /etc/ppp/chap-secrets
#
# Secrets for authentication using CHAP
# client server secret IP addresses
YOUR_CELLULAR_PHONE_NUMBER@vzw3g.com verizon vzw *

Next, create the
/etc/chatscripts/verizon-connect and
/etc/chatscripts/verizon-disconnect scripts,
shown in Example 9-7 and Example 9-8.

Example 9-7. PPP connect script for Verizon Wireless and Motorola v120e

# File: /etc/chatscripts/verizon-connect
#
TIMEOUT 10
ABORT 'BUSY'
ABORT 'NO ANSWER'
ABORT 'NO CARRIER'
SAY 'Starting CDMA connect script\n'
# Get the modem's attention and reset it.
'' 'ATZ'
# E0=No echo, V1=English result codes
OK 'ATE0V1'
# Dial the number
SAY 'Dialing...\n'
OK 'ATD#777'
CONNECT ''

Example 9-8. PPP disconnect script for Verizon Wireless and Motorola v120e

# File: /etc/chatscripts/verizon-disconnect
#
" "\K"
" "+++ATH0"
SAY "CDMA disconnected."

After you've set up these scripts, issue the command
pppd call verizon as root (if you
haven't configured Linux to automatically load the
acm.o module, you must issue the command
modprobe acm first). Usage charges will apply
according to your data plan. When you are done, press Ctrl-C to
invoke the disconnect script and hang up the PPP
connection.


9.3.4 GSM/GPRS Phone with Data Cable


The Nokia 6200 (Figure 9-4)
was the first phone on the market to support EDGE, an enhancement to
GSM that increases the data rate per timeslot up to 48 kbps (higher
in ideal network conditions). With two EDGE timeslots for uploads and
downloads, the Nokia 6200 can achieve data rates of 96 kbps or
higher. The Nokia 6200 is offered by AT&T Wireless.


Figure 9-4. The Nokia 6200 EDGE/GPRS phone


EDGE-capable phones are compatible with GSM/GPRS networks. If the
cellular base station you connect to does not support EDGE, the phone
will fall back to regular GSM data rates.

Unfortunately, the Nokia 6200 does not support Bluetooth, so you must
use either IrDA or a data cable. Linux does not recognize the Nokia
data cable (DKU-5), but it does recognize the cable that comes with
the SmithMicro QuickLink Mobile for Mac OS X kit
(available for $59.95 at http://www.smithmicro.com) as a Prolific
2303. However, we had trouble with some of the 2.4 kernels that we
had tested with 2.4.20 through 2.4.22: the driver
(pl2303.o) would trigger a kernel oops when
hanging up the connection. However, we tested a prerelease version of
2.4.23 (rc3), which solved this problem.

To connect to the Internet with this
phone, you must set up a PPP connection that sets the APN (see Section 9.2 earlier in this chapter) and
dials the number (*99***1#) for making a GPRS
connection. In theory, you can use this phone to connect to a dialup
service (see Section 9.1.1 earlier
in this chapter).

To set up your PPP connection, first create the
/etc/ppp/peers/attws file shown in Example 9-9. Be sure the device name corresponds to that
of your phone (use dmesg to look at the device that the phone was
assigned to), although it will probably be
/dev/ttyUSB0.

Example 9-9. PPP peer settings for AT&T Wireless and the Nokia 6200

/dev/ttyUSB0  # USB-serial port
230400 # speed
defaultroute # use the cellular network for the default route
usepeerdns # use the DNS servers from the remote network
nodetach # keep pppd in the foreground
crtscts # hardware flow control
lock # lock the serial port
noauth # don't expect the modem to authenticate itself
connect "/usr/sbin/chat -v -f /etc/chatscripts/attws-connect"
disconnect "/usr/sbin/chat -v -f /etc/chatscripts/attws-disconnect"

Next, create the /etc/chatscripts/attws-connect
and /etc/chatscripts/attws-disconnect
scripts, shown in Example 9-10 and Example 9-11. If you are using a GPRS cellular provider
other than AT&T Wireless, you will probably have to change the
APN (proxy in Example 9-10).

Example 9-10. PPP connect script for AT&T Wireless and the Nokia 6200

# File: /etc/chatscripts/attws-connect
#
TIMEOUT 10
ABORT 'BUSY'
ABORT 'NO ANSWER'
ABORT 'NO CARRIER'
SAY 'Starting GPRS connect script\n'
# Get the modem's attention and reset it.
'' 'ATZ'
# E0=No echo, V1=English result codes
OK 'ATE0V1'
# Set Access Point Name (APN)
SAY 'Setting APN\n'
OK 'AT+CGDCONT=1,"IP","proxy"'
# Dial the number
SAY 'Dialing...\n'
OK 'ATD*99***1#'
CONNECT ''

Example 9-11. PPP disconnect script for AT&T Wireless and the Nokia 6200

# File: /etc/chatscripts/attws-disconnect
#
" "\K"
" "+++ATH0"
SAY "GPRS disconnected."

After you've set up these scripts, issue the command
pppd call attws as root. Usage charges will apply
according to your data plan. Press Ctrl-C to invoke the disconnect
script and hang up the PPP connection.


If your carrier requires a username and password, set the
user and remote_name options,
as shown in Example 9-5 and create a
chap_secrets file, as shown in Example 9-6.


9.3.5 GPRS PC Card


T-Mobile once
operated in the United
States under the
VoiceStream
brand. In fact, you still see voicestream.com on
T-Mobile's APNs, and a USENET group that discusses
T-Mobile is alt.cellular.gsm.carriers.voicestream. Back when it
operated as VoiceStream, it offered a great cellular card that was
branded iStream (see Figure 9-5). Under the hood,
it's a Novatel Wireless Merlin
G100 GPRS PCMCIA modem. We like this card because
it's cheap (we picked ours up for $50 on eBay) and
we have received faster downloads with it than with other GPRS phones
that we've used.


Figure 9-5. The (VoiceStream branded) Novatel Wireless Merlin G100 GPRS card


Linux automatically detects this as a serial card; when you insert
the card, look for messages in the system log or the output of dmesg
to see the port it's assigned to. On our system, it
shows up as /dev/ttyS2 (dmesg reports
"ttyS02 at port 0x03e8," and ttyS02
corresponds to /dev/ttyS2).

To connect to the Internet with this phone, you must set
up a PPP connection that sets the APN (see Section 9.2 earlier in this chapter) and
dials the number (*99***1#) for making a GPRS
connection. In theory, you could dial the number of a dialup ISP (see
Section 9.1.1 earlier in this
chapter).

To set up your PPP connection, first create the
/etc/ppp/peers/tmobile file shown in Example 9-12 Be sure the device name corresponds to that of
the PCMCIA card.

Example 9-12. PPP peer settings for T-Mobileand the Merlin G100

/dev/ttyS2    # G100 modem
115200 # speed
defaultroute # use the cellular network for the default route
usepeerdns # use the DNS servers from the remote network
nodetach # keep pppd in the foreground
crtscts # hardware flow control
lock # lock the serial port
noauth # don't expect the modem to authenticate itself
local # don't use Carrier Detect or Data Terminal Ready
debug
# Use the next two lines if you receive the dreaded messages:
#
# No response to n echo-requests
# Serial link appears to be disconnected.
# Connection terminated.
#
lcp-echo-failure 4
lcp-echo-interval 65535
connect "/usr/sbin/chat -v -f /etc/chatscripts/tmobile-connect"
disconnect "/usr/sbin/chat -v -f /etc/chatscripts/tmobile-disconnect"

Next, create the
/etc/chatscripts/tmobile-connect and
/etc/chatscripts/tmobile-disconnect
scripts, shown in Example 9-13 and Example 9-14. If you are using a GPRS cellular provider
other than T-Mobile, you will probably have to change the APN
(internet3.voicestream.com). Also, T-Mobile offers
two options on its T-Mobile Internet plan. By default, you should use
the internet2.voicestream.com APN. However, if
you've opted for VPN support (you receive a public
IP address), use internet3.voicestream.com.

Example 9-13. PPP connect script for T-Mobile and the Merlin G100

# File: /etc/chatscripts/tmobile-connect
#
TIMEOUT 10
ABORT 'BUSY'
ABORT 'NO ANSWER'
ABORT 'ERROR'
SAY 'Starting GPRS connect script\n'
# Get the modem's attention and reset it.
" 'ATZ'
# E0=No echo, V1=English result codes
OK 'ATE0V1'
# Set Access Point Name (APN)
SAY 'Setting APN\n'
OK 'AT+CGDCONT=1,"IP","internet3.voicestream.com"'
# Dial the number
ABORT 'NO CARRIER'
SAY 'Dialing...\n'
OK 'ATD*99***1#'
CONNECT ''

Example 9-14. PPP disconnect script for T-Mobile and the Merlin G100

# File: /etc/chatscripts/tmobile-disconnect
#
" "\K"
" "+++ATH0"
SAY "GPRS disconnected."

After you've set up these scripts, issue the command
pppd call tmobile as root. Usage charges will
apply according to your data plan. Press Ctrl-C to invoke the
disconnect script and hang up the PPP connection.


If your carrier requires a username and password, set the
user and remote_name options,
as shown in Example 9-5 and create a
chap_secrets file, as shown in Example 9-6.


/ 100