<title>Get a Bluetooth keyboard work with Arch Linux</title>
<description><p>I’ve recently got a Rapoo E6100. This is a minimal and space saving Bluetooth 3.0 keyboard. If you pair it with Windows 10, it will remain paired after reboot, giving the possibility to use it since the login screen. After installing the Bluetooth stack on my Arch via the <code class="highlighter-rouge">bluez</code> and <code class="highlighter-rouge">bluez-utils</code> packages I thought the pairing process would be as simple as Windows if I used the KDE GUI menus for Bluetooth management. That’s not true. The keyboard, once paired, will reconnect automatically just after <code class="highlighter-rouge">plasmashell</code> loaded, leaving me without keyboard during the SDDM login screen and, of course, during a non-graphical session.</p>
<p>As usual, i’ve searched help in the ArchWiki, founding <a href="https://wiki.archlinux.org/index.php/Bluetooth_keyboard">this</a> article. With that, i’ve succesfully reconnected my Bluetooth keyboard using the <code class="highlighter-rouge">bluetoothctl</code> utility. The next step was configuring the service for auto connection during boot. I’ve created the <code class="highlighter-rouge">btkbd.conf</code> and the <code class="highlighter-rouge">btkbd.service</code> files, enabling the last one with systemd. Let’s give a look to the service file:</p>
<span class="nv">Description</span><span class="o">=</span>systemd Unit to automatically start a Bluetooth keyboard
<p>Line 13 enables the Bluetooth dongle, and line 16 connects it to the keyboard we gave the mac address in <code class="highlighter-rouge">/etc/btkbd.conf</code>. This should work flawlessly, right? Of course it doesn’t. The service starts before the <code class="highlighter-rouge">dbus-org.bluez.service</code> is loaded and fails. However, if the service is started manually after login the Bluetooth keyboard works. After hours of trying figuring out what was wrong I’ve almost asked for a return on Amazon! The last attempt I made was with sddm disabled and involved built from scratch service:</p>
<span class="nv">Description</span><span class="o">=</span>systemd Unit to automatically start a Bluetooth keyboard
<p>This incredibly worked. I think the problem was that <code class="highlighter-rouge">multi-user.target</code> that needs to be reached earlier than <code class="highlighter-rouge">bluetooth.target</code>. I got rid of all the tidiness of the ArchWiki solution just to be sure that was not the problem, but I think you can use all of that just correcting <code class="highlighter-rouge">WantedBy=</code>. Currently I haven’t an ArchWiki account nor a forum one, but as soon as I’ll register I’ll correct the article.</p>
<p>Let me know in the comments if this solution is well made or if it’s just a bodge.
Last thing: I discovered that my Bluetooth dongle is CSR 8510 A10 based so expect some ramblings about <a href="http://www.0xf8.org/2014/02/the-crux-of-finding-a-hid-proxy-capable-usb-bluetooth-adapter/">hid proxy</a>.</p>