Sai*_*Sai 29 command-line bluetooth 12.04
我正在寻找一种方法来检查是否通过终端在我的笔记本电脑上启用或禁用了蓝牙。是否有我可以用来查找此信息的命令
use*_*465 29
除了检查服务,您还可以使用命令
hcitool dev
Run Code Online (Sandbox Code Playgroud)
这将返回打开的所有设备。
Mit*_*tch 11
只需按键盘上的Ctrl+ Alt+T即可打开终端。当它打开时,您可以运行此命令来查看蓝牙的状态
sudo service bluetooth status
Run Code Online (Sandbox Code Playgroud)
输入密码后,您应该会看到类似
蓝牙正在运行
Ser*_*ndt 10
hciconfig -ahciconfig -a 提供了更多信息,包括蓝牙版本。
$ hciconfig -a
hci0: Type: Primary Bus: USB
BD Address: 00:1A:7D:DC:70:13 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING PSCAN
RX bytes:1013 acl:0 sco:0 events:60 errors:0
TX bytes:4890 acl:0 sco:0 commands:60 errors:0
Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'hostname'
Class: 0x1c0104
Service Classes: Rendering, Capturing, Object Transfer
Device Class: Computer, Desktop workstation
HCI Version: 4.0 (0x6) Revision: 0x22bb
LMP Version: 4.0 (0x6) Subversion: 0x22bb
Manufacturer: Cambridge Silicon Radio (10)
Run Code Online (Sandbox Code Playgroud)
使用BlueZ:使用bluetoothctl(交互式蓝牙控制工具),它为您提供一个带有show以下命令的终端:
[bluetooth]# help
Menu main:
Available commands:
-------------------
advertise Advertise Options Submenu
scan Scan Options Submenu
gatt Generic Attribute Submenu
list List available controllers
show [ctrl] Controller information
select <ctrl> Select default controller
devices List available devices
paired-devices List paired devices
system-alias <name> Set controller alias
reset-alias Reset controller alias
power <on/off> Set controller power
pairable <on/off> Set controller pairable mode
discoverable <on/off> Set controller discoverable mode
discoverable-timeout [value] Set discoverable timeout
agent <on/off/capability> Enable/disable agent with given capability
default-agent Set agent as the default one
advertise <on/off/type> Enable/disable advertising with given type
set-alias <alias> Set device alias
scan <on/off> Scan for devices
info [dev] Device information
pair [dev] Pair with device
trust [dev] Trust device
untrust [dev] Untrust device
block [dev] Block device
unblock [dev] Unblock device
remove <dev> Remove device
connect <dev> Connect device
disconnect [dev] Disconnect device
menu <name> Select submenu
version Display version
quit Quit program
exit Quit program
help Display help about this program
export Print environment variables
Run Code Online (Sandbox Code Playgroud)
使用bluez-tools : bt-*( apropos bt-) 之类的bt-device蓝牙设备管理器。