分页: 1 / 1

[原创]linux下手机与蓝牙的连接配置

发表于 : 2007-03-08 20:50
baisnsf
http://www.cl2.cn/blog/?p=228

linux下手机与蓝牙的连接配置

*********************************
我的设备如下:
电脑:安装ubuntu 6.06 (6.06版本内核已自带蓝牙模块)
手机: Nokia 5500
电脑上装有USB蓝牙适配器
********************************

1.配置/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 
 # 
 #修改成auto模式 
 security auto; 
  
 # Pairing mode 
 #   none  - Pairing disabled 
 #   multi - Allow pairing with already paired devices 
 #   once  - Pair once and deny successive attempts 
 pairing multi; 
  
 # Default PIN code for incoming connections 
 # 默认PIN码,与手机匹配时使用 
 passkey "1234"; 
} 
  
# Default settings for HCI devices 
device { 
 # Local device name 
 #   %d - device id 
 #   %h - host name 
 # 设置PC端的蓝牙名称,可随意设置 
 name "%h-%d"; 
  
 # Local device class 
 class 0x3e0100; 
  
 # Default packet type 
 #pkt_type DH1,DM1,HV1; 
  
 # Inquiry and Page scan 
 iscan enable; pscan enable; 
 discovto 0; 
  
 # 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; 
}
2.配置完成后,重启蓝牙服务
sudo /etc/init.d/bluetooth restart

3.手机连接PC端蓝牙设备,完成匹配,匹配时需要输入hcid.conf中的匹配码

4.配置/etc/bluetooth/rfcomm.conf

代码: 全选

# 
# RFCOMM configuration file. 
# 
  
rfcomm0 { 
 # Automatically bind the device at startup 
 bind yes; 
  
 # Bluetooth address of the device 
 #  手机端的蓝牙地址可以通过hcitool scan获得 
 device 00:18:0F:8B:B0:63; 
  
 # RFCOMM channel for the connection 
 channel 1; 
  
 # Description of the connection 
 comment "NOKIA 5500 Bluetooth device"; 
}
配置完成后,可以用rfcomm connect 0连接手机
4.下载安装GNOME下的GUI蓝牙工具
sudo apt-get install gnome-bluetooth gnome-phone-manager

5.开启蓝牙文件共享服务
gnome-obex-server 用来接收手机端发送过来的文件
gnome-obex-send 发送文件到手机端,在gnome里也可以选择文件点右键发送到手机(发送为选择Bluetooth)
gnome-phone-manmager 启用后选择手机设置,可以通过PC端给朋友发短信

***************************************
备注:gnome-obex-send找不到手机的解决办法
sudo hciconfig hci0 inqmode 0

发表于 : 2007-05-21 1:54
hujj1
按楼主的话,试了,可以用,谢谢!!!

希望能出一个电脑通过蓝牙用手机的GPRS功能上网。

发表于 : 2007-07-18 2:35
kidee
hujj1 写了:按楼主的话,试了,可以用,谢谢!!!

希望能出一个电脑通过蓝牙用手机的GPRS功能上网。
是呀,能完成这个功能就是强人一个,我认为。

发表于 : 2007-09-09 21:18
d5ghost
搞定!
杂牌usb蓝牙一个:Bus 001 Device 003: ID 0a5c:2035 Broadcom Corp. BCM2035 Bluetooth
插上以后系统自动识别,按lz的方法设置了,我试了两个手机:nokia6300和索爱t618。
从电脑能够搜索到手机,但是配对失败,我确信密码都是对的:1234

从nokia6300搜索可以到电脑,而且配对成功;但是t618就搜索不到电脑。很奇怪不知道为什么?

在gnome里面,右击文件打开菜单选择"发送到...", 都可以成功发送到两部手机上面。

Re: [原创]linux下手机与蓝牙的连接配置

发表于 : 2010-10-01 13:48
taobupt
也遇到这个问题了……