【问题标题】:Bluetooth in Terminal终端中的蓝牙
【发布时间】:2016-09-14 12:53:46
【问题描述】:

我想在不使用蓝牙 GUI 的情况下在终端中查看蓝牙适配器的详细信息。最初蓝牙在终端和 GUI 中都被关闭。

我在终端中不同功能的命令

查看蓝牙状态(在某些情况下会显示活动/非活动状态,在某些情况下会显示活动/非活动状态)

sudo /etc/init.d/bluetooth status

开启蓝牙

sudo /etc/init.d/bluetooth start

关闭蓝牙

sudo /etc/init.d/bluetooth stop

查看蓝牙适配器详细信息

hciconfig

我可以在设置 GUI 中借助蓝牙 GUI 查看适配器详细信息。

我按顺序研究了不同情况下蓝牙的状态:

1.通过终端打开蓝牙

  • 状态 =“正在运行”
  • 活动 = “活动(运行)”
  • 蓝牙适配器详细信息:不显示任何内容

2.通过终端关闭蓝牙

  • 状态 = 未显示
  • 活动 =“不活动(死)”
  • 蓝牙适配器详细信息:不显示任何内容

3.通过 GUI 开启蓝牙

  • 状态 =“正在运行”
  • 活动 = “活动(运行)”
  • 蓝牙适配器详细信息:显示适配器详细信息

4.通过终端关闭蓝牙,但在 GUI 中没有改变

  • 状态 =“退出”
  • 活动 =“不活动(死)”
  • 蓝牙适配器详细信息:显示适配器详细信息

5.通过终端打开蓝牙

  • 状态 =“正在运行”
  • 活动 = “活动(运行)”
  • 蓝牙适配器详细信息:显示适配器详细信息

6.通过终端关闭蓝牙,但在 GUI 中没有改变

  • 状态 =“退出”
  • 活动 =“不活动(死)”
  • 蓝牙适配器详细信息:显示适配器详细信息

7.在 GUI 中关闭蓝牙

  • 状态 = 未显示
  • 活动 =“不活动(死)”
  • 蓝牙适配器详细信息:不显示任何内容

有人可以帮我看看我的命令有什么问题吗?另外,为什么它与 GUI 一起工作得很好? GUI 的实际作用是什么?

【问题讨论】:

  • 编写软件无关的问题应该在不同的 StackExchange 站点上。在这种情况下,考虑Unix & LinuxSuperUser
  • (另外,如果不知道它是哪一个,我们就不能对你的 GUI 说任何有用的东西——许多不同的 Linux 发行版都有自己的设置 GUI,这个问题中没有任何内容指定你的发行版,桌面环境等;类似地,/etc/init.d/bluetooth 本身是特定于发行版的)。

标签: linux shell terminal bluetooth


【解决方案1】:

试试这个工具:

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

您可以直接提取(和设置)大量信息。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2023-03-07
  • 2012-01-31
  • 2018-09-22
  • 1970-01-01
  • 1970-01-01
  • 2018-01-01
  • 2021-03-12
  • 2012-03-31
相关资源
最近更新 更多