How to use a Bluetooth keyboard in BIOS/FileVault

Published: Fri Nov 15 2024

Category: Hardware

Usually, a Bluetooth connected keyboard cannot be used in the BIOS or FileVault unlocking screen.

I looked for a way to bypass this, but the only way I could find was to use a feature called HID Proxy.

This article explains how to use the Bluetooth connected keyboard in the BIOS and FileVault password entry screen with the HID Proxy.

How it works

Raspberry Pi Zero W receives keyboard input via Bluetooth. Then, Raspberry Pi Zero W acting as a virtual keyboard transmits the input to the computer via USB.

Virtual Keyboard

Requirements

  • Raspberry Pi Zero W
  • A USB cable to connect Raspberry Pi with your computer

Instructions

  1. Add the required options
    echo "dtoverlay=dwc2" | sudo tee -a /boot/config.txt
    echo "dwc2" | sudo tee -a /etc/modules
    echo "libcomposite" | sudo tee -a /etc/modules
    
  2. Pair your keyboard with Raspberry Pi Zero W
  3. Clone and install Quimby, A Bluetooth-USB HID Proxy by Danny Robson
    git clone https://gitlab.com/dcro/quimby.git
    cd quimby
    sudo apt install python3-evdev
    sudo cp quimby-* /usr/local/bin/
    sudo cp udev/quimby.rules /etc/udev/rules.d/
    sudo cp systemd/system/quimby.service /usr/lib/systemd/system/
    
  4. Reboot your Raspberry Pi
    sudo reboot
    

In the case of my keyboard (HHKB), there are unique specifications. “/dev/input/event0” is the common keystroke input and “/dev/input/event1” is a special key for media control etc.

HHKB

Apple’s Magic Keyboard 2 is treated as a single input device like normal, so this may be a specification specific to HHKB.

Therefore, I added /dev/input/event1 to the -i option for the ExecStart argument in /usr/lib/systemd/system/quimby.service .

[Unit]
Description=Quimby Input Forwarder
Requires=bluetooth.service
[Service]
Type=simple
ExecStartPre=/usr/local/bin/quimby-setup quimby
ExecStart=/usr/local/bin/quimby-relay -i /dev/input/event0 -i /dev/input/event1 -k /dev/hidg0 -c /dev/hidg1
ExecStop=/usr/local/bin/quimby-cleanup quimby

References

  • https://mlug-au.org/lib/exe/fetch.php?media=workshops:quimby_a_bluetooth-usb_hid_proxy.pdf
  • https://gitlab.com/dcro/quimby