歡迎您光臨本站 註冊首頁

Linux下手機與藍牙的連接配置

←手機掃碼閱讀     火星人 @ 2014-03-23 , reply:0

我的設備如下:
電腦:安裝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

[火星人 ] Linux下手機與藍牙的連接配置已經有865次圍觀

http://coctec.com/docs/linux/show-post-124892.html