centos7使用蓝牙_centos7 下 通过终端 连接 蓝牙设备

#首先确定硬件上有支持蓝牙的设备,插入蓝牙发射器。然后运行如下命令,就可以开到我们的蓝牙设备了:

lsusb

[root@localhost ~]# lsusb

Bus 002 Device 003: ID 8087:07da Intel Corp.

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 004: ID 064e:8125 Suyin Corp.

Bus 001 Device 003: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller

Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Bus 003 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) #蓝牙设备

Bus 003 Device 002: ID 046d:c534 Logitech, Inc. Unifying Receiver

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

#列出笔记本已有的蓝牙设备 本例 为hci1

[root@localhost ~]# hciconfig

hci1:    Type: Primary  Bus: USB

BD Address: xx:xx:xx:xx:xx:xx  ACL MTU: 310:10  SCO MTU: 64:8

UP RUNNING PSCAN ISCAN

RX bytes:471023 acl:10676 sco:0 events:18199 errors:0

TX bytes:3242200 acl:22027 sco:0 commands:274 errors:0

#激活该设备

[root@localhost ~]# hciconfig hci1 up

#扫描硬件信息

[root@localhost ~]# hcitool scan

Scanning ...

A4:50:46:8A:7C:79    小米手机

94:87:E0:E5:22:D9    红米手机

xx:xx:xx:xx:xx    魅蓝 6T#要连接的设备

#绑定

sudo rfcomm bind /dev/rfcomm0 xx:xx:xx:xx:xx

#连接

sudo cat >/dev/rfcomm0

#删除

sudo rfcomm release /dev/rfcomm0

你可能感兴趣的:(centos7使用蓝牙)