linux gpio_keys driver


linux gpio_keys driver


source:
drivers/input/keyboard/gpio_keys.c


documentation:
Documentation/devicetree/bindings/input/gpio-keys.txt



example,dts config:

	gpio_keys {
		compatible = "gpio-keys";
		input-name = "gpio-keys";
		pinctrl-names = "default";
		pinctrl-0 = <&gpio_keys_default>;

		key_1 {
			label = "key_1";
			gpios = <&gpio 07 GPIO_ACTIVE_HIGH>;
			linux,input-type = <1>;
			linux,code = <0x01>; /* KEY_1 */
			gpio-key,wakeup;
			debounce-interval = <15>;
		};
	};


debug log:

[root]# hexdump /dev/input/event0 
[   49.799309] gpio_keys_gpio_report_event() key code:1, state:0
0000000 0031 0000 2536 000c 0001 0001 0000 0000
0000010 0031 0000 2536 000c 0000 0000 0000 0000

[   52.139315] gpio_keys_gpio_report_event() key code:1, state:1
0000020 0034 0000 1319 0002 0001 0001 0001 0000
0000030 0034 0000 1319 0002 0000 0000 0000 0000

[root]#


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM