PulseAudio未检测到蓝牙耳机

PulseAudio未检测到蓝牙耳机

本文介绍了PulseAudio未检测到蓝牙耳机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将蓝牙耳机连接到我的RPI.我的设置如下:

I am trying to connect a bluetooth headset to my RPI. My setup is the following:

  • archlinux-arm,内核:linux-raspberrypi 3.12.23-1
  • AUR 构建并安装的
  • bluez4 4.101-4
  • bluez-tools 0.1.38-3
  • bluez-utils 5.20-1
  • pulseaudio 5.0-1
  • pulseaudio-alsa 2-3
  • archlinux-arm, kernel: linux-raspberrypi 3.12.23-1
  • bluez4 4.101-4 from AUR, built and installed
  • bluez-tools 0.1.38-3
  • bluez-utils 5.20-1
  • pulseaudio 5.0-1
  • pulseaudio-alsa 2-3

我扫描该设备,成功将其配对,添加为可信设备并连接它:

I scan for the device, successfully pair it, add as trusted and connect it:

hcitool scan
bluez-simple-agent hci0 <MAC>
bt-device --set <MAC> Trusted 1
bt-audio -c <MAC>

此后,设备状态如下(bt-device -i <MAC>输出):

After this, the device state is as follows (bt-device -i <MAC> output):

[00:23:7F:2A:3B:24]
Name: PLT 510
Alias: PLT 510 [rw]
Address: 00:23:7F:2A:3B:24
Icon: audio-card
Class: 0x200404
Paired: 1
Trusted: 1 [rw]
Blocked: 0 [rw]
Connected: 1
UUIDs: [Headset, Handsfree]

所以,一切似乎都很好,对吧?好吧,不完全是.
问题是当我尝试播放音频时,因为似乎PulseAudio无法识别它并且没有注册sourcesink条目:

So, everything seems to be great, right? Well, not quite.
The issue is when I try to play audio, because it seems PulseAudio didn't recognize it and didn't register source and sink entries:

[root@alarmpi bluetooth]# pactl list sources short
0   alsa_output.platform-bcm2835_AUD0.0.analog-stereo.monitor   module-alsa-card.c  s16le 2ch 44100Hz   IDLE
[root@alarmpi bluetooth]# pactl list sinks short
0   alsa_output.platform-bcm2835_AUD0.0.analog-stereo   module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED

我已经检查了module-bluetooth-policymodule-bluetooth-discover模块是否已加载.甚至尝试卸载并重新加载:

I have checked that the module-bluetooth-policy and module-bluetooth-discover modules are loaded. Even tried to unload and load back again:

pactl unload-module module-bluetooth-discover
pactl load-module module-bluetooth-discover

模块加载成功,但仍未显示在sourcessinks列表中.

Successfully loaded module, but still not showing in the sources nor sinks list.

我还尝试配置/etc/bluetooth/audio.conf以启用不同的选项,例如:

I also tried to configure the /etc/bluetooth/audio.conf to enable different options like:

Enable=Source,Sink,Media,Socket
Enable=Source,Sink,Headset,Gateway,Control,Media,Socket
Enable=Source,Sink,Media
...

但是它没有改变任何东西.

but it didn't change anything.

我全都没主意...为什么PulseAudio无法识别它?有什么我想念的吗?我是否需要以特殊方式配置PulseAudio?

I am all out of ideas...Why is it not recognized by PulseAudio? Is there something I missed? Do I need to configureI PulseAudio some special way?

推荐答案

在此期间,我设法解决了此问题,以下是对我有用的步骤.
有问题的操作系统是 archlinux-arm .

I have managed to resolve this issue in the meantime, and here are the steps that worked for me.
The OS in question is archlinux-arm.

安装以下软件包:

  • bluez4-4.101-4
  • bluez-tools-0.1.38-3
  • bluez-utils 5.21-2
  • libpulse-4.0-6
  • pulseaudio-4.0-6
  • pulseaudio-alsa-2-2
  • alsa-utils

其他准备工作

安装这些软件包的版本之后,我们不希望pacman稍后在进行系统升级时进行更新.为了防止这种情况,我们在/etc/pacman.conf中添加以下行:

Additional preparation

After we installed these package versions, we don't want pacman to update them later when we do system upgrade. To prevent this, we add the following line to our /etc/pacman.conf:

IgnorePkg = libpulse pulseaudio pulseaudio-alsa bluez bluez-tools

存在PulseAudio无法与bluez4一起使用的问题,尤其是在使用bluez4 4.1和更高版本以及pulseaudio 3.0或更高版本时无法切换到A2DP配置文件.可以通过在/etc/bluetooth/audio.conf中的启用列表中省略Socket参数来解决:

There are issues with PulseAudio failing to work with bluez4, especially failing to switch to A2DP profile when using bluez4 version 4.1 and higher and pulseaudio version 3.0 or higher. This can be resolved by ommiting the Socket parameter from the enabled list in the /etc/bluetooth/audio.conf:

# Enable=Headset,Sink,Source,Socket
Enable=Headset,Sink,Source

如果这还不够,请尝试添加其他行:

If this is not enough, try adding an additional line:

Disable=Socket

运行

是时候启用并启动bluetooth服务了:

systemctl enable bluetooth
systemctl start bluetooth

我们可以通过hcitoolbt-adapterbt-device找到我们的设备,然后连接到它.例如,使用后者:

We can discover our device via hcitool, bt-adapter or bt-device, and connect to it. For example, using the latter:

bt-device -d
bt-device -c <MAC>
bt-device --set <MAC> Trusted 1
bt-audio -c <MAC>

第一个命令发现设备,秒通过其MAC地址连接到该设备.第三个将其设置为受信任,以便稍后在范围内时可以自动连接到它.最后一条命令将其连接为音频设备.此后,它应该在pulseaudio中可用.

The first command discovers the device, the seconds connects to it by its MAC address. The third one sets it as trusted so we can autoconnect to it later on, when in range. The last command connects it as an audio device. After this, it should be available in pulseaudio.

通过pulseaudio --start启动PA.
检查源和接收器是否被正确识别:

Start the PA via pulseaudio --start.
Check if the sources and sinks are recognized properly:

pactl list sources short
pactl list sinks short

您应该看到列出了您的BT接收器和源,这意味着PA已检测到它们.注意接收器和源旁边的ID值.使用它们将您的BT设置为默认接收器/源:

You should see your BT sink and source listed, which means PA has detected them. Notice the ID values next to the sinks and sources. Use them to set your BT as the default sink/source:

pacmd set-default-source <BT_SOURCE_ID>
pacmd set-default-sink <BT_SINK_ID>

您可以通过pacmd list-cards找出BT卡ID及其支持的配置文件.您可能至少会在其中看到A2DPHSP配置文件.您可以像这样在它们之间切换:

You can find out the BT card id and its supported profiles with pacmd list-cards. You will probably see at least A2DP and HSP profiles listed there. You can switch between them like this:

# pacmd set-card-profile <card_id> <profile_name>
pacmd set-card-profile 1 a2dp
pacmd set-card-profile 1 hsp

自动连接

软件包 bluez-tools 包含名为 bt-monitor 的工具,该工具捕获来自bluetoothd守护程序的D-Bus信号,并为检测到的设备启动连接配对(并信任).运行bt-monitor并通过关闭和打开BT耳机进行测试.

Autoconnection

The package bluez-tools contains the tool called bt-monitor that captures the D-Bus signals from the bluetoothd daemon and initiates the connection for detected devices that are paired (and trusted). Run the bt-monitor and test by turning off and on your BT headset.

这篇关于PulseAudio未检测到蓝牙耳机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 12:33