Bluetooth support for Librem 5

When I unboxed my Librem 5 USA, one the first things I checked was the Bluetooth, as I bought a Twiddler one-handed keyboard as a companion tool. However, no Bluetooth was detected on the device. Could you guide me through how to debug and set up my Bluetooth, beyond what I’ve tried?

The solution may be similar to this reddit post on the Librem 15, where either I use proprietary firmware (which I’m fine with) or I purchase a dongle for my phone (less ideal, as it has the one USB-C one port). However, the developers manual seems to indicate that Bluetooth should be responding somewhat. Below are the steps I’ve tried. If it looks like an amateur approach to solving the problem: it is. I’m not familiar with how Bluetooth is set up on a normal machine, so I often don’t know what I’m looking at–just that it is different than what the articles were posting, so please be patient.

NOTE: I’d have screenshots to share where it would clarify what I was seeing, but the application for screenshots fails at taking any picture. I guess that is an issue for another post.

System information:

$uname -a
Linux irma 5.13.0-1-librem5 #1 SMP PREEMPT Thu Sep 23 02:52:40 PDT 2021 aarch64 GNU/Linux
  1. I checked the top drop-down menu for Bluetooth, and saw it was disabled (greyed/crossed out).
  2. I went into settings > Bluetooth. I saw that the button to activate was greyed, disabled. And the space where available devices would be said “No Bluetooth Found. Plug in a dongle to use Bluetooth”
  3. Confirmed that the external kill switches were all allowing access.
  4. Tried the commands found on this debug page for ubuntu (as a lot of the commands still apply to PureOS). I got the following results
$bluetoothctl --version
bluetoothctl 5.50

$hciconfig -a # Nothing showed

$bluetoothctl
Agent registered
[bluetooth]# show
No default controller available
[bluetooth]# devices
No default controller available
[bluetooth] quit

$rfkill list
0: mic-hks: microphone
	Soft blocked: no
	Hard blocked: no
1: wlan-hks: Wireless LAN
	Soft blocked: no
	Hard blocked: no
2: wwan-hks: Wireless WAN
	Soft blocked: no
	Hard blocked: no
3: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no
  1. I searched dpkg to see what bluetooth packages were already installed
purism@irma:~$ dpkg -l | grep -i blue
ii  bluez                                5.50-1.2~deb10u2                           arm64        Bluetooth tools and daemons
ii  bluez-obexd                          5.50-1.2~deb10u2                           arm64        bluez obex daemon
ii  gnome-bluetooth                      3.34.0+3436+git7019e38f-1pureos0           arm64        GNOME Bluetooth tools
ii  libbluetooth3:arm64                  5.50-1.2~deb10u2                           arm64        Library to use the BlueZ Linux Bluetooth stack
ii  libgnome-bluetooth13:arm64           3.34.0+3436+git7019e38f-1pureos0           arm64        GNOME Bluetooth tools - support library
ii  pulseaudio-module-bluetooth          13.0-5pureos+librem5.2                     arm64        Bluetooth module for PulseAudio sound server
  1. I found some commands to list hardware information and got the following results
$ lsmod | grep -i blue
bluetooth                655360    8 bnep,redpine_91x

$ ps -ef | grep hciattach
purism   3280    1291   0 12:41 pts/0    00:00:00 grep hciattach # essentially nothing, showing the command that I just ran

$sudo hciconfig hci0
Cant get device info: No such device

$ sudo dmesg --syslog | grep -i blue
[    5.167510] Bluetooth: Core ver 2.22
[    5.167622] Bluetooth: HCI device and connection manager initialized
[    5.167640] Bluetooth: HCI socket layer initialized
[    5.167648] Bluetooth: L2CAP socket layer initialized
[    5.167664] Bluetooth: SCO socket layer initialized
[    7.933969] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    7.934009] Bluetooth: BNEP socket layer initialized
  1. I tried checking the status of /etc/init.d/bluetooth and it seems to be working fine:
sudo /etc/init.d/bluetooth status -l
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2021-10-10 23:11:40 MDT; 42min ago
	 Docs: man:bluetoothd(8)
 Main PID: 653 (bluetoothd)
   Status: "Running"
	Tasks: 1 (limit: 3182)
   Memory: 2.2M
   CGroup: /system.slice/bluetooth.service
		   └─653 /usr/lib/bluetooth/bl…

Oct 10 23:11:40 irma systemd[1]: Start…
Oct 10 23:11:40 irma bluetoothd[653]: ...
Oct 10 23:11:40 irma systemd[1]: Start…
Oct 10 23:11:40 irma bluetoothd[653]: ...
Oct 10 23:11:40 irma bluetoothd[653]: ...
Hint: Some lines were ellipsized, use -l to show in full.
  1. Finally, I reviewed the FAQ on Bluetooth (question 24, is bluetooth 5.0 supported?) and saw that general Bluetooth should already be supported.

Any thoughts? Any additional details needed? Thanks in advance for the help!

1 Like

Sounds similar to: Bluetooth not found but service runs no default controller

Bluetooth worked out-of-the-box for me (keyboard and speakers).

You don’t need proprietary firmware in the way that the laptops need it.

I suggest you contact Purism support directly.

3 Likes

For me bluetooth isn’t detected either. In system settings it says No Bluetooth Found Plug in a dongle to use Bluetooth.

I will contact support@puri.sm

2 Likes

I think @irvinewade is spot on this this if I had to guess. If you look at this topic that I created(Which @irvinewade pointed to) I had the same type of issue with the USA Librem. Bluetooth not found but service runs no default controller It turned out that the firmware was getting deleted at some point. So I literally created the firmware directory and downloaded & moved that firmware in that folder and since then all has been good. So I wonder what you get if you run ls -lahtr /lib | grep -i firmware If there is no firmware folder there then that’s it. But you might want to reach out to support as mentioned. I was chatting witth them for a couple weeks and they were responsive.

2 Likes

ls -lahtr /lib | grep -i firmware will never print out anything, because /lib is a symlink to usr/lib; one must use ls -laL /lib | grep ....

Said that, in my case the grep -i firmware does not give any hit. In which directory should I place which content?

1 Like

Ah right… yes I gave the wrong flags. You are the guru though so well done. If you read through that post that both myself and @irvinewade linked to you could see what we both did which is

> > > > > > 1.  first command:
> > > > > >
> > > > > >     wget https://source.puri.sm/angus.ainslie/firmware-rs9116-nonfree/-/raw/debian/master/Firmware/RS9116_NLINK_WLAN_BT_IMAGE.rps
> > > > > >
> > > > > > 2.  second command:
> > > > > >
> > > > > >     sudo mv -t /lib/firmware RS9116_NLINK_WLAN_BT_IMAGE.rps
> > > > > >
> > > > > > 3.  reboot the phone.

We both created the firmware folder under the /lib dir and moved the downloaded firmware there.

Yes, after downloading, putting the firmware in place and reboot, BT works now. Thanks.

2 Likes

Sweet! I was pulling my hair out for a few weeks trying to grok the problem. Glad it works for you now.

1 Like

On problem remains: The System Settings --> Bluetooth dialog window has a slider to switch BT off and on. If you switched it off, you can’t get it working again (i.e. scanning) without a restart.

My librem5 has a similar issue with bluetooth, so I’ve already put the mentioned firmware file at /lib/firmware. I’m already in contact with purism support about it:

  • Most of the times I (re)boot the phone WIFI is not shown at all, and bluetooth just for a short time, then (after 10 seconds or so) both WIFI and bluetooth are shown as “not available” (greyed out and inactive)
  • After some boots both bluetooth and WIFI are available and WIFI works without problems.
  • I was able to connect to 3 different audio devices (one at a time) with bluetooth and play audio successfully.
    But: As soon I connect a bluetooth device, I can no longer transfer any data (e.g. download an internet page) via WIFI.
    Wifi then works again after some reboots
    Has anyone a similar issue ? Especially if you can e.g. stream audio of a web page to a bluetooth device.

I face: when BT is on and scanning Wifi is not working anymore and I have to restart with BT off to get Wifi working again.

I’ve filed a bug issue: https://source.puri.sm/Librem5/linux-next/-/issues/358
You might vote for it.

3 Likes

ok thank you !
For my other issue (not WIFI / BT on boot) I use the following workaround now:

  • Reboot the phone until WIFI / BT is active
  • switch bluetooth off in the top menu (striked through white BT symbol)

Now the WIFI comes up on almost every boot, and BT keeps being switched off (software wise)

To clarify one point: I have never had a problem with BT and I did not myself do those commands.

Both WiFi and BT are on for me at boot and thereafter, and work, and work in essentially concurrent use e.g. I can visit a web form on the internet via WiFi, complete the form using my BT keyboard and submit the form and get results - and have an ssh session from the local LAN via WiFi into the Librem 5 at the same time for good measure.

However I am still on amber. I suspect things might have gone backwards somewhere in byzantium.

I don’t even have a firmware directory (which is why you have to create it before you put a file in there).

The one thing I will say is that I am not switching either WiFi or BT off in software. If I switch off, it is via the kill switch when I go out (which should cut power to the card and make both of them go away).

I don’t know whether using the kill switch will be effective and less hassle in order to keep retrying if either WiFi or BT are not functional when they should be.

I rebooted with BT switched ON before. I can SSH into the L5 and also run a ping from inside to some Internet host. In the moment when I enter System Setting --> Bluetooth both (SSH and ping) stop working and System Setting --> Bluetooth show a page with one BT device nearby (my other mobile) and a rotating circle right to the word Devices. Also new devices are presented or deleted from the table when they switch on or off BT. Should it stop rotating at some point?

In any case, this makes BT pretty much useless for me.

I’m not sure that it should. When a new device appears can you touch it on the screen in order to pair?

Yes, it connects with the other mobile and says on both devices connected. It paired already yesterday, so they know each other. A new device gets paired and connected fine.

Then perhaps it is working as it should i.e. discovery is an ongoing (never finishing) process.

According to https://puri.sm/posts/hard-not-soft-kill-switches/ it is actually the radio that gets disabled, not the power that gets cut:

With the HKS in the +3.3 Volt position, pins 54 and 56 in the M.2 NGFF connector will receive a HIGH voltage, and the radios on the WiFi card will be turned OFF. With the HKS in the Ground (GND) position, pins 54 and 56 will receive a LOW voltage, and the radios will be turned ON.

Does the WIFI/BT HKS work in a different way on the Librem 5?

Does the L5, i.e. Debian, writes somewhere something like /var/log/syslog or /var/log/messages?

I catched the new lines produced by dmesg when I go to Systems Settings --> Bluetooth and the Wifi stops working:

[   59.400703] redpine_91x: EAPOL 4 confirm
[   59.507251] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[  251.077616] edt_ft5x06 2-0038: Unable to fetch data, error: -6

now we go the ...Bluetooth

[ 1888.269822] redpine_91x: RSI `hci0' flush
[ 1888.269858] redpine_91x: RSI HCI DEVICE "hci0" closed
[ 1888.269864] redpine_91x: rsi_hci_close: device `hci0' not running

Does this ring someone’s bell?