1 如果是自己手动调式蓝牙,首先将init.rc里面的dbus-daemon跟bluetoothd两个服务都自启动。
也就是说将两个服务中有
disabled 的部分注释掉。因为disabled的话,它不会启动,而是会在
设置里面点击启动时,才会触发服务启动。
2 确保这两个服务已经启动
bluetooth 1670 1 1984 932
800d0014 7ee111c4 S /system/bin/dbus-daemon
bluetooth 1749 1
3100 1628 800d0014 7ee111c4 S /system/bin/bluetoothd
3 hciconfig -a
hci0: Type: BR/EDR Bus: USB
BD Address:
00:09:DD:50:78:3C ACL MTU: 310:10 SCO MTU: 64:8
DOWN
RX
bytes:2630 acl:4 sco:0 events:79 errors:0
TX bytes:560 acl:4 sco:0
commands:45 errors:0
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00
0x80
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH
HOLD SNIFF
Link mode: SLAVE ACCEPT
说明hci0还未打开蓝牙适配器
4 hciconfig hci0 up //打开蓝牙适配器
5 hciconfig -a
//再次查询,确认已打开蓝牙适配器
hci0: Type: BR/EDR Bus: USB
BD Address:
00:09:DD:50:78:3C ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING
PSCAN
RX bytes:1278 acl:0 sco:0 events:32 errors:0
TX bytes:370 acl:0
sco:0 commands:30 errors:0
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00
0x80
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH
HOLD SNIFF
Link mode: SLAVE ACCEPT
Name: ‘bcm7125‘
Class:
0x08020c
Service Classes: Capturing
Device Class: Phone, Smart
phone
HCI Version: 2.0 (0x3) Revision: 0xc5c
LMP Version: 2.0 (0x3)
Subversion: 0xc5c
Manufacturer: Cambridge Silicon Radio (10)
6 hcitool scan //扫描结果如下
Scanning ...
9C:4A:7B:C2:EA:81
Angel
//进行配对,说明hci0是设备id,0000是设置的密码,9C:4A:7B:C2:EA:81为"hcitool scan"扫描到的蓝牙设备地址
7
agent -a hci0 0000 9C:4A:7B:C2:EA:81
运行如下。
Pincode request for device
/org/bluez/1749/hci0/dev_9C_4A_7B_C2_EA_81
ok 至此配对完成。
android-hci相关操作,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/webapplee/p/3774040.html