Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3046759
  • 博文数量: 396
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 4209
  • 用 户 组: 普通用户
  • 注册时间: 2016-07-04 13:04
文章分类

全部博文(396)

文章存档

2022年(1)

2021年(2)

2020年(8)

2019年(24)

2018年(135)

2017年(158)

2016年(68)

我的朋友

分类: 嵌入式

2017-03-21 09:33:14

在下蓝牙进行rfcomm连接

折腾了半天终于搞定了,开心 用的是bluez3.36,大概说一下流程 :

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

rfcomm0 {

#       # Automatically bind the device at startup

        bind no;

#

#       # Bluetooth address of the device

        device XX:XX:XX:XX:XX:XX;

#

#       # RFCOMM channel for the connection

        channel 1;

#

#       # Description of the connection

        comment "Example Bluetooth device";


2. 关闭本地pin验证

hciconfig hci0 noauth ; # 关闭本地的pin验证

3. 设置连接pin码

编辑/var/lib/bluetooth/XX:XX:XX:XX:XX:XX/pincodes (XX:XX:XX:XX:XX:XX为本地设备地址) 文件格式为: XX:XX:XX:XX:XX:XX 1234 (XX:XX:XX:XX:XX:XX为目标设备地址)

4. 运行

mknod /dev/rfcomm0 c 216 0

chmod 666 /dev/rfcomm0

rfcomm connect 0;

5. 输出字符到蓝牙串口

echo y>/dev/rfcomm0

阅读(6428) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~