- Configuration¶
- Configuration files¶
- /etc/bluetooth/main.conf¶
- /etc/bluetooth/audio.conf¶
- /etc/dbus-1/system.d/bluetooth.conf¶
- Tools/Applications¶
- bluetoothd¶
- hcitool¶
- hcidump¶
- hciconfig¶
- How to Configure Bluetooth in Arch Linux
- Connecting Process
- Prerequisites
- Install Utilities
- Enable Bluetooth
- Pair Bluetooth Device
- Conclusion
- About the author
- Younis Said
Configuration¶
The bluez stack has a number of different files and tools for configuration. In general, these files and tools may only be accessed by a system administrator but are an important prerequisite area of understanding before attempting to manage bluetooth using the dbus API.
Configuration files¶
Not all configuration files or settings are described here, but the most important ones are herein.
/etc/bluetooth/main.conf¶
The top-level configuration aspects are defined in here. The main.conf file is read by bluetoothd on start-up. Note that if you override any of the settings via dbus, these settings will not be persistent and will only survive the lifetime of bluetoothd e.g., a reboot would result in the original settings being used.
[General] # This is how your bluetooth adapter is identified and introduced to # other bluetooth devices. %h is the hostname and %d is a unique # identifier given to all bluetooth adapters when they are registered # to bluez. The name can also be updated through dbus. Name = %h-%d # Modify this if you known in advance which applications or services # your device will provide. The format follows the class of device # 24-bit identifier defined by bluetooth. # Note that this is for device identification convenience only and # does not prevent specific services or profiles from being activated # dynamically at a later date. # An implementation of a CoD decoder is part of the bt-manager python # library. Class = 0x000100 # When entering discovery mode, this is the timeout before going back # to non-discovery mode. Expressed in seconds. 0 means the device is always # discoverable. This attribute may be set from dbus. DiscoverableTimeout = 0 # When entering pairing mode, this is the timeout before dropping # back to non-discoverable mode. Expressed in seconds. 0 means the # device is always in pairing mode. PairableTimeout = 0 # Determined whether or not the adapter should be powered on start-up # or whether the user should power the adapter manually. This # attribute can be set via dbus. InitallyPowered = true # Allows the device identification SDP attributes to be set for # vendor code, product code and version. The format is: # assigner:vid:pid:version DeviceID = bluetooth:1234:5678:0100
/etc/bluetooth/audio.conf¶
The audio configuration is split into three main sections for General, HFP and A2DP profiles.
[General] # A list of the services on the host, which grants or denies permissions for # applications to use these services. Possible values are: # # Source - enables AudioSource # Sink - enables AudioSink # Control - enables AVRCP # Media - enables media endpoint/transport # Socket - auto-enables service endpoint selection; do not enable this if you want # to register your own service endpoints via dbus Enable = Source,Sink,Control,Media #Disable = Socket # SCO (Synchronous Connection Orientated) link routing setting for headset or HFP # # HCI => Host Control Interface (connection is handled by ALSA audio layer) # PCM => Pulse Coded Modulation # # Set to PCM if you wish for a dbus service to handle SCO transport. SCORouting = HCI # Boolean to determine whether or not to automatically connect all audio profiles # i.e., A2DP and HFP. AutoConnect = true [Headset] # Determine which headset profile to support i.e., HFP or HSP. HFP = true # Maximum number of headset connections to allow MaxConnected = 1 [A2DP] # Maximum number of A2DP connections to allow (source or sink) MaxConnected = 1
/etc/dbus-1/system.d/bluetooth.conf¶
This file describes the dbus access control policies for the interfaces exported by bluez over dbus. This determines which bluez services are accessible over dbus and which users or groups may access them via dbus.
The file is intended to give a complete list of services although not all services would normally be used.
user="root"> own="org.bluez"/> send_destination="org.bluez"/> send_interface="org.bluez.Agent"/> send_interface="org.bluez.Audio"/> send_interface="org.bluez.AudioSource"/> send_interface="org.bluez.AudioSink"/> send_interface="org.bluez.Control"/> send_interface="org.bluez.Media"/> send_interface="org.bluez.MediaEndpoint"/> send_interface="org.bluez.MediaTransport"/> send_interface="org.bluez.MediaPlayer"/> send_interface="org.bluez.ThermometerWatcher"/> send_interface="org.bluez.AlertAgent"/> send_interface="org.bluez.Profile"/> send_interface="org.bluez.HeartRateWatcher"/> send_interface="org.bluez.CyclingSpeedWatcher"/> send_interface="org.freedesktop.DBus.ObjectManager"/> at_console="true"> send_destination="org.bluez"/> communicate with bluetoothd --> group="lp"> send_destination="org.bluez"/> context="default"> send_destination="org.bluez"/>
Tools/Applications¶
bluetoothd¶
The daemon must be running before any bluetooth services can be used. It is typically started up as part of /etc/init.d/bluetooth start-up script and depends upon the dbus service.
Useful logging is output /var/log/syslog by bluetoothd . It is also possible for the root user to start the service manually with the debug options turned and view the trace on the console e.g.,
The above command will launch the daemon without detaching from the parent process and will turn the debug trace level on.
hcitool¶
HCI tool provides a command-line interface allowing the user to scan for remote devices and also enquire the capabilities of a device by its address e.g., 11:22:33:44:55:66 .
hcidump¶
A tool that allows HCI interface transactions to be dumped for debugging purposes.
hciconfig¶
A tool for configuring bluetooth devices via the HCI interface.
© Copyright 2014, Liam Wickins.
How to Configure Bluetooth in Arch Linux
Bluetooth is an extensively-used protocol for wireless audio connection with servers. You can find nearly every single person using Bluetooth on their mobile devices and systems. Using a Bluetooth device in a Linux distribution can be a bit complex for the first time. If you are an Arch Linux user, then you may become confused when configuring Bluetooth on your server.
The Arch Linux Bluetooth setup is tricky, compared to other Linux distributions. That is why beginner programmers face issues with Bluetooth configuration. Everyone is inclined towards using headphones and Bluetooth these days, so it is important to know the configuration process, even if you are a beginner on Arch Linux.
The steps in this guide can assist you in successfully setting up Bluetooth on your Arch Linux system. Once you have followed all the directions provided in this guide, you can enjoy all the benefits of Bluetooth on your Arch Linux desktop.
Connecting Process
You can develop a connection between your Bluetooth device and your server with just a few steps. To connect Bluetooth devices to your Arch Linux system, you must perform the following three processes:
- Step 1: Install utilities
- Step 2: Enable Bluetooth service
- Step 3: Pair with Arch Linux
You can further proceed with configuring the settings of your Bluetooth device on your system if there is not any pop-up error due to the compatibility of your server protocol.
Prerequisites
The only requirement for configuring Bluetooth on your system is the availability of a sudo user to log in as a root user. You will have to make sure that there is availability of a Bluetooth adapter on your system. The affirmation of the Pacman package will ease the installation of utilities.
Install Utilities
First, you will need to install the utilities for your Bluetooth device. Programmers usually opt for blueman, bluez, and bluez utils. Input the following commands to get these utilities on your Arch Linux system:
Now, to establish the loading of the btusb module, issue the following command in your terminal:
The last step of this process is to find the adaptor. Input the following command to find an adapter in your system:
The following command will tell you if the adapter is connected or is blocked.
In the case that your adapter is blocking the connectivity, input the following command to unblock the connection.
Enable Bluetooth
Enabling the Bluetooth service only requires two commands. One command will enable Bluetooth, and the other will provide an auto enabling system on your Arch Linux system. Input the following commands to enable Bluetooth connectivity on your system.
After running these commands, your Bluetooth system will start in Arch Linux. These commands access both the startup and enabling functions.
Pair Bluetooth Device
In this last step, you will pair the Bluetooth device and connect to the audio. Pairing does not require you to enter any complex commands. But, you will be required to input certain commands into the terminal system of Arch Linux for audio connection and error confrontation.
For pairing, go to the device in the window that is currently open after the enabling function. Select your device and press Enter. You will see the pairing screen; pair the device, and click next. The congratulation screen will inform you about the successful pairing of your device with the server.
It is now time to connect the audio of your server with the paired device. Connecting the audio allows your device to establish a connection with all the audio features on your Arch Linux server. You can listen to music, audio, video, and other items with sound. Input the following commands to connect the audio of your server with the paired device:
The above commands will install the PulseAudio extension for your Bluetooth. To start the function, run the following command.
Run the second command to autostart the function of PulseAudio.
To obtain the utility for ease of access to the back-and-forth function, input the following command. This will help you to move songs or music and control the volume without using any keys. This utility is an excellent feature and will come in handy when using the Bluetooth feature.
If your system adapts the advanced audio distribution profile, then you may confront some connection errors due to protocol. If you are a GDM user, then run the following commands:
$ cd ~ / src
$ git clone https: // aur.archlinux.org / pulseaudio-bluetooth-a2dp-gdm-fix.git
$ makepkg -i
That is all! You can now use your Bluetooth device remotely connected with your Arch Linux server.
Conclusion
No doubt, setting up the Bluetooth device on your Arch Linux system encompasses coding, unlike other servers. But, it is still accessible to compare this to the configuration of other applications on Linux. Those using Arch Linux as their main operating server will find it convenient to configure Bluetooth in Arch Linux. Just follow the three main steps listed in this article, and you can enjoy Bluetooth devices with your Linux Desktop. You can skip configuring the settings for a device after an audio configuration if your device is adaptable to the Arch Linux server settings. You can also ignore the process of checking blockage in the adapter connection if everything is going smoothly. This guide was designed to help out beginners using Arch Linux to set up their Bluetooth configuration with their server.
About the author
Younis Said
I am a freelancing software project developer, a software engineering graduate and a content writer. I love working with Linux and open-source software.