Arch linux bluetooth audio

HOW TO: Bluetooth on Arch Linux

As some may struggle to get their bluetooth connections up and running under Arch Linux (and I have to google this each time I install as well) I decided to write a post on it. Hope you benefit from it!

Installation

The installation process for bluetooth is quite simple. We need a package that provides the protocol, the generic bluetooth driver as a kernel module and a way to control your bluetooth connections. If you want to use a bluetooth audio unit, e.g. a headset, you must also install pulseaudio-bluetooth for extension of the pulseaudio audio server.

Installing the package

We want to install the install the bluez package, which provides the Bluetooth protocol stack to our system. So go ahead and do a quick sudo pacman -S bluez .

This package also comes with a service. The service is required for bluetooth to work, so we need to start it with sudo systemctl start bluetooth.service .

If you do not want to start this service everytime, we can enable it by running sudo systemctl enable bluetooth.service – you can also combine both steps with sudo systemctl enable —now bluetooth.service .

Check for kernel module

The btusb kernel module provides the generic Bluetooth driver to our system. You can check whether it is loaded by running sudo lsmod | grep btusb , which will show btusb if the module has been loaded.

If that is not the case, we can load the module by running sudo modprobe btusb .

Install a tool to control bluetooth

Now, you can either install a command line tool to interact with your bluetooth capabilities or you can install a graphical utility for this. I always use Blueman for this, which is a GUI to control everything you’ll need when dealing with bluetooth.

Читайте также:  Acer aspire 5739g драйвер bluetooth

Install the blueman package with sudo pacman -S blueman . Now, blueman provides two binaries that can be used:

  1. First is the blueman-applet, which will start in the background and provide a traybar icon. You can connect to recent devices, launch the manager and more over that tray icon, so I recommend to use this and enable its autostart, which should automatically happen due to the .desktop file in the /etc/xdg/autostart folder.
  2. Second binary is the blueman-manager , which is the main GUI of blueman and allows you to manage lots of different bluetooth settings. It also allows the most basic functionality, connecting to other bluetooth devices. It can be started directly by executing said binary or by double-clicking the tray icon.

Be sure to have a succeful running bluetooth.service before starting blueman, otherwise it won’t find any devices!

Optional: Install bluetooth interface for pulseaudio

If you want to use bluetooth for audio input and/or output, you need to install the pulseaudio-bluetooth package as well. Do so with sudo pacman -S pulseaudio-bluetooth . Blueman will then in turn automatically activate the installed socket when connecting to a bluetooth audio unit.

Optional: Configure bluetooth pairing keys for dual boot

If you run a dual-boot system, you need to adapt your pairing keys. Otherwise, sharing a bluetooth dongle or built-in card will be very annoying. Resulting in the pairing key mismatch, each system will have to pair again after the other system connected to a device.

You can resolve this behavior by adapting your bluetooth pairing key, so that it matches the other system’s key. As this is a quite lengthy process, I won’t describe it here, but link to the great walkthrough in the arch wiki: https://wiki.archlinux.org/title/Bluetooth#Dual_boot_pairing

Done!

Now you’re able to receive files or connect to a headset via bluetooth on arch linux! If you need help with blueman, you should look into the Blueman wiki page or into their GitHub repository.

If you want to read more of my tipps and tricks under arch linux, I collect them under the Arch Linux tag here: https://lakur.tech/tags/arch-linux/

Читайте также:  Удаление сопряженных устройств bluetooth

Find posts on similar topics:

Источник

Blueman

Blueman is a full featured Bluetooth manager written in Python and using GTK.

Installation

Install either blueman or blueman-git AUR for the development version.

Be sure to enable the Bluetooth unit and start Blueman with blueman-applet . A graphical settings panel can be launched with blueman-manager .

Usage

Autostarting

The following autostart file should have been created: /etc/xdg/autostart/blueman.desktop . This means that Blueman should be autostarted with most desktop environments without manual intervention. See the article for your desktop environment or window manager as well as the Autostarting article for further information on autostarting.

Permissions

To receive files remember to right click on the Blueman tray icon > Local Services > Transfer > File Receiving (Object Push) and tick the Accept files from trusted devices box.

To be able to manage devices, you might need to add your user to the lp group, else you might receive the following error when connecting to a device: DBusFailedError: No such file or directory . This is because the user needs to be authorized to communicate with the Bluetooth daemon via D-Bus — the lp group is specified in /etc/dbus-1/system.d/bluetooth.conf . For information on adding a user to a group, see Users and groups#Other examples of user management.

From version 2.0.6 the official documentation recommends creating polkit rules in order to avoid polkit agents asking for password on every boot, as root user add the following polkit rules:

/etc/polkit-1/rules.d/51-blueman.rules
/* Allow users in wheel group to use blueman feature requiring root without authentication */ polkit.addRule(function(action, subject) < if ((action.id == "org.blueman.network.setup" || action.id == "org.blueman.dhcp.client" || action.id == "org.blueman.rfkill.setstate" || action.id == "org.blueman.pppd.pppconnect") && subject.isInGroup("wheel")) < return polkit.Result.YES; >>);

Note that users must belong to the wheel group.

Mounting Bluetooth devices

The instructions below describe a method for using different file managers with Blueman. The examples in this section focus on Thunar. If you are using a different file manager, substitute thunar with the name of the file manager you are using.

#!/bin/bash [ ! -d ~/Bluetooth ] && mkdir ~/Bluetooth fusermount -u ~/Bluetooth obexfs -b $1 ~/Bluetooth thunar ~/Bluetooth

Now you will need to move the script to an appropriate location (e.g., /usr/local/bin ). After that, mark it as executable.

Читайте также:  Bluetooth mouse and keyboard apk

The last step is to change the line in Blueman tray icon > Local Services > Transfer > Advanced to obex_thunar.sh %d .

Blueman and PulseAudio

Users who want to use PulseAudio with a Bluetooth headset, in addition to installing pulseaudio-bluetooth , may want to activate the PulseAudio plugin of Blueman. This automatically loads PulseAudio Bluetooth module after audio device is connected and plays all audio through the Bluetooth headset. For more information see Bluetooth headset.

Configuration

Configuration is done through dconf (or gsettings or dconf-editor ) under /org/blueman .

Disable auto power-on

Blueman automatically enables the Bluetooth adapter ( rfkill unblock bluetooth ) when certain events (on boot, laptop lid is opened, . ) occur. This can be disabled with the auto-power-on in org.blueman.plugins.powermanager :

$ gsettings set org.blueman.plugins.powermanager auto-power-on false

Troubleshooting

No adapters detected

If your Bluetooth applet or manager does not show or detect any Bluetooth adapter, your wireless card may be blocked. Try un-block it using rfkill.

Cannot receive files

If you cannot send or receive files and you encounter a python-dbus-exception error similar or exactly like process org.bluez.obex exited with status 1 then it is advised to start the obexd-service manually from /usr/lib/bluetooth/obexd and see if that helps. Since the default permissions assume 755 it is possible to start the daemon from a user-account.

Let the terminal in which the command runs open and test if sending files work. Check if you actually receive the file. You can add the command to your autostarter so you will not have to manually start the service every time. Your desktop environment autostarter should be able to run the program once you login. Logout and login and you should be able to receive files without running the line manually now.

Should the error persist or another occur then try using ObexFTP for file transfers instead.

See also

Источник

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