Bluetooth: Difference between revisions
Cleanup |
Restructure page |
||
| Line 33: | Line 33: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | == Troubleshooting == | ||
=== Using Bluetooth headsets with PulseAudio === | |||
To allow Bluetooth audio devices to be used with [[PulseAudio]], amend <tt>/etc/nixos/configuration.nix</tt> as follows: | To allow Bluetooth audio devices to be used with [[PulseAudio]], amend <tt>/etc/nixos/configuration.nix</tt> as follows: | ||
| Line 48: | Line 49: | ||
You can verify that PulseAudio has loaded the Bluetooth module by running <tt>pactl list | grep -i 'Name.*module.*blue'</tt>; Bluetooth modules should be present in the list. | You can verify that PulseAudio has loaded the Bluetooth module by running <tt>pactl list | grep -i 'Name.*module.*blue'</tt>; Bluetooth modules should be present in the list. | ||
== Using Bluetooth headset buttons to control media player == | === Using Bluetooth headset buttons to control media player === | ||
Some bluetooth headsets have buttons for pause/play or to skip to the next track. | Some bluetooth headsets have buttons for pause/play or to skip to the next track. | ||
To make these buttons usable with media players supporting the dbus-based [https://specifications.freedesktop.org/mpris-spec/latest/ MPRIS] standard, | To make these buttons usable with media players supporting the dbus-based [https://specifications.freedesktop.org/mpris-spec/latest/ MPRIS] standard, | ||
| Line 66: | Line 66: | ||
Or, starting with Home Manager 21.05, enable the <code>mpris-proxy</code> service. | Or, starting with Home Manager 21.05, enable the <code>mpris-proxy</code> service. | ||
===System-Wide PulseAudio === | ==== System-Wide PulseAudio ==== | ||
{{Expansion|When setting up pulseaudio systemWide extra policies needs to be deployed for pulse to be able to connect to the bluetooth stack. The Info below is not enough.}} | {{Expansion|When setting up pulseaudio systemWide extra policies needs to be deployed for pulse to be able to connect to the bluetooth stack. The Info below is not enough.}} | ||
| Line 82: | Line 82: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
===Enabling extra codecs=== | ==== Enabling extra codecs ==== | ||
While pulseaudio itself only has support for the SBC bluetooth codec there is out-of-tree support for AAC, APTX, APTX-HD and LDAC. | While pulseaudio itself only has support for the SBC bluetooth codec there is out-of-tree support for AAC, APTX, APTX-HD and LDAC. | ||
| Line 97: | Line 97: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
===Enabling A2DP Sink=== | ==== Enabling A2DP Sink ==== | ||
Modern headsets will generally try to connect using the A2DP profile. To enable this for your bluetooth connection, add the following to <tt>/etc/nixos/configuration.nix</tt> | Modern headsets will generally try to connect using the A2DP profile. To enable this for your bluetooth connection, add the following to <tt>/etc/nixos/configuration.nix</tt> | ||
| Line 111: | Line 111: | ||
This configuration may be unnecessary and does not work with bluez5 (<tt>Unknown key Enable for group General</tt> ). | This configuration may be unnecessary and does not work with bluez5 (<tt>Unknown key Enable for group General</tt> ). | ||
===Managing audio devices=== | ==== Managing audio devices ==== | ||
<tt>pavucontrol</tt> can be used to reconfigure the device: | <tt>pavucontrol</tt> can be used to reconfigure the device: | ||
* To enable A2DP, change the profile to “High Fidelity Playback (A2DP Sink)” on the “Configuration” tab. | * To enable A2DP, change the profile to “High Fidelity Playback (A2DP Sink)” on the “Configuration” tab. | ||
| Line 134: | Line 133: | ||
Note that you may need to clear the pulseaudio config located at ~/.config/pulse to get this to work. Also you may have to unset and then set the default audio device to the bluetooth device, see https://github.com/NixOS/nixpkgs/issues/86441 for more info | Note that you may need to clear the pulseaudio config located at ~/.config/pulse to get this to work. Also you may have to unset and then set the default audio device to the bluetooth device, see https://github.com/NixOS/nixpkgs/issues/86441 for more info | ||
==Showing battery charge of bluetooth devices== | === Showing battery charge of bluetooth devices === | ||
If you want to see what charge your bluetooth devices have you have to enable experimental features, which might lead to bugs (according to [https://wiki.archlinux.org/title/Bluetooth_headset#Battery_level_reporting Arch Wiki). You can add the following to your config to enable experimental feature for bluetooth: | If you want to see what charge your bluetooth devices have you have to enable experimental features, which might lead to bugs (according to [https://wiki.archlinux.org/title/Bluetooth_headset#Battery_level_reporting Arch Wiki). You can add the following to your config to enable experimental feature for bluetooth: | ||
<syntaxhighlight lang="nix">{ | <syntaxhighlight lang="nix">{ | ||
| Line 145: | Line 144: | ||
... | ... | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
Afterwards rebuild your system and then restart your bluetooth service by executing <syntaxhighlight lang="console">$ systemctl restart bluetooth</syntaxhighlight> | Afterwards rebuild your system and then restart your bluetooth service by executing <syntaxhighlight lang="console">$ systemctl restart bluetooth</syntaxhighlight> | ||
==Troubleshooting== | ==Troubleshooting== | ||
===USB device needs to be unplugged/re-plugged after suspend=== | ===USB device needs to be unplugged/re-plugged after suspend=== | ||