Problems with BLE (Bluetooth low energy) and Sailfish

REPRODUCIBILITY: 100%
OS VERSION: 5.0.0.77
HARDWARE: Sony Xperia 10 III (XQ-BT52)
UI LANGUAGE: English
REGRESSION: No post found

DESCRIPTION:

BLE protocol devices like the logitech MX mechanical mini won't pair with sailfishOS phone

PRECONDITIONS:

Device running BLE protocol

STEPS TO REPRODUCE:

  1. Pair device

  2. Run bluetoothctl info ‘macaddress’ and make sure the device is connected, trusted, and is registered as an input-keyboard device (or whatever BLE protocol device you are connecting)

EXPECTED RESULT:

At this stage, the keyboard should work as an input device

ACTUAL RESULT:

Device does not work. It is not listed in /proc/bus/input/devices and bt_uhid_destroy: Invalid Argument errors are shown.

MODIFICATIONS:

No modifications

ADDITIONAL INFORMATION:

devel-su journalctl -f | grep -i hid

returns
profiles/input/hob-lib.c:uhit_destroy() bt_uhid_destroy: Invalid Argument
during pairing

1 Like

Hi there. I had a similar issue with the ProtoArc XK04 BLE keyboard. Interestingly, the keyboard connected successfully when starting the bluetoothd daemon manually after masking the systemd bluetooth service.

It turned out that the setting in /usr/lib/systemd/system/bluetooth.service: CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE

is a bit too restrictive (and does not apply probably when you manually start bluetoothd). So either try with manual bluetoothd, or try to change the variable CapabilityBoundingSet, e.g. via a conf file in /etc/systemd/system/bluetooth.service.d/ :

[Service]
CapabilityBoundingSet=
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_SYS_ADMIN CAP_MKNOD CAP_DAC_OVERRIDE CAP_SYS_RESOURCE CAP_IPC_LOCK

At least for me that works. Perhaps you dont need all of them. Did not check them one-by-one as of today.

6 Likes

That worked, thank you so much, this is awesome!

Now I no longer need a cable for my HP sliding PDA keyboard, retrofitted with BLE module!

Thanks, we’ll look into this and try to figure out what capabilities are actually needed.

Meanwhile, could you check if it helps to just change the capability set to

CapabilityBoundingSet=CAP_NET_RAW CAP_NET_ADMIN CAP_NET_BIND_SERVICE

As that CAP_NET_RAW is already included in the Bluez update that is in Sailfish 5.2

6 Likes

With your config it connects, but afterwards, I cannot input any characters.

1 Like

Found out that my keyboard does have BLE and was able to reproduce this.

It seems to be permission issue on the /dev/uhid, and with the following in the bluetooth.service it seems to work

CapabilityBoundingSet=CAP_NET_RAW CAP_NET_ADMIN CAP_NET_BIND_SERVICE
SupplementaryGroups=uhid
12 Likes

Works here as well. Where would you recommend setting this so that it’s upgrade-proof while waiting for 5.2 on Xperia 10 III ?

Since people are having issues with their smart watches with the new AAS BT support, I checked that at least the Suunto 5 (which I’ve been trying to connect) uses “Bluetooth Smart”, which in practice is BLE. So could this fix also the connection/pairing issues with smart watches using only BLE?

It’s not yet quite clear where we will fix this. The supplementary group probably can’t be added directly to the bluetooth.service, as that uhid group is not necessarily available on all devices. For now you can probably just put it the dropin file.

Quite unlikely, as this is mainly related to input devices.

5 Likes