参考:
1.https://ask.csdn.net/questions/767179
概述
按键信息上报是input系统里面一个最基本,最简单,也是最常用的功能.一般直接配置dts即可,但是也有可能有定制需求,比如自定义按键和上报特殊按键.
新增按键
内核已经实现了通用按键驱动,优先建议使用.
gpio_keys: gpio_keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&gpio_keys_sensor>;
#address-cells = <1>;
#size-cells = <0>;
button0 {
label = "Lhead";
linux,code = <0x101>; /*BTN_1*/
debounce-interval = <10>;
gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>;
};
button1 {
label = "Rhead";
linux,code = <0x102>; /*BTN_2*/