gpio_keys_device - notro/fbtft_tools GitHub Wiki
gpio_keys_device is a kernel module for registering a gpio_keys device.
Usage
modprobe gpio_keys_device arguments
Keys argument
This is a comma separated list of keys. Each key can have several configuration values. If values are left out, the default is used.
gpio and code is required.
Format: gpio:code:type:active_low:debounce_interval:can_disable:value:wakeup:irq
Example setting debounce_interval: 23:108:::10
- gpio
GPIO number - code
input event code (KEY_, SW_)
Find values under the Keys and buttons heading in include/uapi/linux/input-event-codes.h - type
input event type (EV_KEY=1, EV_SW=5, EV_ABS=3) - active_low
The key is active LOW. HIGH is the default. - debounce_interval
debounce ticks interval in msecs - can_disable
Key can be disabled - value
axis value for EV_ABS - wakeup
configure the button as a wake-up source - irq
Use to override default irq (not used by polled driver)
Other arguments
- poll_interval
polling interval in msecs - for polling driver only (default=20) - repeat
enable input subsystem auto repeat - polled
use polled driver: gpio_keys_polled instead of interrupt driven: gpio_keys - active_low
Set active_low=1 as default - debounce_interval
Set default debounce_interval (default=5) - type
Set default event type (default=EV_KEY) - pullup
Enable internal pull up resistor for all (only on Raspberry Pi) - pulldown
Enable internal pull down resistor for all (only on Raspberry Pi) - verbose
0 - silent (default)
1 - print values to kernel log
2 - more output
3 - even more output
Example
Switches are active LOW and uses the internal pullup resistors. Keys is arrow keys and Enter key.
modprobe gpio_keys_device pullup active_low keys=23:103,17:108,18:105,21:106,22:28
References
- include/linux/gpio_keys.h
- drivers/input/keyboard/gpio_keys.c
- drivers/input/keyboard/gpio_keys_polled.c