slm*_*slm 24
下面列出了一些处理蓝牙的工具,您可以使用这些工具与设备进行交互。
hciconfig
hcitool dev
也应该提供一些这样的信息hcitool inq
和 hcitool scan
hcitool info <BTAddr>
l2ping <BTAddr>
sdptool browse <BTAddr> or sdptool records <BTAddr>
obexftp –nopath –noconn –uuid none –bluetooth <BTAddr> –channel <OPUSHChann
elNo> –put <FileToPut>
obexftp -b <BTAddr> -v -p <FileToPut>
passkey-agent –default <Pin>
obexpushd
您可以按照此站点的说明通过命令行将设备与您的 Linux 机器配对。这篇文章的标题是:如何在 Linux 上从命令行配对蓝牙设备。
找到您的蓝牙设备mac地址
$ hcitool scan
Scanning ...
11:22:33:44:55:66 device 1
12:34:56:78:90:12 device 2
Run Code Online (Sandbox Code Playgroud)设置蓝牙代理以传递预期的配对代码
$ bluetooth-agent 0000 &
Run Code Online (Sandbox Code Playgroud)编辑 rfcomm 配置文件/etc/bluetooth/rfcomm.conf
,并将上面的 MAC 地址放入其中。
rfcomm0 {
# Automatically bind the device at startup
bind no;
# Bluetooth address of the device
device 11:22:33:44:55:66;
# RFCOMM channel for the connection
channel 3;
# Description of the connection
comment "This is Device 1's serial port.";
}
Run Code Online (Sandbox Code Playgroud)
注意:一个重要的警告,如果您将设备配置为在启动时不绑定(绑定号;),您将必须在使用串行端口(这也需要 root 权限)之前使用此命令手动启动 rfcomm。
$ sudo rfcomm connect rfcomm0
Run Code Online (Sandbox Code Playgroud)