beepy-ppa

Beepy Keyboard Driver

User Guide

The Beepy keyboard driver, beepy-kbd, controls interaction between the RP2040 firmware beepy-fw and Linux running on the Raspberry Pi. It has several responsibilities, including

Indicators

Due to the limited number of keys, there are different shortcuts and modes mapped by the keyboard driver. You will see different types of indicators in the top right corner of the screen depending on the mode:

Basic key mappings

From left to right, the top row of the Beepy keyboard has the following keys:

The alternate symbols printed directly on the keys are sent by pressing the Physical Alt key on the bottom left corner of the keyboard, then pressing the key on which the desired symbol is printed. While Physical Alt is active, you will see an a indicator in the top right corner of the screen: Physical Alt indicator. The combination Physical Alt + Enter is also mapped to Tab. Physical Alt is a “sticky modifier key”.

For additional symbols not printed directly on the keys, use the Symbol key on the bottom row of the keyboard. While Symbol is active, you will see an S indicator in the top right of the screen: Symbol indicator. Internally, Symbol sends AltGr (Right Alt), which is mapped to more symbols via the keymap file at /usr/share/kbd/keymaps/beepy-kbd.map. Symbol is a “sticky modifier key”. You can view the Symbol key map by holding the Symbol key for 1 second. Modifying the keymap file will also update the Symbol key map displayed; below is the default key map:

Default Symbol key map

Arrow keys and other movement keys such as Page Up and Page Down are accessible in Meta mode.

Sticky modifier keys

For easier typing, the keyboard driver implements sticky modifier keys. Pressing and releasing a modifier applies the modifier to the next alpha keypress only. If the same modifier key is pressed and released again, it will be canceled.

Holding a modifier key while typing an alpha key will apply the modifier to all alpha keys until the modifier is released.

While a modifier key is active, visual indicators are drawn in the top right corner of the display, with indicators for Shift indicator Shift, Physical Alt indicator Physical Alt, Control indicator Control, Alt indicator Alt, Symbol indicator Symbol, Meta mode indicator Meta mode, and Touchpad mode indicator Touchpad mode.

For example, to type a dot ., you can use Physical Alt sticky mode:

Alternatively, to type a dot . followed by a comma ,, you can also press and hold Physical Alt:

Meta mode

Meta mode is a modal layer that assists in rapidly moving the cursor and scrolling with single keypresses. To enter Meta mode, click the Berry key once. The Meta mode indicator Meta mode indicator will appear in the top right corner of the screen, and the following keymap will be applied until Meta mode is dismissed using the Back key, or otherwise noted:

Typing any other key while in Meta mode will exit Meta mode and send the key as if it was typed normally.

You can view the Meta mode key map by holding the Berry key for 1 second:

Meta mode key map

Touchpad mode

The Beepy touchpad is not actually touch sensitive, rather it is an optical trackpad. This has the downside of sending touchpad input if material other than a finger moves across it, such as a pocket. To reduce false positives, the default mode of the Beepy touchpad is to remain off until a key is used to turn it on. Touchpad behavior, including mouse and activation, can be configured via module parameters.

Press the touchpad itself to turn on touchpad mode, and start sending arrow keys when you move your finger across the touchpad. While active, you will see the touchpad indicator Touchpad indicator in the top-right corner of the screen.

Clicking the touchpad itself again while the touchpad is active will send Enter. Pressing the Back key will exit touchpad mode.

You can also hold the Shift key to temporarily turn on the touchpad until the Shift key is released. You will see the Shift indicator Shift indicator instead of the touch indicator.

If you release the Shift key without using the touchpad, you will instead get the sticky modifier behavior of applying Shift to the next alpha keypress. In this case, the Shift indicator will remain on the screen. Press and release the Shift key again to un-stick the modifier and hide the indicator.

sysfs interface

The keyboard driver creates several sysfs entries under /sys/firmware/beepy to expose different parts of the firmware. These entries can be manipulated like a normal file using traditional Unix tools such as cat and tee, and in shell scripts.

Module parameters

Configure various aspects of the driver itself. Write to /sys/module/beepy_kbd/parameters/<param> to set with echo <val> | sudo tee /sys/module/beepy_kbd/parameters/<param>. Or unload and reload the module with sudo modprobe -r beepy-kbd; sudo modprobe beepy-kbd param=val.

Custom keymap

The Physical Alt and Symbol keymaps and the Tmux prefix sent by the Berry key can be edited in the file /usr/share/kbd/keymaps/beepy-kbd.map. To reapply the keymap without rebooting, run loadkeys /usr/share/kbd/keymaps/beepy-kbd.map.

Holding the Symbol key to display the keymap will display the keymap directly from this file.

Developer Reference

Building from source

To remove, run sudo make uninstall, then verify that /etc/modules and /boot/firmware/config.txt have removed the driver lines.

Direct write firmware updates

In most cases, you will use the update-beepy-fw utility to update firmware from a firmware package or file. However, you can also manually write firmware update data to the sysfs entry at /sys/firmware/beepy/fw_update.

RP2040 firmware is loaded in two stages. The first stage is a modified version of pico-flashloader. It allows updates to be flashed to the second stage firmware while booted. The second stage is the actual Beepy firmware.

Firmware updates are flashed by writing to /sys/firmware/beepy/fw_update:

Please wait until the system reboots on its own before removing power. If the update failed, will contain an error code and the firmware will not be modified.

The header line +... will reset the update process, so an interrupted or failed update can be retried by restarting the firmware write.

If the update completes successfully, the system will be rebooted. There is a delay configurable at /sys/firmware/beepy/shutdown_grace to allow the operating system to cleanly shut down before the Pi is powered off. The firmware is flashed right before the Pi boots back up, so please wait until the system reboots on its own before removing power.