<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rakslice</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rakslice"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Rakslice"/>
	<updated>2026-04-25T20:08:52Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27376</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27376"/>
		<updated>2024-09-20T22:54:42Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a Bluetooth HID device but the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is not loaded. HID devices include keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace, when userspace HID support is enabled.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF&lt;br /&gt;
&amp;amp;#35; reboot}}&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|1=UserspaceHID=false}}&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27375</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27375"/>
		<updated>2024-09-20T22:52:41Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a Bluetooth HID device but the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is not loaded. HID devices include keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace when userspace HID support is enabled.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF&lt;br /&gt;
&amp;amp;#35; reboot}}&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|1=UserspaceHID=false}}&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27374</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27374"/>
		<updated>2024-09-20T22:51:52Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a Bluetooth HID device but the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is not loaded. HID devices include keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace when userspace HID support is enabled.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF&lt;br /&gt;
&amp;amp;#35; reboot}}&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;UserspaceHID=false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27373</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27373"/>
		<updated>2024-09-20T22:50:39Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a Bluetooth HID device but the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is not loaded. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace when userspace HID support is enabled.&lt;br /&gt;
&lt;br /&gt;
HID devices include keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF&lt;br /&gt;
&amp;amp;#35; reboot}}&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;UserspaceHID=false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27372</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27372"/>
		<updated>2024-09-20T22:49:39Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a Bluetooth HID device when userspace HID support is enabled but the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is not loaded. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace.&lt;br /&gt;
&lt;br /&gt;
HID devices include keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF&lt;br /&gt;
&amp;amp;#35; reboot}}&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;UserspaceHID=false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27371</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27371"/>
		<updated>2024-09-20T22:49:18Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a Bluetooth HID device when userspace HID support is enabled but the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is not loaded. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace.&lt;br /&gt;
&lt;br /&gt;
This includes keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF&lt;br /&gt;
&amp;amp;#35; reboot}}&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;UserspaceHID=false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27370</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27370"/>
		<updated>2024-09-20T22:48:11Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a Bluetooth HID device when userspace HID support is enabled but the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is not loaded. &lt;br /&gt;
&lt;br /&gt;
This includes keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF&lt;br /&gt;
&amp;amp;#35; reboot}}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace.&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;UserspaceHID=false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27369</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27369"/>
		<updated>2024-09-20T22:47:22Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a Bluetooth HID device, when userspace HID support is enabled but the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is not loaded. &lt;br /&gt;
&lt;br /&gt;
This includes keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF&lt;br /&gt;
&amp;amp;#35; reboot}}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace.&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;UserspaceHID=false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27368</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27368"/>
		<updated>2024-09-20T22:43:54Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a Bluetooth HID device, when userspace HID support is enabled but the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is not loaded. &lt;br /&gt;
&lt;br /&gt;
This includes keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF&lt;br /&gt;
# reboot}}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace.&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;UserspaceHID=false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27367</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27367"/>
		<updated>2024-09-20T22:41:45Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a Bluetooth HID device, when userspace HID support is enabled but the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is not loaded. &lt;br /&gt;
&lt;br /&gt;
This includes keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace.&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;UserspaceHID=false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27366</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27366"/>
		<updated>2024-09-20T22:36:29Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a device which requires the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module when userspace HID support is enabled.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace. This includes keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;UserspaceHID=false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27365</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27365"/>
		<updated>2024-09-20T22:36:02Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a device which requires the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module, when userspace HID support is enabled.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace. This includes keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;UserspaceHID=false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27364</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27364"/>
		<updated>2024-09-20T22:35:29Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a device which requires the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace. This includes keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;UserspaceHID=false&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27363</id>
		<title>Bluetooth</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Bluetooth&amp;diff=27363"/>
		<updated>2024-09-20T22:34:53Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: /* &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft|work in progress}}&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a standard for the short-range wireless interconnection of cellular phones, computers, and other electronic devices. [https://www.bluez.org/ BlueZ] is an implementation of the Bluetooth protocol stack for Linux, and it is provided by the {{Pkg|bluez}} package.&lt;br /&gt;
&lt;br /&gt;
This article describes the basic installation of Bluetooth controllers and devices.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites and Basic Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
{{todo|test bluetooth with [[mdev]]}}&lt;br /&gt;
&lt;br /&gt;
{{Pkg|eudev}} should be installed and setup:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# setup-devd udev}}&lt;br /&gt;
&lt;br /&gt;
=== Basic Installation ===&lt;br /&gt;
&lt;br /&gt;
Basic installation is as follows:&lt;br /&gt;
&lt;br /&gt;
# Install {{Pkg|bluez}}&lt;br /&gt;
#* Optionally install {{Pkg|bluez-deprecated}} if you need deprecated tools like &amp;lt;code&amp;gt;hcitool&amp;lt;/code&amp;gt;&lt;br /&gt;
# Load the &amp;lt;code&amp;gt;btusb&amp;lt;/code&amp;gt; kernel module&lt;br /&gt;
# Add user to the &amp;lt;code&amp;gt;lp&amp;lt;/code&amp;gt; group&lt;br /&gt;
# Start and enable the Bluetooth service&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add bluez&lt;br /&gt;
&amp;amp;#35; apk add bluez-deprecated&lt;br /&gt;
&amp;amp;#35; modprobe btusb&lt;br /&gt;
&amp;amp;#35; adduser $USER lp&lt;br /&gt;
&amp;amp;#35; rc-service bluetooth start&lt;br /&gt;
&amp;amp;#35; rc-update add bluetooth default}}&lt;br /&gt;
&lt;br /&gt;
Now, check the state of the Bluetooth radio transmitter using &amp;lt;code&amp;gt;rfkill&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ rfkill list bluetooth}}&lt;br /&gt;
&lt;br /&gt;
It should return something similar to:&lt;br /&gt;
&lt;br /&gt;
 0: hci0: Bluetooth&lt;br /&gt;
         Soft blocked: no&lt;br /&gt;
         Hard blocked: no&lt;br /&gt;
&lt;br /&gt;
If the device is listed as blocked, it can be unblocked using the same tool:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# rfkill unblock bluetooth}}&lt;br /&gt;
&lt;br /&gt;
{{Note|It may be necessary to restart the Bluetooth service before continuing.}}&lt;br /&gt;
&lt;br /&gt;
=== Front-ends ===&lt;br /&gt;
&lt;br /&gt;
There are several front-ends available:&lt;br /&gt;
&lt;br /&gt;
* The {{Pkg|bluez}} comes with the &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; front-end&lt;br /&gt;
* {{Pkg|blueman}}: a full-featured Bluetooth manager&lt;br /&gt;
* {{Pkg|bluedevil}}: the [[KDE]] Bluetooth manager&lt;br /&gt;
* {{Pkg|bluetuith}}: simple text-based bluetooth management user interface&lt;br /&gt;
* {{Pkg|gnome-bluetooth}}: the [[GNOME]] Bluetooth manager&lt;br /&gt;
&lt;br /&gt;
== Pairing ==&lt;br /&gt;
&lt;br /&gt;
=== Using &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Begin by starting &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and follow these basic steps:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ bluetoothctl}}&lt;br /&gt;
&lt;br /&gt;
The prompt should display:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;#&lt;br /&gt;
&lt;br /&gt;
List the available controllers:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
&lt;br /&gt;
Display information about a controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Set the default controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# select &#039;&#039;controller_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Power on the controller:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# power on&lt;br /&gt;
&lt;br /&gt;
Enable the agent and set it as default:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# agent on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# default-agent&lt;br /&gt;
&lt;br /&gt;
Set the controller as discoverable (temporarily for 3 minutes) and pairable:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# discoverable on&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pairable on&lt;br /&gt;
&lt;br /&gt;
Scan for devices:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# scan on&lt;br /&gt;
&lt;br /&gt;
Put the device into pairing mode. This generally involves pressing a button or a combinations of buttons, usually for several seconds.&lt;br /&gt;
&lt;br /&gt;
Discover the device MAC address:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# devices&lt;br /&gt;
&lt;br /&gt;
Pair with the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# pair &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enter the PIN if prompted:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;[agent]&amp;lt;/span&amp;gt; PIN code: ####&lt;br /&gt;
&lt;br /&gt;
Trust the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# #trust &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Connect to the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# connect &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Display information about the device:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# info &#039;&#039;device_mac_address&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The device is now paired:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# quit&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Set adapter power state ===&lt;br /&gt;
&lt;br /&gt;
If you would like the adapter to not be automatically enabled (e.g. on a portable device where you wish to save battery), set &amp;lt;code&amp;gt;AutoEnable=false&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/bluetooth/main.conf&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;[Policy]&amp;lt;/code&amp;gt; section:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[Policy]&lt;br /&gt;
...&lt;br /&gt;
AutoEnable&amp;amp;#61;false&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
=== Battery Reporting ===&lt;br /&gt;
&lt;br /&gt;
An experimental feature can be enabled in order to report device battery level:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/bluetooth/main.conf|[General]&lt;br /&gt;
...&lt;br /&gt;
Experimental&amp;amp;#61;true&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Due to the variety of available Bluetooth hardware it is possible that you receive errors while attempting to install, activate, or find your Bluetooth device.&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;No default controller available&amp;quot; error ===&lt;br /&gt;
&lt;br /&gt;
After having followed these instructions, or others, you run &amp;lt;code&amp;gt;bluetoothctl&amp;lt;/code&amp;gt; and encounter the following scenario:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# list&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;[bluetooth]&amp;lt;/span&amp;gt;# show&lt;br /&gt;
 No default controller available&lt;br /&gt;
&lt;br /&gt;
One possible solution is that you are missing firmware drivers.&lt;br /&gt;
&lt;br /&gt;
Try running the following command to discover the source of the issue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# dmesg &amp;amp;#124; grep -i bluetooth &amp;amp;#124; grep -i firmware}}&lt;br /&gt;
&lt;br /&gt;
There are many firmware packages available that could likely solve the this problem (see {{Pkg|linux-firmware-*}}).&lt;br /&gt;
&lt;br /&gt;
Another possible solution is to install {{Pkg|hidapi}} and add load the module:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add hidapi&lt;br /&gt;
&amp;amp;#35; modprobe uhid}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to create configuration to load the uhid and btusb kernel modules on boot:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/btusb.conf&lt;br /&gt;
&amp;amp;#35;Load btusb kernel module:&lt;br /&gt;
btusb&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;quot;org.bluez.Error.NotAvailable br-connection-profile-unavailable&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
The error &amp;lt;code&amp;gt;br-connection-profile-unavailable&amp;lt;/code&amp;gt; is sometimes produced when trying to connect a device which requires the &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module.&lt;br /&gt;
&lt;br /&gt;
Loading &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; after encountering this error does not always fix the problem.&lt;br /&gt;
&lt;br /&gt;
Try setting up &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; to load at boot, and then rebooting:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/modules-load.d/uhid.conf&lt;br /&gt;
&amp;amp;#35;Load uhid kernel module:&lt;br /&gt;
uhid&lt;br /&gt;
EOF}}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;uhid&amp;lt;/code&amp;gt; kernel module is required for USB HID devices with drivers that are implemented in userspace. This includes keyboards and the volume buttons on headphones (which are sometimes presented to the OS as a keyboard), mice, game controllers, alphanumeric displays, etc.&lt;br /&gt;
&lt;br /&gt;
Alternatively, the userspace HID feature can be disabled entirely in favour of kernel HIDP drivers in &amp;lt;code&amp;gt;/etc/bluetooth/input.conf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|UserspaceHID=false}}&lt;br /&gt;
&lt;br /&gt;
=== Unable to control Bluetooth speaker volume / Bluetooth output is muted (Pulseaudio) ===&lt;br /&gt;
&lt;br /&gt;
It is possible to automatically switch audio output and volume control to last connected device.&lt;br /&gt;
&lt;br /&gt;
This can solve the problem of controlling the speaker volume when switching between Bluetooth devices.&lt;br /&gt;
&lt;br /&gt;
Append the following lines at the end of the {{Path|/etc/pulse/default.pa}}:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/pulse/default.pa|...&lt;br /&gt;
&amp;amp;#35;##Automatically switch audio to the most recently connected device (Bluetooth, HDMI, USB)&lt;br /&gt;
load-module module-switch-on-connect}}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[PulseAudio#Bluetooth|PulseAudio with Bluetooth]]&lt;br /&gt;
* [[PipeWire#Bluetooth_audio|PipeWire with Bluetooth]]&lt;br /&gt;
* [https://wiki.postmarketos.org/wiki/Bluetooth Bluetooth entry on PostmarketOS Wiki]&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/Bluetooth Bluetooth entry on Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Bluetooth Bluetooth entry on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Multimedia]]&lt;br /&gt;
[[Category:Hardware]]&lt;br /&gt;
[[Category:Sound]]&lt;br /&gt;
[[Category:Drivers]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Udhcpc&amp;diff=20752</id>
		<title>Udhcpc</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Udhcpc&amp;diff=20752"/>
		<updated>2021-12-09T13:22:30Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Expand|Please help us expand this article by contributing.}}&lt;br /&gt;
&lt;br /&gt;
You may want to customize the behavior of the default DHCP client (&amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; from busybox), which is called by &amp;lt;code&amp;gt;/sbin/ifup&amp;lt;/code&amp;gt; by having &amp;quot;&amp;lt;code&amp;gt;dhcp&amp;lt;/code&amp;gt;&amp;quot; in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The default behavior is driven by the script &amp;lt;code&amp;gt;/usr/share/udhcpc/default.script&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Entries in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; for DHCP interfaces will drive the &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; command line. For example:&amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;auto eth0&lt;br /&gt;
iface eth0 inet dhcp&lt;br /&gt;
        hostname myhostname&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will set these parameters on the command line:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;-i eth0 -x hostname:myhostname&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The hostname will send the DHCP option to the server to tell the server the name of this client.&lt;br /&gt;
&lt;br /&gt;
The documentation for &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; can be found in [https://udhcp.busybox.net/README.udhcpc the busybox udhcpc readme file]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add arbitrary command line parameters to the &amp;lt;code&amp;gt;udhcpc_opts&amp;lt;/code&amp;gt; setting in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt;. See the example of &amp;lt;code&amp;gt;udhcpc_opts&amp;lt;/code&amp;gt; in [[Configure Networking#IPv4 DHCP Configuration|the main networking article]].&lt;br /&gt;
&lt;br /&gt;
The default configuration of &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; may be overridden by &amp;lt;code&amp;gt;/etc/udhcpc/udhcpc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Authorized key:value pairs for &amp;lt;code&amp;gt;udhcpc.conf&amp;lt;/code&amp;gt; are:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;15&amp;quot; border=&amp;quot;1&amp;quot; class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! key&lt;br /&gt;
| default value&lt;br /&gt;
| possible values&lt;br /&gt;
|-&lt;br /&gt;
| NO_GATEWAY&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;list of iface names&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| IF_METRIC&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;metric value&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| IF_PEER_DNS&lt;br /&gt;
| yes&lt;br /&gt;
| &amp;lt;anything but yes&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| RESOLV_CONF&lt;br /&gt;
| /etc/resolv.conf&lt;br /&gt;
| no ; NO ; -&lt;br /&gt;
|-&lt;br /&gt;
| NO_DNS&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;list of iface names&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example &amp;lt;code&amp;gt;/etc/udhcpc/udhcpc.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 RESOLV_CONF=&amp;quot;no&amp;quot; # Prevents overwriting of /etc/resolv.conf&lt;br /&gt;
&lt;br /&gt;
Custom scripts can be added as &amp;lt;code&amp;gt;/etc/udhcpc/pre-*&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/etc/udhcpc/post-*&amp;lt;/code&amp;gt; to be run before/after deconfig/renew/bound DHCP events. They must be set as &#039;&#039;&#039;executable&#039;&#039;&#039; by root, e.g. &amp;lt;code&amp;gt;chmod 744&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an example, &amp;lt;code&amp;gt;/etc/udhcpc/post-bound/mtu&amp;lt;/code&amp;gt; could contain, to change the interface MTU from the default (1500) to 1492, which is useful if [https://en.wikipedia.org/wiki/Maximum_transmission_unit on ADSL that uses PPPoE] (which uses 8 bytes for its own header):&lt;br /&gt;
&lt;br /&gt;
 r=$(/sbin/ip route | grep ^default | head -n 1)&lt;br /&gt;
 # Needs iproute2 package, rather than busybox&#039;s &amp;quot;ip&amp;quot;, to change mtu&lt;br /&gt;
 /sbin/ip route replace $r mtu 1492&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Hack alert:&amp;lt;/b&amp;gt;&lt;br /&gt;
I needed to restart my firewall (which replaces the &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt; script from Alpine) when the client binds to a new IP, so I added the following line in the function &amp;lt;code&amp;gt;bound()&amp;lt;/code&amp;gt;, right after &#039;&amp;lt;code&amp;gt;resolvconf&amp;lt;/code&amp;gt;&#039;:&lt;br /&gt;
&lt;br /&gt;
  /etc/init.d/iptables reload&lt;br /&gt;
&lt;br /&gt;
The reload drops all firewall rules, re-acquires the Internal and external IPs, and re-writes the rules. I&#039;m sure there is a better way.&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Embedded Systems]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Udhcpc&amp;diff=20751</id>
		<title>Udhcpc</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Udhcpc&amp;diff=20751"/>
		<updated>2021-12-09T13:21:48Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Expand|Please help us expand this article by contributing.}}&lt;br /&gt;
&lt;br /&gt;
You may want to customize the behavior of the default DHCP client (&amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; from busybox), which is called by &amp;lt;code&amp;gt;/sbin/ifup&amp;lt;/code&amp;gt; by having &amp;quot;&amp;lt;code&amp;gt;dhcp&amp;lt;/code&amp;gt;&amp;quot; in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The default behavior is driven by the script &amp;lt;code&amp;gt;/usr/share/udhcpc/default.script&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Entries in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; for DHCP interfaces will drive the &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; command line. For example:&amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;auto eth0&lt;br /&gt;
iface eth0 inet dhcp&lt;br /&gt;
        hostname myhostname&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will set these parameters on the command line:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;-i eth0 -x hostname:myhostname&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The hostname will send the DHCP option to the server to tell the server the name of this client.&lt;br /&gt;
&lt;br /&gt;
The documentation for &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; can be found in [https://udhcp.busybox.net/README.udhcpc the busybox udhcpc readme file]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add arbitrary command line parameters to the &amp;lt;code&amp;gt;udhcpc_opts&amp;lt;/code&amp;gt; setting in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt;. See the example in [[Configure Networking#IPv4 DHCP Configuration|the main networking article]].&lt;br /&gt;
&lt;br /&gt;
The default configuration of &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; may be overridden by &amp;lt;code&amp;gt;/etc/udhcpc/udhcpc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Authorized key:value pairs for &amp;lt;code&amp;gt;udhcpc.conf&amp;lt;/code&amp;gt; are:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;15&amp;quot; border=&amp;quot;1&amp;quot; class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! key&lt;br /&gt;
| default value&lt;br /&gt;
| possible values&lt;br /&gt;
|-&lt;br /&gt;
| NO_GATEWAY&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;list of iface names&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| IF_METRIC&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;metric value&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| IF_PEER_DNS&lt;br /&gt;
| yes&lt;br /&gt;
| &amp;lt;anything but yes&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| RESOLV_CONF&lt;br /&gt;
| /etc/resolv.conf&lt;br /&gt;
| no ; NO ; -&lt;br /&gt;
|-&lt;br /&gt;
| NO_DNS&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;list of iface names&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example &amp;lt;code&amp;gt;/etc/udhcpc/udhcpc.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 RESOLV_CONF=&amp;quot;no&amp;quot; # Prevents overwriting of /etc/resolv.conf&lt;br /&gt;
&lt;br /&gt;
Custom scripts can be added as &amp;lt;code&amp;gt;/etc/udhcpc/pre-*&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/etc/udhcpc/post-*&amp;lt;/code&amp;gt; to be run before/after deconfig/renew/bound DHCP events. They must be set as &#039;&#039;&#039;executable&#039;&#039;&#039; by root, e.g. &amp;lt;code&amp;gt;chmod 744&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an example, &amp;lt;code&amp;gt;/etc/udhcpc/post-bound/mtu&amp;lt;/code&amp;gt; could contain, to change the interface MTU from the default (1500) to 1492, which is useful if [https://en.wikipedia.org/wiki/Maximum_transmission_unit on ADSL that uses PPPoE] (which uses 8 bytes for its own header):&lt;br /&gt;
&lt;br /&gt;
 r=$(/sbin/ip route | grep ^default | head -n 1)&lt;br /&gt;
 # Needs iproute2 package, rather than busybox&#039;s &amp;quot;ip&amp;quot;, to change mtu&lt;br /&gt;
 /sbin/ip route replace $r mtu 1492&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Hack alert:&amp;lt;/b&amp;gt;&lt;br /&gt;
I needed to restart my firewall (which replaces the &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt; script from Alpine) when the client binds to a new IP, so I added the following line in the function &amp;lt;code&amp;gt;bound()&amp;lt;/code&amp;gt;, right after &#039;&amp;lt;code&amp;gt;resolvconf&amp;lt;/code&amp;gt;&#039;:&lt;br /&gt;
&lt;br /&gt;
  /etc/init.d/iptables reload&lt;br /&gt;
&lt;br /&gt;
The reload drops all firewall rules, re-acquires the Internal and external IPs, and re-writes the rules. I&#039;m sure there is a better way.&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Embedded Systems]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Udhcpc&amp;diff=20750</id>
		<title>Udhcpc</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Udhcpc&amp;diff=20750"/>
		<updated>2021-12-09T13:20:43Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: editing for clarity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Expand|Please help us expand this article by contributing.}}&lt;br /&gt;
&lt;br /&gt;
You may want to customize the behavior of the default DHCP client (&amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; from busybox), which is called by &amp;lt;code&amp;gt;/sbin/ifup&amp;lt;/code&amp;gt; by having &amp;quot;&amp;lt;code&amp;gt;dhcp&amp;lt;/code&amp;gt;&amp;quot; in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The default behavior is driven by the script &amp;lt;code&amp;gt;/usr/share/udhcpc/default.script&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Entries in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; for DHCP interfaces will drive the &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; command line. For example:&amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;auto eth0&lt;br /&gt;
iface eth0 inet dhcp&lt;br /&gt;
        hostname myhostname&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will set these parameters on the command line:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;-i eth0 -x hostname:myhostname&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The hostname will send the DHCP option to the server to tell the server the name of this client.&lt;br /&gt;
&lt;br /&gt;
The documentation for &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; can be found in [https://udhcp.busybox.net/README.udhcpc the busybox udhcpc readme file]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add arbitrary command line parameters to the &amp;lt;code&amp;gt;udhcpc_opts&amp;lt;/code&amp;gt; setting in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt;. See the example in [[Configure Networking#IPv4 DHCP Configuration|the main networking article]].&lt;br /&gt;
&lt;br /&gt;
The default configuration of &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; may be overwritten by &amp;lt;code&amp;gt;/etc/udhcpc/udhcpc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Authorized key:value pairs are:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;15&amp;quot; border=&amp;quot;1&amp;quot; class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! key&lt;br /&gt;
| default value&lt;br /&gt;
| possible values&lt;br /&gt;
|-&lt;br /&gt;
| NO_GATEWAY&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;list of iface names&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| IF_METRIC&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;metric value&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| IF_PEER_DNS&lt;br /&gt;
| yes&lt;br /&gt;
| &amp;lt;anything but yes&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| RESOLV_CONF&lt;br /&gt;
| /etc/resolv.conf&lt;br /&gt;
| no ; NO ; -&lt;br /&gt;
|-&lt;br /&gt;
| NO_DNS&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;list of iface names&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example &amp;lt;code&amp;gt;/etc/udhcpc/udhcpc.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 RESOLV_CONF=&amp;quot;no&amp;quot; # Prevents overwriting of /etc/resolv.conf&lt;br /&gt;
&lt;br /&gt;
Custom scripts can be added as &amp;lt;code&amp;gt;/etc/udhcpc/pre-*&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/etc/udhcpc/post-*&amp;lt;/code&amp;gt; to be run before/after deconfig/renew/bound DHCP events. They must be set as &#039;&#039;&#039;executable&#039;&#039;&#039; by root, e.g. &amp;lt;code&amp;gt;chmod 744&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an example, &amp;lt;code&amp;gt;/etc/udhcpc/post-bound/mtu&amp;lt;/code&amp;gt; could contain, to change the interface MTU from the default (1500) to 1492, which is useful if [https://en.wikipedia.org/wiki/Maximum_transmission_unit on ADSL that uses PPPoE] (which uses 8 bytes for its own header):&lt;br /&gt;
&lt;br /&gt;
 r=$(/sbin/ip route | grep ^default | head -n 1)&lt;br /&gt;
 # Needs iproute2 package, rather than busybox&#039;s &amp;quot;ip&amp;quot;, to change mtu&lt;br /&gt;
 /sbin/ip route replace $r mtu 1492&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Hack alert:&amp;lt;/b&amp;gt;&lt;br /&gt;
I needed to restart my firewall (which replaces the &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt; script from Alpine) when the client binds to a new IP, so I added the following line in the function &amp;lt;code&amp;gt;bound()&amp;lt;/code&amp;gt;, right after &#039;&amp;lt;code&amp;gt;resolvconf&amp;lt;/code&amp;gt;&#039;:&lt;br /&gt;
&lt;br /&gt;
  /etc/init.d/iptables reload&lt;br /&gt;
&lt;br /&gt;
The reload drops all firewall rules, re-acquires the Internal and external IPs, and re-writes the rules. I&#039;m sure there is a better way.&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Embedded Systems]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Udhcpc&amp;diff=20749</id>
		<title>Udhcpc</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Udhcpc&amp;diff=20749"/>
		<updated>2021-12-09T13:20:00Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Expand|Please help us expand this article by contributing.}}&lt;br /&gt;
&lt;br /&gt;
You may want to customize the behavior of the default DHCP client (&amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; from busybox), which is called by &amp;lt;code&amp;gt;/sbin/ifup&amp;lt;/code&amp;gt; by having &amp;quot;&amp;lt;code&amp;gt;dhcp&amp;lt;/code&amp;gt;&amp;quot; in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The default behavior is driven by the script &amp;lt;code&amp;gt;/usr/share/udhcpc/default.script&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Entries in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; for DHCP interfaces will drive the &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; command line. For example:&amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;auto eth0&lt;br /&gt;
iface eth0 inet dhcp&lt;br /&gt;
        hostname myhostname&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will set these parameters on the command line:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;-i eth0 -x hostname:myhostname&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The hostname will send the DHCP option to the server to tell the server the name of this client.&lt;br /&gt;
&lt;br /&gt;
The documentation for &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; can be found in [https://udhcp.busybox.net/README.udhcpc the busybox udhcpc readme file]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add arbitrary command line parameters to the &amp;lt;code&amp;gt;udhcpc_opts&amp;lt;/code&amp;gt; setting in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt;. See the example in [[Configure Networking#IPv4 DHCP Configuration|the main networking article]].&lt;br /&gt;
&lt;br /&gt;
Its default configuration may be overwritten by &amp;lt;code&amp;gt;/etc/udhcpc/udhcpc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Authorized key:value pairs are:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;15&amp;quot; border=&amp;quot;1&amp;quot; class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! key&lt;br /&gt;
| default value&lt;br /&gt;
| possible values&lt;br /&gt;
|-&lt;br /&gt;
| NO_GATEWAY&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;list of iface names&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| IF_METRIC&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;metric value&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| IF_PEER_DNS&lt;br /&gt;
| yes&lt;br /&gt;
| &amp;lt;anything but yes&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| RESOLV_CONF&lt;br /&gt;
| /etc/resolv.conf&lt;br /&gt;
| no ; NO ; -&lt;br /&gt;
|-&lt;br /&gt;
| NO_DNS&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;list of iface names&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example &amp;lt;code&amp;gt;/etc/udhcpc/udhcpc.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 RESOLV_CONF=&amp;quot;no&amp;quot; # Prevents overwriting of /etc/resolv.conf&lt;br /&gt;
&lt;br /&gt;
Custom scripts can be added as &amp;lt;code&amp;gt;/etc/udhcpc/pre-*&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/etc/udhcpc/post-*&amp;lt;/code&amp;gt; to be run before/after deconfig/renew/bound DHCP events. They must be set as &#039;&#039;&#039;executable&#039;&#039;&#039; by root, e.g. &amp;lt;code&amp;gt;chmod 744&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an example, &amp;lt;code&amp;gt;/etc/udhcpc/post-bound/mtu&amp;lt;/code&amp;gt; could contain, to change the interface MTU from the default (1500) to 1492, which is useful if [https://en.wikipedia.org/wiki/Maximum_transmission_unit on ADSL that uses PPPoE] (which uses 8 bytes for its own header):&lt;br /&gt;
&lt;br /&gt;
 r=$(/sbin/ip route | grep ^default | head -n 1)&lt;br /&gt;
 # Needs iproute2 package, rather than busybox&#039;s &amp;quot;ip&amp;quot;, to change mtu&lt;br /&gt;
 /sbin/ip route replace $r mtu 1492&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Hack alert:&amp;lt;/b&amp;gt;&lt;br /&gt;
I needed to restart my firewall (which replaces the &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt; script from Alpine) when the client binds to a new IP, so I added the following line in the function &amp;lt;code&amp;gt;bound()&amp;lt;/code&amp;gt;, right after &#039;&amp;lt;code&amp;gt;resolvconf&amp;lt;/code&amp;gt;&#039;:&lt;br /&gt;
&lt;br /&gt;
  /etc/init.d/iptables reload&lt;br /&gt;
&lt;br /&gt;
The reload drops all firewall rules, re-acquires the Internal and external IPs, and re-writes the rules. I&#039;m sure there is a better way.&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Embedded Systems]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Udhcpc&amp;diff=20748</id>
		<title>Udhcpc</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Udhcpc&amp;diff=20748"/>
		<updated>2021-12-09T13:19:17Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: Added a note about udhcpc_opts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Expand|Please help us expand this article by contributing.}}&lt;br /&gt;
&lt;br /&gt;
You may want to customize the behavior of the default DHCP client (&amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; from busybox), which is called by &amp;lt;code&amp;gt;/sbin/ifup&amp;lt;/code&amp;gt; by having &amp;quot;&amp;lt;code&amp;gt;dhcp&amp;lt;/code&amp;gt;&amp;quot; in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The default behavior is driven by the script &amp;lt;code&amp;gt;/usr/share/udhcpc/default.script&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Entries in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; for DHCP interfaces will drive the &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; command line. For example:&amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;auto eth0&lt;br /&gt;
iface eth0 inet dhcp&lt;br /&gt;
        hostname myhostname&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will set these parameters on the command line:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;-i eth0 -x hostname:myhostname&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The hostname will send the DHCP option to the server to tell the server the name of this client.&lt;br /&gt;
&lt;br /&gt;
The documentation for &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; can be found in [https://udhcp.busybox.net/README.udhcpc the busybox udhcpc readme file]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can add arbitrary command line parameters to use for &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;udhcpc_opts&amp;lt;/code&amp;gt; setting in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt;. See the example in [[Configure Networking#IPv4 DHCP Configuration|the main networking article]].&lt;br /&gt;
&lt;br /&gt;
Its default configuration may be overwritten by &amp;lt;code&amp;gt;/etc/udhcpc/udhcpc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Authorized key:value pairs are:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;15&amp;quot; border=&amp;quot;1&amp;quot; class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! key&lt;br /&gt;
| default value&lt;br /&gt;
| possible values&lt;br /&gt;
|-&lt;br /&gt;
| NO_GATEWAY&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;list of iface names&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| IF_METRIC&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;metric value&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| IF_PEER_DNS&lt;br /&gt;
| yes&lt;br /&gt;
| &amp;lt;anything but yes&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| RESOLV_CONF&lt;br /&gt;
| /etc/resolv.conf&lt;br /&gt;
| no ; NO ; -&lt;br /&gt;
|-&lt;br /&gt;
| NO_DNS&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;list of iface names&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example &amp;lt;code&amp;gt;/etc/udhcpc/udhcpc.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 RESOLV_CONF=&amp;quot;no&amp;quot; # Prevents overwriting of /etc/resolv.conf&lt;br /&gt;
&lt;br /&gt;
Custom scripts can be added as &amp;lt;code&amp;gt;/etc/udhcpc/pre-*&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/etc/udhcpc/post-*&amp;lt;/code&amp;gt; to be run before/after deconfig/renew/bound DHCP events. They must be set as &#039;&#039;&#039;executable&#039;&#039;&#039; by root, e.g. &amp;lt;code&amp;gt;chmod 744&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an example, &amp;lt;code&amp;gt;/etc/udhcpc/post-bound/mtu&amp;lt;/code&amp;gt; could contain, to change the interface MTU from the default (1500) to 1492, which is useful if [https://en.wikipedia.org/wiki/Maximum_transmission_unit on ADSL that uses PPPoE] (which uses 8 bytes for its own header):&lt;br /&gt;
&lt;br /&gt;
 r=$(/sbin/ip route | grep ^default | head -n 1)&lt;br /&gt;
 # Needs iproute2 package, rather than busybox&#039;s &amp;quot;ip&amp;quot;, to change mtu&lt;br /&gt;
 /sbin/ip route replace $r mtu 1492&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Hack alert:&amp;lt;/b&amp;gt;&lt;br /&gt;
I needed to restart my firewall (which replaces the &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt; script from Alpine) when the client binds to a new IP, so I added the following line in the function &amp;lt;code&amp;gt;bound()&amp;lt;/code&amp;gt;, right after &#039;&amp;lt;code&amp;gt;resolvconf&amp;lt;/code&amp;gt;&#039;:&lt;br /&gt;
&lt;br /&gt;
  /etc/init.d/iptables reload&lt;br /&gt;
&lt;br /&gt;
The reload drops all firewall rules, re-acquires the Internal and external IPs, and re-writes the rules. I&#039;m sure there is a better way.&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Embedded Systems]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Udhcpc&amp;diff=20747</id>
		<title>Udhcpc</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Udhcpc&amp;diff=20747"/>
		<updated>2021-12-09T13:12:26Z</updated>

		<summary type="html">&lt;p&gt;Rakslice: Cleaned up the formatting; clarified ADSL; some rewording for clarity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Expand|Please help us expand this article by contributing.}}&lt;br /&gt;
&lt;br /&gt;
You may want to customize the behavior of the default DHCP client (&amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; from busybox), which is called by &amp;lt;code&amp;gt;/sbin/ifup&amp;lt;/code&amp;gt; by having &amp;quot;&amp;lt;code&amp;gt;dhcp&amp;lt;/code&amp;gt;&amp;quot; in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The default behavior is driven by the script &amp;lt;code&amp;gt;/usr/share/udhcpc/default.script&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Entries in &amp;lt;code&amp;gt;/etc/network/interfaces&amp;lt;/code&amp;gt; for DHCP interfaces will drive the &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; command line. For example:&amp;lt;br&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;auto eth0&lt;br /&gt;
iface eth0 inet dhcp&lt;br /&gt;
        hostname myhostname&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will set these parameters on the command line:&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;-i eth0 -x hostname:myhostname&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The hostname will send the DHCP option to the server to tell the server the name of this client.  &lt;br /&gt;
&lt;br /&gt;
The documentation for &amp;lt;code&amp;gt;udhcpc&amp;lt;/code&amp;gt; can be found in [https://udhcp.busybox.net/README.udhcpc the busybox udhcpc readme file]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Its default configuration may be overwritten by &amp;lt;code&amp;gt;/etc/udhcpc/udhcpc.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Authorized key:value pairs are:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;15&amp;quot; border=&amp;quot;1&amp;quot; class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! key&lt;br /&gt;
| default value&lt;br /&gt;
| possible values&lt;br /&gt;
|-&lt;br /&gt;
| NO_GATEWAY&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;list of iface names&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| IF_METRIC&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;metric value&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| IF_PEER_DNS&lt;br /&gt;
| yes&lt;br /&gt;
| &amp;lt;anything but yes&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| RESOLV_CONF&lt;br /&gt;
| /etc/resolv.conf&lt;br /&gt;
| no ; NO ; -&lt;br /&gt;
|-&lt;br /&gt;
| NO_DNS&lt;br /&gt;
| -&lt;br /&gt;
| &amp;lt;list of iface names&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Example &amp;lt;code&amp;gt;/etc/udhcpc/udhcpc.conf&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 RESOLV_CONF=&amp;quot;no&amp;quot; # Prevents overwriting of /etc/resolv.conf&lt;br /&gt;
&lt;br /&gt;
Custom scripts can be added as &amp;lt;code&amp;gt;/etc/udhcpc/pre-*&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/etc/udhcpc/post-*&amp;lt;/code&amp;gt; to be run before/after deconfig/renew/bound DHCP events. They must be set as &#039;&#039;&#039;executable&#039;&#039;&#039; by root, e.g. &amp;lt;code&amp;gt;chmod 744&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As an example, &amp;lt;code&amp;gt;/etc/udhcpc/post-bound/mtu&amp;lt;/code&amp;gt; could contain, to change the interface MTU from the default (1500) to 1492, which is useful if [https://en.wikipedia.org/wiki/Maximum_transmission_unit on ADSL that uses PPPoE] (which uses 8 bytes for its own header):&lt;br /&gt;
&lt;br /&gt;
 r=$(/sbin/ip route | grep ^default | head -n 1)&lt;br /&gt;
 # Needs iproute2 package, rather than busybox&#039;s &amp;quot;ip&amp;quot;, to change mtu&lt;br /&gt;
 /sbin/ip route replace $r mtu 1492&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Hack alert:&amp;lt;/b&amp;gt;&lt;br /&gt;
I needed to restart my firewall (which replaces the &amp;lt;code&amp;gt;iptables&amp;lt;/code&amp;gt; script from Alpine) when the client binds to a new IP, so I added the following line in the function &amp;lt;code&amp;gt;bound()&amp;lt;/code&amp;gt;, right after &#039;&amp;lt;code&amp;gt;resolvconf&amp;lt;/code&amp;gt;&#039;:&lt;br /&gt;
&lt;br /&gt;
  /etc/init.d/iptables reload&lt;br /&gt;
&lt;br /&gt;
The reload drops all firewall rules, re-acquires the Internal and external IPs, and re-writes the rules. I&#039;m sure there is a better way.&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Embedded Systems]]&lt;/div&gt;</summary>
		<author><name>Rakslice</name></author>
	</entry>
</feed>