GPIOKEYS(4)
β¨ NAME β¨
okay bestie, meet gpiokeys β the GPIO keys device driver. This is the GPIOKEYS(4) page in the Kernel Interfaces Manual, and it's giving βtiny buttons, big keyboard energy.β π
π οΈ SYNOPSIS π οΈ
To compile this driver into the kernel, place the following lines in your kernel configuration file:
options FDT
device gpio
device gpiokeys
Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5):
gpiokeys_load="YES"
π DESCRIPTION π
The gpiokeys driver provides a way to represent a set of general purpose inputs as a keyboard(4) device. At the moment the driver supports only FDT(4) based systems. The DTS determines what pins are mapped to buttons and what key codes are generated for each virtual button. The keyboard(4) device can be used from userland to monitor for input changes.
On an FDT(4) based system the DTS part for a gpiokeys device usually looks like:
/ {
...
gpio_keys {
compatible = "gpio-keys";
btn1 {
label = "button1";
linux,code = <KEY_1>;
gpios = <&gpio 0 3 GPIO_ACTIVE_LOW>
};
btn2 {
label = "button2";
linux,code = <KEY_2>;
gpios = <&gpio 0 4 GPIO_ACTIVE_LOW>
};
};
};
For more details about the gpios property, please consult /usr/src/sys/dts/bindings-gpio.txt.
The gpiokeys driver supports two properties for specifying a key code.
freebsd,codeβ specifies a FreeBSD native scancode compatible withkbdmap(5)keyboard maps.linux,codeβ specifies an evdev scancode. That scancode is internally translated to a native scancode. Note that not all evdev scancodes have corresponding native scancodes. If a scancode cannot be translated, then a diagnostic message is printed and the input is ignored.
Other properties the driver knows about:
labelβ a descriptive name of a button. It is used for diagnostic messages only. This property is optional. If not set, the node name is used in its place.autorepeatβ determines whether autorepeat is enabled for a button.debounce-intervalβ defines debouncing interval time in milliseconds. If not specified the interval defaults to5.
π SEE ALSO π
π°οΈ HISTORY π°οΈ
The gpiokeys manual page first appeared in FreeBSD 12.2.
π«Ά AUTHORS π«Ά
The gpiokeys driver was written by Oleksandr Tymoshenko <gonzo@FreeBSD.org>. This manual page was written by Andriy Gapon <avg@FreeBSD.org>.
mwah π β footer tea: source/version Debian, date August 5, 2020, manual name GPIOKEYS(4); byeee bestie π«Άβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- π the page's license: BSD-2-Clause
- Copyright (c) 2020 Andriy Gapon <avg@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms