Bluetooth keyboard/mouse issue on Alpine Linux

I’m using Alpine Linux with the following bluetooth related packages installed:

bluez-5.68-r1 x86_64 {bluez} (GPL-2.0-or-later AND BSD-2-Clause AND MIT) [installed]
bluez-btmgmt-5.68-r1 x86_64 {bluez} (GPL-2.0-or-later AND BSD-2-Clause AND MIT) [installed]
bluez-btmon-5.68-r1 x86_64 {bluez} (GPL-2.0-or-later AND BSD-2-Clause AND MIT) [installed]
bluez-doc-5.68-r1 x86_64 {bluez} (GPL-2.0-or-later AND BSD-2-Clause AND MIT) [installed]
bluez-firmware-1.2-r1 x86_64 {bluez-firmware} (GPL-2.0-or-later) [installed]
bluez-hid2hci-5.68-r1 x86_64 {bluez} (GPL-2.0-or-later AND BSD-2-Clause AND MIT) [installed]
bluez-libs-5.68-r1 x86_64 {bluez} (GPL-2.0-or-later AND BSD-2-Clause AND MIT) [installed]
bluez-openrc-5.68-r1 x86_64 {bluez} (GPL-2.0-or-later AND BSD-2-Clause AND MIT) [installed]
bluez-plugins-5.68-r1 x86_64 {bluez} (GPL-2.0-or-later AND BSD-2-Clause AND MIT) [installed]
pipewire-spa-bluez-0.3.74-r0 x86_64 {pipewire} (LGPL-2.1-or-later) [installed]

The bluetooth service is running and I’m also able to connect and use my bluetooth headphones using the command line utility bluetoothctl.

However, when it comes to HID devices (keyboard and mouse) they can be paired, connected and trusted but do not create any input when pressing a key or mouse movement.

To be specific the bluetooth connection of my keyboard shows:

device CE:FE:50:FA:F7:83 (random)
    Name: TEX-BLE-1
    Alias: TEX-BLE-1
    Appearance: 0x03c1 (961)
    Icon: input-keyboard
    Paired: yes
    Bonded: yes
    Trusted: yes
    Blocked: no
    Connected: yes
    LegacyPairing: no
    UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
    UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
    UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
    UUID: Battery Service           (0000180f-0000-1000-8000-00805f9b34fb)
    UUID: Human Interface Device    (00001812-0000-1000-8000-00805f9b34fb)
    Modalias: usb:v04D9p2521d0000
    Battery Percentage: 0x63 (99)

However absolutely no key registers when pressed. I tried the same keyboard and the mouse on a fresh install of Ubuntu where it works. They keyboard also works flawlessly via its USB-C connection. I’m guessing that I’m missing a package or a specific configuration option of the Bluetooth stack.

Asked By: Invarianz

||

After a lot of trial and error I was going through the Bluetooth guide at https://wiki.alpinelinux.org/wiki/Bluetooth again and found the error.
As mentioned at the bottom of the guide I installed hidapi and loaded the uhid kernel module.

apk add hidapi
modprobe uhid

After that I removed the keyboard from bluetoothctl and paired it again. Now keys register.
To make the changes permanent I added the module uhid to /etc/modules.

Now the keyboard works even after a restart.

Answered By: Invarianz