找不到蓝牙设备 - Raspberry PI 3 B+ 上的 Ubuntu Core

找不到蓝牙设备 - Raspberry PI 3 B+ 上的 Ubuntu Core

当我安装 bluez snap 并使用 hcitool 时,我没有看到任何蓝牙设备,结果没有任何结果:

$ sudo hcitool dev
Devices:
$

或 bluetoothctl:

$ sudo bluetoothctl
Agent registered
[bluetooth]# list
[bluetooth]# show
No default controller available
[bluetooth]#

当我使用 hciconfig 时,出现权限被拒绝错误:

$ sudo hciconfig 无法打开 HCI 套接字。:权限被拒绝 $

我在 dmesg 中看到以下消息,表明 AppArmor 正在拒绝尝试:

21346.997174] audit: type=1400 audit(1562448858.001:1396): apparmor="DENIED" operation="create" profile="snap.bluez.hcitool" pid=6030 comm="hcitool" family="bluetooth" sock_type="raw" protocol=1 requested_mask="create" denied_mask="create

我要怎么做才能启用蓝牙设备、找到设备 ID 并扫描新设备?

我手动连接了 bluez 和蓝牙控制的 snap:plug,现在有以下连接:

$ snap connections
Interface          Plug                                 Slot                Notes
bluetooth-control  bledetect101:bluetooth-control       :bluetooth-control  manual
bluetooth-control  bluez:bluetooth-control              :bluetooth-control  manual
bluetooth-control  hidra-ble-gateway:bluetooth-control  :bluetooth-control  manual
bluez              bluez:client                         bluez:service       -
network            bledetect101:network                 :network            -
network            hidra-ble-gateway:network            :network            -
uhid               bluez:uhid                           :uhid               -
$

运行 bluez.hciconfig 后会显示蓝牙设备:

$ sudo hciconfig dev
hci0:   Type: Primary  Bus: SDIO
    BD Address: 00:00:00:00:00:00  ACL MTU: 0:0  SCO MTU: 0:0
    DOWN
    RX bytes:0 acl:0 sco:0 events:0 errors:0
    TX bytes:0 acl:0 sco:0 commands:0 errors:0  

但是,它显示为关闭,并且尝试启动或重置它都会失败:

$ sudo hciconfig hci0 up
Can't init device hci0: Input/output error (5)
$ sudo hciconfig hci0 reset
Can't init device hci0: Input/output error (5)
$

有什么想法吗?如上所述,这是在运行 Ubuntu Core 18.04 的 RPI3 B+ 上。uname -a 的输出:

Linux localhost 4.15.0-1040-raspi2 #43-Ubuntu SMP PREEMPT Tue Jun 25 10:45:04 UTC 2019 armv7l armv7l armv7l GNU/Linux

添加 dmesg 输出:

$ dmesg | grep -i 'bluetooth'
[   10.291904] Bluetooth: Core ver 2.21
[   10.291982] Bluetooth: HCI device and connection manager initialized
[   10.292000] Bluetooth: HCI socket layer initialized
[   10.292013] Bluetooth: L2CAP socket layer initialized
[   10.292036] Bluetooth: SCO socket layer initialized
[   10.305326] Bluetooth: Generic Bluetooth SDIO driver ver 0.1
[   14.254238] audit: type=1400 audit(1562690889.887:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="snap.bluez.bluetoothctl" pid=949 comm="apparmor_parser"
[   17.377691] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   17.377713] Bluetooth: BNEP filters: protocol multicast
[   17.377736] Bluetooth: BNEP socket layer initialized
[  834.534698] audit: type=1400 audit(1562691819.528:25): apparmor="DENIED" operation="create" profile="snap.bluez.hciconfig" pid=1639 comm="hciconfig" family="bluetooth" sock_type="raw" protocol=1 requested_mask="create" denied_mask="create"
[  839.183488] audit: type=1400 audit(1562691824.176:26): apparmor="DENIED" operation="create" profile="snap.bluez.hciconfig" pid=1660 comm="hciconfig" family="bluetooth" sock_type="raw" protocol=1 requested_mask="create" denied_mask="create"
[  845.163961] audit: type=1400 audit(1562691830.156:27): apparmor="DENIED" operation="create" profile="snap.bluez.hciconfig" pid=1681 comm="hciconfig" family="bluetooth" sock_type="raw" protocol=1 requested_mask="create" denied_mask="create"
[  852.587936] audit: type=1400 audit(1562691837.580:28): apparmor="DENIED" operation="create" profile="snap.bluez.hciconfig" pid=1702 comm="hciconfig" family="bluetooth" sock_type="raw" protocol=1 requested_mask="create" denied_mask="create"
[ 1115.767865] audit: type=1400 audit(1562692100.757:48): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.bluez.bluetoothctl" pid=2506 comm="apparmor_parser"
[ 1219.232771] audit: type=1400 audit(1562692204.225:67): apparmor="DENIED" operation="create" profile="snap.bledetect101.bledetect-cli" pid=2867 comm="bledetect" family="bluetooth" sock_type="raw" protocol=1 requested_mask="create" denied_mask="create"
[ 1219.232819] audit: type=1400 audit(1562692204.225:68): apparmor="DENIED" operation="create" profile="snap.bledetect101.bledetect-cli" pid=2867 comm="bledetect" family="bluetooth" sock_type="raw" protocol=1 requested_mask="create" denied_mask="create"

答案1

存在错误,并且使用了错误的固件目录。作为临时修复,您可以使用以下命令:

sudo ln -s /lib/firmware /etc/firmware

要检查它,你可以使用

sudo hciattach /dev/ttyAMA0 bcm43xx 921600 -

相关内容