我想在不使用蓝牙 GUI 的情况下在终端中查看蓝牙适配器的详细信息。最初,蓝牙在终端和 GUI 中均处于关闭状态。
我在终端中针对不同功能的命令
查看蓝牙状态(有的会显示active/inactive和status,有的只显示active/inactive)
sudo /etc/init.d/bluetooth status
打开蓝牙
sudo /etc/init.d/bluetooth start
关闭蓝牙
sudo /etc/init.d/bluetooth stop
查看蓝牙适配器详情
hciconfig
我可以在设置 GUI 中借助蓝牙 GUI 查看适配器详细信息。
我通过按顺序执行以下步骤研究了不同情况下蓝牙的状态:
1。通过终端打开蓝牙
- 状态=“正在运行”
- Active = "事件(正在运行)"
- 蓝牙适配器详细信息:不显示任何内容
2。通过终端关闭蓝牙
- 状态 = 未显示
- Active = "inactive (dead)"
- 蓝牙适配器详细信息:不显示任何内容
3。通过 GUI 打开蓝牙
- 状态=“正在运行”
- Active = "事件(正在运行)"
- 蓝牙适配器详细信息:显示适配器详细信息
4。通过终端关闭蓝牙,但在 GUI 中没有改变
- Status = "正在退出"
- Active = "inactive (dead)"
- 蓝牙适配器详细信息:显示适配器详细信息
5。通过终端打开蓝牙
- 状态=“正在运行”
- Active = "事件(正在运行)"
- 蓝牙适配器详细信息:显示适配器详细信息
6.通过终端关闭蓝牙,但在 GUI 中没有改变
- Status = "正在退出"
- Active = "inactive (dead)"
- 蓝牙适配器详细信息:显示适配器详细信息
7.在 GUI 中关闭蓝牙
- 状态 = 未显示
- Active = "inactive (dead)"
- 蓝牙适配器详细信息:不显示任何内容
有人可以帮我看看我的命令有什么问题吗?另外,为什么它与 GUI 一起工作正常? GUI 的实际作用是什么?
最佳答案
试试这个工具:
bluetoothctl
安装指南如下: ( https://wiki.archlinux.org/index.php/bluetooth#Installation )
它给了你很多可能性:
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
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
您甚至可以深入了解广告政策等:
# menu advertise
Menu advertise:
Available commands:
-------------------
uuids [uuid1 uuid2 ...] Set/Get advertise uuids
service [uuid] [data=xx xx ...] Set/Get advertise service data
manufacturer [id] [data=xx xx ...] Set/Get advertise manufacturer data
tx-power [on/off] Show/Enable/Disable TX power to be advertised
name [on/off/name] Configure local name to be advertised
appearance [on/off/value] Configure custom appearance to be advertised
duration [seconds] Set/Get advertise duration
timeout [seconds] Set/Get advertise timeout
clear [uuids/service/manufacturer/config-name...] Clear advertise config
back Return to main menu
version Display version
quit Quit program
exit Quit program
help Display help about this program
您可以直接提取(和设置)大量信息。
关于linux - 终端中的蓝牙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39490971/