我刚刚降级到 bluez 5.50。启动服务时出现此错误:
bluetoothd -d -n
bluetoothd[2179]: Bluetooth daemon 5.50
bluetoothd[2179]: src/main.c:parse_config() parsing /etc/bluetooth/main.conf
bluetoothd[2179]: src/main.c:parse_config() discovto=0
bluetoothd[2179]: src/main.c:parse_config() pairto=0
bluetoothd[2179]: src/main.c:parse_config() privacy=off
bluetoothd[2179]: src/main.c:parse_config() Key file does not have key “Name” in group “General”
bluetoothd[2179]: src/main.c:parse_config() Key file does not have key “Class” in group “General”
bluetoothd[2179]: src/main.c:parse_config() Key file does not have key “DeviceID” in group “General”
bluetoothd[2179]: src/main.c:parse_config() Key file does not have key “ReverseServiceDiscovery” in group “General”
bluetoothd[2179]: src/main.c:parse_config() Key file does not have key “MinEncKeySize” in group “GATT”
D-Bus setup failed: Connection ":1.48" is not allowed to own the service "org.bluez" due to security policies in the configuration file
bluetoothd[2179]: Unable to get on D-Bus
所以我不再能够启动蓝牙。我没有(故意)弄乱任何 D-Bus 设置。
调试信息
无名
uname -a
Linux stereopi 4.19.97+ #1294 Thu Jan 30 13:10:54 GMT 2020 armv6l GNU/Linux
DMESG
[ 25.182516] Bluetooth: Core ver 2.22
[ 25.184013] Bluetooth: HCI device and connection manager initialized
[ 25.184039] Bluetooth: HCI socket layer initialized
[ 25.184053] Bluetooth: L2CAP socket layer initialized
[ 25.184124] Bluetooth: SCO socket layer initialized
[ 26.603279] Bluetooth: HCI UART driver ver 2.3
[ 26.603296] Bluetooth: HCI UART protocol H4 registered
[ 26.611594] Bluetooth: HCI UART protocol Three-wire (H5) registered
[ 26.621006] Bluetooth: HCI UART protocol Broadcom registered
[ 113.411241] Bluetooth: hci0: sending frame failed (-49)
[ 1728.994428] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[ 1728.994462] Bluetooth: HIDP socket layer initialized
hcitool
hcitool dev
Devices:
lsmod
lsmod |grep -iE '.*(btusb|bluetooth|hidp|l2cap).*'
hidp 24576 0
bluetooth 409600 3 hidp,hci_uart,btbcm
ecdh_generic 28672 1 bluetooth
rfkill 28672 4 bluetooth,cfg80211
套餐
dpkg -l | grep blue
iF bluez 5.50-1+rpt1 armhf Bluetooth tools and daemons
rc pi-bluetooth 0.1.12 all Raspberry Pi 3 bluetooth
brcmfmac
dmesg | grep brcmfmac
[ 14.249869] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[ 14.279400] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[ 14.279833] usbcore: registered new interface driver brcmfmac
[ 14.544592] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[ 14.544779] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[ 14.545983] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[ 24.080897] brcmfmac: power management disabled
射频杀
rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
蓝牙配置文件
cat /etc/bluetooth/main.conf
[General]
# Defaults to 'BlueZ X.YZ', if Name is not set here and plugin 'hostname' is not loaded.
# The plugin 'hostname' is loaded by default and overides the Name set here so
# consider modifying /etc/machine-info with variable PRETTY_HOSTNAME=<NewName> instead.
#Name = BlueZ
# Default device class. Only the major and minor device class bits are
# considered. Defaults to '0x000000'.
#Class = 0x000100
# How long to stay in discoverable mode before going back to non-discoverable
# The value is in seconds. Default is 180, i.e. 3 minutes.
# 0 = disable timer, i.e. stay discoverable forever
DiscoverableTimeout = 0
# How long to stay in pairable mode before going back to non-discoverable
# The value is in seconds. Default is 0.
# 0 = disable timer, i.e. stay pairable forever
PairableTimeout = 0
# Use vendor id source (assigner), vendor, product and version information for
# DID profile support. The values are separated by ":" and assigner, VID, PID
# and version.
# Possible vendor id source values: bluetooth, usb (defaults to usb)
#DeviceID = bluetooth:1234:5678:abcd
# Do reverse service discovery for previously unknown devices that connect to
# us. This option is really only needed for qualification since the BITE tester
# doesn't like us doing reverse SDP for some test cases (though there could in
# theory be other useful purposes for this too). Defaults to 'true'.
#ReverseServiceDiscovery = true
# Enable name resolving after inquiry. Set it to 'false' if you don't need
# remote devices name and want shorter discovery cycle. Defaults to 'true'.
#NameResolving = true
# Enable runtime persistency of debug link keys. Default is false which
# makes debug link keys valid only for the duration of the connection
# that they were created for.
#DebugKeys = false
# Restricts all controllers to the specified transport. Default value
# is "dual", i.e. both BR/EDR and LE enabled (when supported by the HW).
# Possible values: "dual", "bredr", "le"
#ControllerMode = dual
# Enables Multi Profile Specification support. This allows to specify if
# system supports only Multiple Profiles Single Device (MPSD) configuration
# or both Multiple Profiles Single Device (MPSD) and Multiple Profiles Multiple
# Devices (MPMD) configurations.
# Possible values: "off", "single", "multiple"
#MultiProfile = off
# Permanently enables the Fast Connectable setting for adapters that
# support it. When enabled other devices can connect faster to us,
# however the tradeoff is increased power consumptions. This feature
# will fully work only on kernel version 4.1 and newer. Defaults to
# 'false'.
#FastConnectable = false
# Default privacy setting.
# Enables use of private address.
# Possible values: "off", "device", "network"
# "network" option not supported currently
# Defaults to "off"
Privacy = off
[GATT]
# GATT attribute cache.
# Possible values:
# always: Always cache attributes even for devices not paired, this is
# recommended as it is best for interoperability, with more consistent
# reconnection times and enables proper tracking of notifications for all
# devices.
# yes: Only cache attributes of paired devices.
# no: Never cache attributes
# Default: always
#Cache = always
# Minimum required Encryption Key Size for accessing secured characteristics.
# Possible values: 0 and 7-16. 0 means don't care.
# Defaults to 0
# MinEncKeySize = 0
[Policy]
#
# The ReconnectUUIDs defines the set of remote services that should try
# to be reconnected to in case of a link loss (link supervision
# timeout). The policy plugin should contain a sane set of values by
# default, but this list can be overridden here. By setting the list to
# empty the reconnection feature gets disabled.
#ReconnectUUIDs=00001112-0000-1000-8000-00805f9b34fb,0000111f-0000-1000-8000-00805f9b34fb,0000110a-0000-1000-8000-00805f9b34fb
# ReconnectAttempts define the number of attempts to reconnect after a link
# lost. Setting the value to 0 disables reconnecting feature.
#ReconnectAttempts=7
# ReconnectIntervals define the set of intervals in seconds to use in between
# attempts.
# If the number of attempts defined in ReconnectAttempts is bigger than the
# set of intervals the last interval is repeated until the last attempt.
#ReconnectIntervals=1,2,4,8,16,32,64
# AutoEnable defines option to enable all controllers when they are found.
# This includes adapters present on start as well as adapters that are plugged
# in later on. Defaults to 'false'.
AutoEnable=true