Sri*_*ari 4 bluetooth ubuntu-core bluez
当我安装 bluez snap 并使用 hcitool 时,我没有看到任何蓝牙设备,但没有任何结果:
$ sudo hcitool dev
Devices:
$
Run Code Online (Sandbox Code Playgroud)
或蓝牙控制:
$ sudo bluetoothctl
Agent registered
[bluetooth]# list
[bluetooth]# show
No default controller available
[bluetooth]#
Run Code Online (Sandbox Code Playgroud)
当我使用 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
Run Code Online (Sandbox Code Playgroud)
我需要做什么才能启用蓝牙设备、查找设备 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 -
$
Run Code Online (Sandbox Code Playgroud)
运行 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
Run Code Online (Sandbox Code Playgroud)
但是,这显示为已关闭,并且尝试将其启动或重置失败:
$ 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)
$
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?如前所述,这是在运行 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
Run Code Online (Sandbox Code Playgroud)
添加 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"
Run Code Online (Sandbox Code Playgroud)
小智 6
有一个错误,它使用了错误的固件目录。作为临时修复,您可以使用以下命令:
sudo ln -s /lib/firmware /etc/firmware
Run Code Online (Sandbox Code Playgroud)
要检查它,您可以使用
sudo hciattach /dev/ttyAMA0 bcm43xx 921600 -
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13364 次 |
| 最近记录: |