Debian 11 bluetooth наушники

Debian 11 bluetooth наушники

A2DP is the «Advanced Audio Distribution Profile», a standard for how Bluetooth devices can stream high-quality audio to remote devices. This is most commonly used for linking wireless headphones and speakers to your PC. The instructions in this page should apply to any A2DP-compatible device.

Pre-configuration

In short: To connect to a given device, you need Bluetooth hardware on your PC (either built-in, or in the form of a USB dongle), the Bluez daemon, and a compatible audio server (either PulseAudio or PipeWire).

Firmware

If your hardware supports Bluetooth but Debian is unable to find any Bluetooth devices, you may have a dongle based on a Broadcom BCM203x chipset, requiring extra firmware to be installed.

Add a non-free component to your apt sources and install the bluez-firmware package.

PulseAudio

PulseAudio is the default audio server in Debian. Unless you know what you’re doing, you probably want to follow these instructions.

Install the pulseaudio-module-bluetooth package if it’s not already installed. You probably also want pavucontrol (or pavucontrol-qt on LXQt or Plasma desktops) to configure your device after connecting it.

Once you have installed the Bluetooth module, it may be necessary to restart the bluetooth and pulseaudio services:

# service bluetooth restart $ killall pulseaudio

After connecting your device (see the «Pairing» section), your device will appear in Pavucontrol, where you can set it as your default audio output device, change individual applications to output using it, configure its profile, etc.

PipeWire

These instructions are mutually exclusive to the PulseAudio section, for users that are using the newer PipeWire audio server instead. This is also documented on the PipeWire wiki page in brief. Note that simply having the pipewire package installed does not mean this section is relevant to you, as it needs to have also been specially configured to replace PulseAudio.

Читайте также:  Plug and play usb bluetooth dongle

In Debian, PipeWire supports more modern codecs than PulseAudio without the need to install any external modules. In particular, PipeWire 0.3.26 supports mSBC, SBC, SBC-XQ, LDAC, AptX, and AptX-HD. It also supports the HSP_HS, HSP_AG, HFP_HF, and HFP_AG headset roles. Support for more codecs is in-progress.

At minimum, you will need to install the libspa-0.2-bluetooth package, remove the pulseaudio-module-bluetooth package (if previously installed), and then either reboot your computer or restart the PipeWire services, otherwise device connections will fail with «Protocol not available».

Note that, if you’re using the GNOME desktop, the gnome-core package has a hard dependency on pulseaudio-module-bluetooth. Attempting to remove it will also prompt to remove your desktop. If you run into issues when attempting to use Bluetooth with this package installed, you may still have to use PulseAudio in order to have functioning Bluetooth audio.

PipeWire will attempt to choose the best possible codec by default. You can override this, and tweak many other related settings, in the /etc/pipewire/media-session.d/bluez-monitor.conf file. You can edit this directly, or store local per-user changes by copying the file to ~/.config/pipewire/media-session.d/bluez-monitor.conf and editing that instead. You can check the currently-used codec with pactl list sinks

ALSA only

If you want to completely avoid using a higher-level audio server like PipeWire or PulseAudio, see BlueALSA. Currently only available in Debian Unstable.

Pairing

It is also highly recommended to install a graphical pairing tool. GNOME relies on gnome-bluetooth, after which you can find a «Bluetooth» section of your settings. KDE Plasma relies on bluedevil, which is a module for your system settings, a system tray applet, and a wizard for connecting to your devices. Other desktops can use the agnostic blueman tool.

More information, and instructions on using the CLI bluetoothctl tool, can be found on the main BluetoothUser page.

Troubleshooting

Refused to switch profile to a2dp_sink: Not connected

Your Bluetooth headset is connected, but PulseAudio fails to pick up the connected device, or there’s no device to pick. This happens because GDM captures A2DP sink on session start, as GDM needs PulseAudio in the GDM session for accessibility. For example, the screen reader requires it. See 805414 for some discussion.

Workaround 1: Disable PulseAudio in GDM

In order to prevent GDM from capturing the A2DP sink on session start, edit /var/lib/gdm3/.config/pulse/client.conf (or create it, if it doesn’t exist):

autospawn = no daemon-binary = /bin/true

After that you have to grant access to this file to Debian-gdm user:

chown Debian-gdm:Debian-gdm /var/lib/gdm3/.config/pulse/client.conf

You may also need to disable PulseAudio startup (however in Debian 10/Buster and newer, this has already been removed in the gdm3 postinst):

rm /var/lib/gdm3/.config/systemd/user/sockets.target.wants/pulseaudio.socket

In order to auto-connect A2DP for some devices, add this to /etc/pulse/default.pa:

load-module module-switch-on-connect

Now your audio device should be accessible through pavucontrol and your desktop’s standard audio settings.

Читайте также:  Интернет доступ через bluetooth

Workaround 2: Disable PulseAudio’s Bluetooth in GDM

The actual solution package maintainers are looking into next is to simply disable the Bluetooth sink in the GDM PulseAudio daemon so that it doesn’t take over the device. Add this to /var/lib/gdm3/.config/pulse/default.pa:

#!/usr/bin/pulseaudio -nF # # load system wide configuration .include /etc/pulse/default.pa ### unload driver modules for Bluetooth hardware .ifexists module-bluetooth-policy.so unload-module module-bluetooth-policy .endif .ifexists module-bluetooth-discover.so unload-module module-bluetooth-discover .endif

This was first discovered in the Arch wiki.

Solution

The actual solution is for PulseAudio to release the Bluetooth device when it is not in use. This is discussed in the PulseAudio 845938 which has a few upstream bugs pending as well that are related.

Unable to control volume with volumeicon-alsa

The volumeicon tray icon may not automatically recognize a Bluetooth A2DP device when a connection is established. See issue #73, «volumeicon does not work to adjust bluetooth volume» and issue #49, «change of the default device not automatically detected» for discussion and possible workarounds / fix. You might also try simply restarting Volumeicon, or adjusting your PulseAudio configuration to switch on connect.

a2dp-sink profile connect failed [. ]: Protocol not available

This error can appear when using PipeWire as your audio server and attempting to pair a device via Bluetooth, without first uninstalling the pulseaudio-module-bluetooth package.

If you’re using PulseAudio, PulseAudio may not be properly connecting to the device. It might be because it was already playing. Stopping anything playing on PulseAudio, restarting PulseAudio, and reconnecting to the device may fix the problem.

In addition, you need the following settings in /etc/pulse/default.pa or /etc/pulse/default.pa.d/bluez5.pa:

load-module module-bluez5-device load-module module-bluez5-discover

AptX, LDAC, and AAC codecs are not available with PulseAudio

While newer audio codecs such as AptX and LDAC are available in PipeWire, they’re still unavailable for PulseAudio users in Debian. AAC is unavailable outright because the library is non-free. However, PulseAudio has recently gained support for all of these codecs via GStreamer. Unfortunately, GStreamer is only supporting these codecs from v1.20 onwards. This means that support for modern codecs with PulseAudio is not available in Debian 10 or Debian 11. It is expected to land in Debian 12.

Читайте также:  Бегущая строка ардуино блютуз

A third-party project adds support for these additional codecs as well. It is deprecated and the creator recommends users either avoid it entirely, or switch to PipeWire. Nonetheless, it’s still a fully functional option in Debian 10: https://github.com/EHfive/pulseaudio-modules-bt

Additionally, a third-party script for Debian 10 is available which will automatically configure and install the additional codecs via the deprecated pulseaudio-modules-bt project: https://github.com/lagerimsi-ds/debian-buster_bluetooth_aptX-LDAC

If the PulseAudio sink adjusts automatically to SBC-sink (not A2DP-sink with aptX or LDAC), just reconnect your device.

See also

  • BluetoothUser — Main page for Bluetooth in Debian
  • BlueDevil — Bluetooth with KDE Plasma
  • BlueALSA — Bluetooth over ALSA alone

Источник

How To Install bluetooth on Debian 11

In this tutorial we learn how to install bluetooth on Debian 11.

What is bluetooth

This package provides all of the different plugins supported by the Bluez bluetooth stack.

There are three ways to install bluetooth on Debian 11. We can use apt-get , apt and aptitude . In the following sections we will describe each method. You can choose one of them.

Install bluetooth Using apt-get

Update apt database with apt-get using the following command.

After updating apt database, We can install bluetooth using apt-get by running the following command:

sudo apt-get -y install bluetooth 

Install bluetooth Using apt

Update apt database with apt using the following command.

After updating apt database, We can install bluetooth using apt by running the following command:

sudo apt -y install bluetooth 

Install bluetooth Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

After updating apt database, We can install bluetooth using aptitude by running the following command:

sudo aptitude -y install bluetooth 

Источник

Оцените статью
Adblock
detector