感谢支持
我们一直在努力

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

赞(0) 打赏
转载请注明出处:服务器评测 » Linux下手机与蓝牙连接配置方案
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏