Cannot connect bluetooth keyboard

I recently bought a bluetooth keyboard, and having had bad experience with anything bluetooth + desktop linux in the recent past (e.g. my bluetooth mouse has constant glitches so I went back to a 2.4G dongle wireless mouse), I wouldn’t have bought it if I didn’t need it for an android tablet as well.

Keyboard model: Dierya DK61

Anyways, I originally managed to connect it to the laptop, not without issues, and it worked fine for a week or two. Eventually, something happened, not sure what, and now my laptop refuses to connect to the keyboard, like it was never paired, even though the keyboard seemingly still remembers the pairing. Here’s what happens when the keyboard turns on and tries to connect, as seen from bluetoothctl:

$ bluetoothctl 
Agent registered
[CHG] Controller 18:1D:EA:14:68:6E Pairable: yes
[CHG] Device DC:2C:26:D3:81:63 Connected: yes
[CHG] Device DC:2C:26:D3:81:63 Connected: no
[CHG] Device DC:2C:26:D3:81:63 Connected: yes
[CHG] Device DC:2C:26:D3:81:63 Connected: no
[bluetooth]# 

Ok, so let’s try to pair this keyboard again from scratch:

[bluetooth]# agent on
Agent is already registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# scan on
Discovery started
[CHG] Controller 18:1D:EA:14:68:6E Discovering: yes

... several devices discovered, including the keyboard ...

[bluetooth]# pair DC:2C:26:D3:81:63
Attempting to pair with DC:2C:26:D3:81:63
[CHG] Device DC:2C:26:D3:81:63 Connected: yes
[agent] PIN code: 215955
Failed to pair: org.bluez.Error.AuthenticationCanceled

So, it shows me the pin, and no matter what I do, it times out and fails. I tried typing the pin in the keyboard, followed by Enter, but that makes no difference. Also worth noting is, the first time when it connected successfully, I never had to enter any pin, nor did I have to enter a pin to pair it with my android tablet.
Slightly different output with bt-agent as the agent (in a separate terminal) but no dice:

$ bt-agent
Agent registered
Default agent requested
Device: Dierya DK61 (DC:2C:26:D3:81:63)
Confirm pin code: 814240 (yes/no)? yes

It doesn’t matter if I say yes or no, it still times out:

[bluetooth]# pair DC:2C:26:D3:81:63
Attempting to pair with DC:2C:26:D3:81:63
[CHG] Device DC:2C:26:D3:81:63 Connected: yes
Failed to pair: org.bluez.Error.AuthenticationCanceled
[CHG] Device DC:2C:26:D3:81:63 Connected: no

I also tried forcing the pin to be 0000 with bt-agent, didn’t work.

I don’t know what else to try, help?

$ inxi -Fazc0
System:    Host: it8147 Kernel: 4.19.122-1-MANJARO x86_64 bits: 64 
           parameters: BOOT_IMAGE=/vmlinuz-4.19-x86_64 root=/dev/mapper/lvmpool-root rw 
           cryptdevice=UUID=5423ac60-8085-429b-b8b1-fe7b0d34a448:cryptroot:allow-discards quiet 
           rd.udev.log-priority=3 resume=/dev/mapper/lvmpool-swap 
           Desktop: i3 4.18.1 Distro: Manjaro Linux 
Machine:   Type: Laptop System: LENOVO product: 20L8SADA00 v: ThinkPad T480s serial: <filter> 
           Mobo: LENOVO model: 20L8SADA00 v: SDK0J40697 WIN serial: <filter> UEFI: LENOVO v: N22ET49W (1.26 ) 
           date: 09/13/2018 
Battery:   ID-1: BAT0 charge: 47.7 Wh condition: 48.6/57.0 Wh (85%) 
CPU:       Topology: Quad Core model: Intel Core i7-8650U bits: 64 type: MT MCP family: 6 model-id: 8E (142) 
           stepping: A (10) microcode: CA L2 cache: 8192 KiB 
           Speed: 800 MHz min/max: 400/4200 MHz Core speeds (MHz): 1: 803 2: 809 3: 801 4: 856 5: 804 6: 804 7: 845 
           8: 804 
           Vulnerabilities: Type: itlb_multihit status: KVM: Split huge pages 
           Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
           Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
           Type: meltdown mitigation: PTI 
           Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp 
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 
           mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling 
           Type: tsx_async_abort mitigation: Clear CPU buffers; SMT vulnerable 
Graphics:  Device-1: Intel UHD Graphics 620 driver: i915 v: kernel 
           Device-2: NVIDIA GP108M [GeForce MX150] driver: nvidia v: 440.82 
           Display: x11 server: X.Org 1.20.8 driver: modesetting,nvidia resolution: 1920x1080~60Hz, 1920x1200~60Hz 
           OpenGL: renderer: Mesa Intel UHD Graphics 620 (KBL GT2) v: 4.6 Mesa 20.0.6 
Audio:     Device-1: Intel Sunrise Point-LP HD Audio driver: snd_hda_intel 
           Sound Server: ALSA v: k4.19.122-1-MANJARO 
Network:   Device-1: Intel Ethernet I219-LM driver: e1000e 
           IF: enp0s31f6 state: down mac: <filter> 
           Device-2: Intel Wireless 8265 / 8275 driver: iwlwifi 
           IF: wlp61s0 state: up mac: <filter> 
           IF-ID-1: docker0 state: down mac: <filter> 
           IF-ID-2: vpn0 state: up speed: 10 Mbps duplex: full mac: N/A 
Drives:    Local Storage: total: 953.87 GiB used: 794.89 GiB (83.3%) 
           ID-1: /dev/nvme0n1 vendor: Toshiba model: N/A size: 953.87 GiB block size: physical: 512 B 
           logical: 512 B 
Partition: ID-1: / raw size: 928.00 GiB size: 912.44 GiB (98.32%) used: 794.61 GiB (87.1%) fs: ext4 dev: /dev/dm-1 
           ID-2: /boot raw size: 632.0 MiB size: 606.1 MiB (95.89%) used: 78.3 MiB (12.9%) fs: ext4 dev: /dev/dm-3 
           ID-3: swap-1 size: 24.00 GiB used: 177.0 MiB (0.7%) fs: swap swappiness: 4 (default 60) 
           cache pressure: 50 (default 100) dev: /dev/dm-2 
Sensors:   System Temperatures: cpu: 58.0 C mobo: N/A 
           Fan Speeds (RPM): cpu: 3367 
Info:      Processes: 321 Uptime: 1d 5h 31m Memory: 23.29 GiB used: 11.08 GiB (47.6%) Shell: zsh inxi: 3.0.37 

(Note: using inxi -Fazy as recommended by this post gives Error 10: Unsupported value: 0 for option: y)

So, long story short, it turns out it’s the keyboard. When the battery is low, instead of powering turning off or otherwise behaving properly, it just gives random issues like this one. Or maybe it just requires to be plugged into a charger for it to pair successfully (a bug in the kb’s firmware?).

Anyways, I’m going to mark this as solved, as the keyboard works quite nicely now.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.