I installed NixOS on a 4Gb Raspberry Pi 4 and can’t get bluetooth and audio (that’s two issues, not a single issue about a bluetooth audio device). Had no issues running another system so no reason to suspect any kind of hardware fault.
For the install, I basically followed this, execept that I fetch the master branch from git.
# bluetoothctl
Agent registered
[bluetooth]# power on
No default controller available
[bluetooth]# devices
No default controller available
# rfkill
ID TYPE DEVICE SOFT HARD
0 wlan phy0 unblocked unblocked
# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 046d:c315 Logitech, Inc. Classic Keyboard 200
Bus 001 Device 003: ID 046d:c00f Logitech, Inc. MouseMan Traveler/Mobile
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
# lspci
00:00.0 PCI bridge: Broadcom Inc. and subsidiaries BCM2711 PCIe Bridge (rev 10)
01:00.0 USB controller: VIA Technologies, Inc. VL805/806 xHCI USB 3.0 Controller (rev 01)
# dmesg | grep -i blue
[ 10.708661] Bluetooth: Core ver 2.22
[ 10.708726] Bluetooth: HCI device and connection manager initialized
[ 10.708742] Bluetooth: HCI socket layer initialized
[ 10.708749] Bluetooth: L2CAP socket layer initialized
[ 10.708761] Bluetooth: SCO socket layer initialized
# lsmod | grep blue
bluetooth 667648 1 btsdio
ecdh_generic 16384 1 bluetooth
rfkill 45056 5 bluetooth,cfg80211
# lsmod | grep bt
btsdio 20480 0
bluetooth 667648 1 btsdio
Audio
Tried a bunch of things in configuration.nix, I don’t notice any difference whether the firmwareConfig line is there or not:
I only get a single bar in alsamixer. Only sound card it shows is default. I’m not very aware of sound issues, let me know what kind of ouput I can provide.
I’ve tried including the configuration from the linked issue, it does allow the bluetooth device to be found by rfkill and dmesg got more talkative. I still don’t have anything in bluetoothctl.
If I’m understanding correctly what’s said in the issue, the problem is from recent kernels, but I have downgraded to this commit and this one, and none seemed to display a different behaviour.
Here is how I downgraded kernels, it seemed to work but I not really sure of what I’m doing:
The firmware does some manipulation before passing the device tree to the kernel. One thing it does is configure bluetooth flow control pins. So, I have fixed the bluetooth issue in the past by creating an overlay that mimics the firmware manipulation. Something like:
// Configure uart0 pins so that bluetooth works
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2835";
fragment@0 {
target = <&uart0_pins>;
__overlay__ {
brcm,pins = <30 31 32 33>;
brcm,pull = <2 0 0 2>;
};
};
};
It is tedious and error prone to maintain these patches. So, more recently I have pursued using the device tree that the firmware provides (using u-boot’s CONFIG_OF_BOARD option) rather than trying to mimic the manipulation. This approach has worked well for me.
I packaged up this approach here and an example with working bluetooth can be found here.