magic 2.0下使用杂牌蓝牙适配器并通过手机gprs上网
来源:互联网 发布:淘宝怎么设置返现 编辑:程序博客网 时间:2024/05/01 06:08
导读:
一、.安装
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 ]
rcvd [LCP ConfRej id=0x1 ]
sent [LCP ConfReq id=0x2 ]
rcvd [LCP ConfAck id=0x2 ]
rcvd [LCP ConfReq id=0x0 ]
sent [LCP ConfAck id=0x0 ]
sent [PAP AuthReq id=0x1 user="MagicLinux" password=]
sent [PAP AuthReq id=0x2 user="MagicLinux" password=]
rcvd [PAP AuthAck id=0x2 ""]
PAP authentication succeeded
sent [CCP ConfReq id=0x1 ]
sent [IPCP ConfReq id=0x1 ]
rcvd [IPCP ConfReq id=0x0 ]
sent [IPCP ConfAck id=0x0 ]
rcvd [LCP ProtRej id=0x0 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
rcvd [IPCP ConfRej id=0x1]
sent [IPCP ConfReq id=0x2 ]
rcvd [IPCP ConfNak id=0x2 ]
sent [IPCP ConfReq id=0x3 ]
rcvd [IPCP ConfAck id=0x3 ]
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 3208)
Script /etc/ppp/ip-up finished (pid 3208), 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脚本。嘿嘿。
注意:要退出系统时最好把kbluetoothd退出,并选择不要在系统启动时运行,不然下次启动系统会导致kbluetoothd出错并失去响应。
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1427270
[收藏到我的网摘] [发送Trackback] Xaero发表于 2006年12月02日 21:59:00
本文转自
http://blog.csdn.net/leimz/archive/2006/12/02/1427270.aspx
一、.安装
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
rcvd [LCP ConfRej id=0x1
sent [LCP ConfReq id=0x2 ]
rcvd [LCP ConfAck id=0x2 ]
rcvd [LCP ConfReq id=0x0
sent [LCP ConfAck id=0x0
sent [PAP AuthReq id=0x1 user="MagicLinux" password=
sent [PAP AuthReq id=0x2 user="MagicLinux" password=
rcvd [PAP AuthAck id=0x2 ""]
PAP authentication succeeded
sent [CCP ConfReq id=0x1
sent [IPCP ConfReq id=0x1
rcvd [IPCP ConfReq id=0x0 ]
sent [IPCP ConfAck id=0x0 ]
rcvd [LCP ProtRej id=0x0 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
rcvd [IPCP ConfRej id=0x1
sent [IPCP ConfReq id=0x2
rcvd [IPCP ConfNak id=0x2
sent [IPCP ConfReq id=0x3
rcvd [IPCP ConfAck id=0x3
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 3208)
Script /etc/ppp/ip-up finished (pid 3208), 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脚本。嘿嘿。
注意:要退出系统时最好把kbluetoothd退出,并选择不要在系统启动时运行,不然下次启动系统会导致kbluetoothd出错并失去响应。
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1427270
[收藏到我的网摘] [发送Trackback] Xaero发表于 2006年12月02日 21:59:00
本文转自
http://blog.csdn.net/leimz/archive/2006/12/02/1427270.aspx
- magic 2.0下使用杂牌蓝牙适配器并通过手机gprs上网
- magic 2.0下使用杂牌蓝牙适配器并通过手机gprs上网
- PC通过蓝牙连接手机GPRS上网
- 笔记本电脑通过手机蓝牙上网
- 通过手机GPRS实现移动上网
- 电脑如何通过GPRS手机上网
- 笔记本电脑+蓝牙手机+GPRS+联通GSM卡无线上网
- 电脑通过手机蓝牙无线上网
- ubuntu 16.04 通过手机蓝牙上网
- 电脑通过NOKIA手机(猫)利用GPRS无线上网
- 让杂牌 USB 蓝牙适配器自动安装驱动的办法
- 让杂牌 USB 蓝牙适配器自动安装驱动的办法
- GPRS手机加笔记本电脑上网
- ANDROID 手机设置GPRS上网
- vista xp系统的笔记本通过蓝牙连接手机上网
- 教你如何用电脑通过蓝牙连接手机上网
- 教你如何用电脑通过蓝牙连接手机上网
- 如何用电脑通过蓝牙连接手机上网
- 百度悄悄地招兵买马 布局新闻门户战略(来自chianunix)
- 数据库
- DEV-C++ 和 QT4 合拍
- 王江民受聘为2008奥运会信息安全专家(来自chinaunix)
- DEV-C++ 和 QT4 合拍 - 小橙子的第一播 - CSDNBlog
- magic 2.0下使用杂牌蓝牙适配器并通过手机gprs上网
- 先开
- ATL/COM备忘
- 基于Video4Linux 的USB 摄像头图像采集实现
- 蓝牙模块在HHARM2410上的移植
- RTF(rich textformat)富文本格式
- Get-Variable 帮助信息
- A better bitmap design for mark-sweep GC
- GCC使用手册