Chinaunix首页 | 论坛 | 博客
  • 博客访问: 544472
  • 博文数量: 84
  • 博客积分: 6010
  • 博客等级: 准将
  • 技术积分: 2109
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-25 14:02
文章分类

全部博文(84)

文章存档

2011年(10)

2010年(22)

2009年(16)

2008年(36)

我的朋友

分类:

2008-03-01 16:57:30

We will try to get a GPRS internet connection using Linux-based phones as modems and route the connection to Mac OS X via Bluetooth. This guide is for Mac OS X, the US Cingular GPRS service only (other providers might work out of the box with the phone, others might not at all -- you never know with GPRS) and any of the Linux-based Motorola smartphones like the A760, A780, etc (they are all identical regarding their 'modem' functionality).

Setup

1. Download and place it on your /Library/Modem Scripts/ folder on your OSX. This script is ready to be used as a 57600 kbps modem but you can edit it and make it faster if you think your phone's modem-like functionality is fast enough (e.g. 115200). The script is also ready to be used on the Cingular GPRS network, so if you want to use another GPRS provider, you must change the "wap.cingular" words (that's the APN) in the modem script you just downloaded to the one that's appropriate for your service:
write "AT+CGDCONT=1,\34IP\34,\34wap.cingular\34,,0,0\13"
and you might also have to change this text too:
write "ATD*99***1#\13"
Cingular's non-subscription GPRS dialing number is *99***1#, but some others use *99#, so you will have to google it to find the correct one for your provider. Usually though, it is *99***1# for most.

The above generic script also worked for my husband's , however, if it doesn't work for you, please try . Some people have had success with this script, even if they are not using SprintPCS (that was originally written for).

2. Turn on Bluetooth on your Mac. Turn on both GPRS and Bluetooth on your phone (from the "Device Status" window that comes up when you click on the battery indicator). Then, go to the Apps/Tools/Modem application on your phone and change the modem option from "USB Cable" to "Bluetooth". Stay on that screen (don't navigate elsewhere on your phone from now on).

3. On your Mac, open the "Bluetooth Setup Assistant". Just 1 second before you press "Continue" on that screen, click on the "Find Me" button on your phone. Then, press "Continue" and then "Mobile Phone" on your Mac and follow up the wizard to setup the Address Book and "phone support" and pair the two devices. iSync is not supported by these Linux phones. When the Mac will ask you about the GPRS/phone-support fields, enter phone number *99***1#, user name WAP@CINGULARGPRS.COM and password CINGULAR1 (yes, they are case sensitive). Change accordingly if your GPRS provider is not Cingular.

4. Open your Mac's Preferences/Network and voila, the settings you entered earlier are now under the "Bluetooth" option from the drop-down menu. Under the PPP tab, enter a name for the connection (e.g. Cingular, or T-Mobile or whatever else you like). Click on "PPP options" and uncheck "Send PPP echo Packets". If later you find that you can connect but no data is flowing through, also uncheck the "Use TCP header compression" option. Leave the TPC/IP and Proxies tabs unaltered. On the "Bluetooth Modem" tab uncheck both "Enable error correction and compression in modem" and "Wait for dial tone before dialing". From the "Modem" drop down menu navigate in it and find the "linux-smartphone" option and select it. When done with all this, click "Apply Now".

5. Now, this is the part that didn't work and drove me crazy (direct GPRS was working, but via the Mac and Bluetooth didn't). Many thanks to Clifford Kite for finding this out through some trial and error. For these specific Linux smartphones (other phones work automatically) and when used via the Mac for Cingular *in particular*, you must create a ppp 'options' file using the TextEditor. In it type exactly this dummy remote IP address:
:192.168.0.254
and then save the file on your ~ home folder (*make absolutely sure* that your file is not renamed from TextEditor to 'options.txt', but plain 'options' -- TextEditor is known to do that, you must do a 'Get Info' on the file to be sure). Then, open a terminal and move the file to its correct location:
sudo mv options /etc/ppp/options
(from now on you can use the 'nano' terminal-based text editor if you need to edit it again by invoking this: sudo nano /etc/ppp/options). If you are not using Cingular with a Linux phone via the Mac, you might never need to create this 'options' file. Also, if later you find some LCP/IPCP errors on your logs and they are failing your connection, try adding this line above the dummy remote IP address on your 'options' file: novj

6. Open the 'Internet Connect' application on your Mac, and click the plain Bluetooth connection icon. Go to your phone, and click again "Find Me". Immediately after that, click "Connect" on your Mac and "ok" on your phone's popup window. A few seconds later you should be connected on Cingular's GPRS and start paying $1 per 100 KBs! >;)

Troubleshooting

Logs are your friends. If you can't connect, go to the Mac's 'Bluetooth Network Preferences', click on the "PPP options" and then click on the "Verbose logging". Then open the "Console" application from /Applications/Utilities/ and find the main ppp log. Assuming you have done the pairing and filled the login/passwords correctly for your provider, leave a comment below with the relevant verbose ppp log and we will have a look at it.

Another interesting application is the "" that Apple removed from OSX Tiger (bad decision). Through it you can create new GPRS connections if you have more than one phones or providers (select the options: DUN/Dial-Up service from your second phone, Outgoing, Modem and 'show on network preferences' on the "create new" dialog and give that connection a name). You might also have to check or uncheck (depending on your provider, I had to uncheck it for Cingular) both the encryption and the authentication bits. Then, you open back the Network preferences in the system preferences of the mac, under "show network status" select "network port configurations" and then check the checkbox of the newly created port. Click Apply, click its name to go to its network preferences and then follow the steps from No4 above, onwards (you will have to enter manually the number, login and password).

Links

If your Mac doesn't have Bluetooth, you might need to use the USB cable instead. Instructions (free reg. req.).

Good luck!

Update: Reader has sent us information how to connect the Motorola EZX phones with Vodafone UK. Email him for more details.

The connect scripts need to have the following lines edited:

for phones on a contract
write "AT+CGDCONT=1,\34IP\34,\34internet\34,,0,0\13"

for phones on pay as you go
write "AT+CGDCONT=1,\34IP\34,\34pp.vodafone.co.uk\34,,0,0\13"

The number to dial is *99#

Username: web
Password: web


首先,要有一台具备GPRS且带有modem功能的手机,以下以palm treo 650为例。

650是不带modem功能,要通过软件实现,下载 USB modem软件并安装在650上。该软件支持蓝牙和usb数据线两种模式!

下面首先看系统是否能检测到modem

sudo wvdialconf
Editing `/etc/wvdial.conf'.

Scanning your serial ports for a modem.

Modem Port Scan<*1>: S0 S1 S2 S3
WvModem<*1>: Cannot get information for serial port.
ttyACM0<*1>: ATQ0 V1 E1 -- OK
ttyACM0<*1>: ATQ0 V1 E1 Z -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyACM0<*1>: Modem Identifier: ATI -- ENZO
ttyACM0<*1>: Speed 4800: AT -- OK
ttyACM0<*1>: Speed 9600: AT -- OK
ttyACM0<*1>: Speed 19200: AT -- OK
ttyACM0<*1>: Speed 38400: AT -- OK
ttyACM0<*1>: Speed 57600: AT -- OK
ttyACM0<*1>: Speed 115200: AT -- OK
ttyACM0<*1>: Speed 230400: AT -- OK
ttyACM0<*1>: Speed 460800: AT -- OK
ttyACM0<*1>: Max speed is 460800; that should be safe.
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

Found an USB modem on /dev/ttyACM0.
Modem configuration written to /etc/wvdial.conf.
ttyACM0: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

如果出现以下信息则能检测modem且将配置自动写入 /etc/wvdial.conf文件。你modem的设备文件为/dev/ttyACM0

由于配置文件为普通拨号而建立,所以不适合grps拨号,要作以下修改

[Dialer defaults]
Init1 = at+cgdcont=1,"ip","cmwap"
Modem Type = USB Modem
ISDN = 0
Phone = *99***1#
Modem = /dev/ttyACM0
Username = any
Carrier Check = no
Password = any
Baud = 460800

保存后,使用wvdial拨号

sudo wvdial

使用超级用户操作,不然无法会提示设备忙,或更改用户权限。

--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: at+cgdcont=1,"ip","cmwap"
at+cgdcont=1,"ip","cmwap"
OK
--> Modem initialized.
--> Sending: ATDT*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT
~[7f]}#@!}![06]} }<}!}$}%\}"}&} } } } }#}$@#}%}&}$^[7f]o}'}"}(}"Q}+~
--> Carrier detected. Waiting for prompt.
~[7f]}#@!}![06]} }<}!}$}%\}"}&} } } } }#}$@#}%}&}$^[7f]o}'}"}(}"Q}+~
--> PPP negotiation detected.
--> Starting pppd at Sat Jan 19 10:56:20 2008
--> Pid of pppd: 6967
--> Using interface ppp0
--> pppd: (m[07][08]hr[07][08]
--> pppd: (m[07][08]hr[07][08]
--> pppd: (m[07][08]hr[07][08]
--> pppd: (m[07][08]hr[07][08]
--> pppd: (m[07][08]hr[07][08]
--> local IP address 10.216.91.90
--> pppd: (m[07][08]hr[07][08]
--> remote IP address 10.216.91.0
--> pppd: (m[07][08]hr[07][08]

到如已经成功啦!我们再来看看路由表

$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.216.91.0 * 255.255.255.255 UH 0 0 0 ppp0
192.168.0.0 * 255.255.255.0 U 0 0 0 wlan0
default 192.168.0.1 0.0.0.0 UG 0 0 0 wlan0

因为我这里还连接到无线网络,所以默认网关是 192.168.0.1,如果只有GPRS拨号连接,则信息会是:

$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.216.91.0 * 255.255.255.255 UH 0 0 0 ppp0
default 10.216.91.90 0.0.0.0 UG 0 0 0 ppp0

此时,只需设置代理即可以上网了 代理为 10.0.0.172:80

由于移动限制了浏览器,必须要将浏览器头信息更改才能正常上网。不过已经可以上Q。MSN等聊天工具啦!!






阅读(1087) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:转载: 2007年最佳Linux及开源社区软件公布

给主人留下些什么吧!~~