找回密码
 注册
快捷导航
查看: 1870|回复: 7

magic Linux2.0+蓝牙+Nokia+EDGE上网,整理的。

[复制链接] |自动提醒
阅读字号:

198

回帖

5

积分

385

资产值

高级会员 Rank: 2Rank: 2

注册时间
2005-10-11
发表于 2008-9-12 07:58:26| 字数 6,683| - 中国–浙江–杭州 移动 | 显示全部楼层 |阅读模式
magic 2.0下使用杂牌蓝牙适配器并通过手机gprs上网

小弟有一P3的本本,装了magice2.0,运行得很好。近日想通过手机上网,体验一下无线的乐趣。于是买了一个杂牌蓝牙适配器。就是电脑城几十块钱一个,没有印上牌子的那种。买的时候在winxp下试用,一切正常。。但回家后在magic2.0上无法使用。。。在论坛上也找不到解决方法。难道真的是便宜没好货。不死心的在网上搜索,经过一翻折腾。终于成功。不敢独享,贴上来请各位大大指点,看有什么可以改进的。

一、.安装
bluez-libs 2.24     http://download.chinaunix.net/download/0001000/990.shtml
bluez-utils 2.24   http://download.chinaunix.net/download/0001000/991.shtml
官方网站上有提供3.7版的下载。但经过小弟试验,好像因为3.x版的不支持kdebluetooth1.0-0.beta1版的kbluepin。导致无法与手机配对。我在ChinaUnix.net下载了这两个程序的源码包。(很奇怪,2.25版的在我的机器上无法编译.......)

二、.装完这两个程序后,插上蓝牙适配器。打开Konsole,su 取得root权限。

1. 运行命令 lsusb 应该可以看到: (如果没有请确认你的适配器有正确插入,usb插口跟适配器无损坏,还是没有的话,那以下就可以不用看了)

Bus 001 Device 002: ID 1131:1001 Integrated System Solution Corp. KY-BT100 Bluetooth Adapter                  <------不同型号显示有所不同,能认出就行

运行 hciconfig 可以看到:

hci0:   Type: USB
        BD Address: 00:00:00:00:00:00 ACL MTU: 0:0 SCO MTU: 0:0
        DOWN
        RX bytes:0 acl:0 sco:0 events:0 errors:0
        TX bytes:0 acl:0 sco:0 commands:0 errors:0

没有激活。激活它。运行:

hciconfig hci0 up

2. 配置 Bluez
修改  /etc/bluetooth/hcid.conf 文件

*********************************************************************
#
# HCI daemon configuration file.
#

# HCId options
options {
        # Automatically initialize new devices
        autoinit yes;

        # Security Manager mode
        #   none - Security manager disabled
        #   auto - Use local PIN for incoming connections
        #   user - Always ask user for a PIN
        #
        security user;                           <--------安全模式,需要手动输入密码

        # Pairing mode
        #   none  - Pairing disabled
        #   multi - Allow pairing with already paired devices
        #   once  - Pair once and deny successive attempts
        pairing multi;

        # PIN helper
        pin_helper /usr/lib/kdebluetooth/kbluepin;                      <--------pin_helper 的位置。

        # D-Bus PIN helper
        #dbus_pin_helper;
}

# Default settings for HCI devices
device {
        # Local device name
        #   %d - device id
        #   %h - host name
        name "BlueZ (%d)";                              <---------设备名称,可以自己修改双引号内的内容为自己想要的名称

        # Local device class
        class 0xff0100;

        # Default packet type
        #pkt_type DH1,DM1,HV1;

        # Inquiry and Page scan
        iscan enable; pscan enable;

        # Default link mode
        #   none   - no specific policy
        #   accept - always accept incoming connections
        #   master - become master on incoming connections,
        #            deny role switch on outgoing connections
        lm accept;

        # Default link policy
        #   none    - no specific policy
        #   rswitch - allow role switch
        #   hold    - allow hold mode
        #   sniff   - allow sniff mode
        #   park    - allow park mode
        lp rswitch,hold,sniff,park;

        # Authentication and Encryption (Security Mode 3)
        #auth enable;
        #encrypt enable;
}

********************************************************************************

3. 打开手机的蓝牙。运行 hcitool scan 可以得到:

Scanning ...
        00:13:70:2D:0E:08       Nokia 3230                   <---------你的手机。偶的是“挪积压 3230”。前面是手机的MAC地址。

运行命令
sdpd
hcid start
kbluetoothd    或者是K菜单--->互联网--->kbluetoothd (蓝牙服务器)
然后在手机上进行蓝牙配对。成功后,就可以试试在电脑上右键点任一文件,动作-->通过蓝牙发送,将文件发送给手机。手机也可以传送文件进电脑了。

三、现在,要设置蓝牙连接手机WAP代理上网了           (忘记在哪个网看到的了,原文是E文的。)
所用的工具:
pppd(用来拨号的)
rfcomm(用来连接手机拨号服务)

1. 需要建立编辑的文件有2个:
第一个:/etc/ppp/peers/gprs
内容如下:

/dev/rfcomm0
230400
defaultroute
usepeerdns
user ''
password bobo
nodetach
crtscts
lock
noauth
local
debug
connect "/usr/sbin/chat -v -f /etc/ppp/chat-gprs"

第二个:/etc/ppp/chat-gprs
内容如下:

TIMEOUT 10
ABORT 'BUSY'
ABORT 'NO ANSWER'
ABORT 'ERROR'
"" 'ATZ'
OK 'AT+CGDCONT=1,"IP","cmwap" '          <---------如果你是使用cmnet节点的,可以将cmwap改成cmnet,那不用代理就能上网,不过钱就..贵啊!
ABORT 'NO CARRIER'
SAY 'Dialing....\n'
OK 'ATD*99#'                              <---------"*99#"
CONNECT ''


2.运行 sdptool search DUN 搜索设备的DUN服务,即网络拨号服务。

Inquiring ...
Searching for DUN on 00:13:70:2D:0E:08 ...
Service Name: Dial-Up Networking
Service RecHandle: 0x10005
Service Class ID List:
  "Dialup Networking" (0x1103)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 2                                  <---------你手机RFCOMM的工作信道。记住了啊。不同机型是不同的
Language Base Attr List:
  code_ISO639: 0x454e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100

3. 修改/etc/bluetooth/rfcomm.conf

*******************************************************************************
#
# RFCOMM configuration file.
#

rfcomm0 {
        # Automatically bind the device at startup
        bind yes;                                <---------将 no 改为 yes

        # Bluetooth address of the device
        device 00:13:70:2D:0E:08;                                <---------改为你手机的MAC地址

        # RFCOMM channel for the connection
        channel        2;                        <---------改为你手机RFCOMM的工作信道。

        # Description of the connection
        comment "Example Bluetooth device";
}
**********************************************************************************

4. 绑定rfcomm0到手机上:

rfcomm bind /dev/rfcomm0 [MAC] [channel]

根据你手机的情况编写。这里的命令应该写成:

rfcomm bind /dev/rfcomm0  00:13:70:2D:0E:08 2

所谓绑定,类似于设定/dev/rfcomm0对应某个确定的蓝牙设备和它的某个channel。可以把它想像为将一条串口电缆连接到某台计算机上的某个串口上。

5. 运行命令进行拨号:

pppd call gprs

输出差不多如下的东东,那么恭喜你 ,成功了!!!
Dialing....
Serial connection established.
using channel 3
Using interface ppp0
Connect: ppp0 <--> /dev/rfcomm0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x6df58d43> <pcomp> <accomp>]
rcvd [LCP ConfRej id=0x1 <magic 0x6df58d43> <pcomp> <accomp>]
sent [LCP ConfReq id=0x2 <asyncmap 0x0>]
rcvd [LCP ConfAck id=0x2 <asyncmap 0x0>]
rcvd [LCP ConfReq id=0x0 <auth pap> <mru 1500> <asyncmap 0xa0000>]
sent [LCP ConfAck id=0x0 <auth pap> <mru 1500> <asyncmap 0xa0000>]
sent [PAP AuthReq id=0x1 user="MagicLinux" password=<hidden>]
sent [PAP AuthReq id=0x2 user="MagicLinux" password=<hidden>]
rcvd [PAP AuthAck id=0x2 ""]
PAP authentication succeeded
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>]
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [IPCP ConfReq id=0x0 <addr 10.6.6.6>]
sent [IPCP ConfAck id=0x0 <addr 10.6.6.6>]
rcvd [LCP ProtRej id=0x0 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [IPCP ConfNak id=0x2 <addr 10.213.77.9> <ms-dns1 0.0.0.19> <ms-dns3 0.71.35.128>]
sent [IPCP ConfReq id=0x3 <addr 10.213.77.9> <ms-dns1 0.0.0.19> <ms-dns3 0.71.35.128>]
rcvd [IPCP ConfAck id=0x3 <addr 10.213.77.9> <ms-dns1 0.0.0.19> <ms-dns3 0.71.35.128>]
local  IP address 10.213.77.9
remote IP address 10.6.6.6
primary   DNS address 0.0.0.19
secondary DNS address 0.71.35.128
Script /etc/ppp/ip-up started (pid 320
Script /etc/ppp/ip-up finished (pid 320, status = 0x0

6.打开firefox浏览器,(其它的浏览器请自己查找代理服器的设置)
编辑--->首选项--->高级--->网络--->连接--->设置--->手动配置代理
HTTP 代理  填上 10.0.0.172  端口为 80
OK!!现在可以上网了,速度跟用MODEM拨号差不多。。

PS:如果没有配对或是没有设置电脑为授权设备,会要求确认联接,另外,每次开机都要以root权限运行
hciconfig hci0 up
sdpd
hcid start
rfcomm bind /dev/rfcomm0  00:13:70:2D:0E:08 2
你可以将以上命令编成一个Shell脚本。嘿嘿。

最后修改/etc/resolv.conf

nameserver 221.130.33.52
search localhost
不然可以拔号但是打不开网页。

我写了一个shell。
hciconfig hci0 up
sdpd
hcid start
rfcomm bind /dev/rfcomm0  00:13:70:2D:0E:08
pppd call gprs
保存为/opt/gprs.sh

2018

回帖

46

积分

2165

资产值

钻石会员 Rank: 3Rank: 3Rank: 3

注册时间
2006-6-26
发表于 2008-9-12 08:06:33| 字数 21| - 中国–广东–广州 电信 | 显示全部楼层
正准备用LINUX,留个记号,下次试验一下
回复 支持 反对

使用道具 举报

1483

回帖

15

积分

3748

资产值

黄金会员 Rank: 3Rank: 3Rank: 3

注册时间
2007-6-30
发表于 2008-9-12 08:42:18| 字数 3| - 中国–北京–北京 鹏博士BGP | 显示全部楼层
苦劳
移动最先动作,和我猜的一样,移动的3g资费会最优惠。
回复 支持 反对

使用道具 举报

428

回帖

0

积分

433

资产值

禁止发言

注册时间
2008-8-16
发表于 2008-9-12 13:11:29| 字数 6| - 中国–江苏–镇江 电信/IDC机房 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

4万

回帖

283

积分

6175

资产值

至尊会员III Rank: 4Rank: 4Rank: 4Rank: 4

注册时间
2006-9-6
铜牌荣誉勋章(注册8年以上会员)银牌荣誉勋章(注册10年以上会员)
发表于 2008-9-12 13:16:23| 字数 11| - 中国–广东–阳江 电信 | 显示全部楼层
强帖留名,收藏了!!!
回复 支持 反对

使用道具 举报

2万

回帖

162

积分

2万

资产值

至尊会员II Rank: 4Rank: 4Rank: 4Rank: 4

注册时间
2007-2-14
发表于 2008-9-12 14:02:06| 字数 9| - 中国–山东–青岛 联通 | 显示全部楼层
你这个怎么这么复杂
实事求是 实话实说
回复 支持 反对

使用道具 举报

42

回帖

0

积分

62

资产值

入门会员 Rank: 1

注册时间
2007-11-18
发表于 2008-9-12 19:37:25| 字数 22| - 中国–广东–东莞 电信 | 显示全部楼层
这个是比较复杂哦,看的晕啊。可以在简单点不?
回复 支持 反对

使用道具 举报

198

回帖

5

积分

385

资产值

高级会员 Rank: 2Rank: 2

注册时间
2005-10-11
 楼主| 发表于 2008-9-13 12:21:41| 字数 34| - 中国–浙江–杭州 移动 | 显示全部楼层
简单点的不知道怎么弄,我不懂Linux,一般30分钟可以搞定,将就吧
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Powered by Discuz! X3.5 © 2001-2023 Comsenz Inc

GMT+8, 2025-2-13 15:40 , Processed in 0.135828 second(s), 39 queries , Gzip On, OPcache On.

手机版|小黑屋|安卓客户端|iOS客户端|Archiver|备用网址1|备用网址2|在线留言|专门网

返回顶部