RK3568 GPIO 按键事件响应

目录

adb shell getevent查看事件

设备树添加事件驱动

cat查看事件详细内容


author daisy.skye的博客_CSDN博客-嵌入式,Qt,Linux领域博主

adb shell getevent查看事件

130|rk3568_r:/dev/input #
PS C:\Users\fujy> adb shell
rk3568_r:/ $ getevent
add device 1: /dev/input/event2
  name:     "jadard-touchscreen"
add device 2: /dev/input/event0
  name:     "fdd70030.pwm"
add device 3: /dev/input/event3
  name:     "adc-keys"
add device 4: /dev/input/event1
  name:     "rk805 pwrkey"

设备树添加事件驱动

设备树添加事件和驱动

相对路径 

kernel/arch/arm64/boot/dts/rockchip/ido-evb3568-v2b.dtsi

gpio_key:gpio-key {
			compatible = "gpio-keys";
			input-name = "gpio-keys";//compatible = "rockchip,key";
			status = "okay";

		menu-key {
			label = "menu";
			linux,code = <KEY_MENU>;
			linux,input-type = <1>;//input类型 按键 即1
			gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>;
			gpio-key,wakeup;//唤起系统
			debounce-interval = <15>;//gpio按键的去抖动时间
		};
        //省略其他按键的参数,格式一致具体内容不同
}

设备树添加事件驱动后,adb shell 中getevent增加了一个gpio-key 事件

rk3568_r:/ $ getevent
add device 1: /dev/input/event2
  name:     "jadard-touchscreen"
add device 2: /dev/input/event0
  name:     "fdd70030.pwm"
add device 3: /dev/input/event4
  name:     "gpio-key"
add device 4: /dev/input/event3
  name:     "adc-keys"
add device 5: /dev/input/event1
  name:     "rk805 pwrkey"

cat查看事件详细内容

130|rk3568_r:/ $ cat /proc/bus/input/devices
I: Bus=0019 Vendor=524b Product=0006 Version=0100
N: Name="fdd70030.pwm"
P: Phys=gpio-keys/remotectl
S: Sysfs=/devices/platform/fdd70030.pwm/input/input0
U: Uniq=
H: Handlers=event0 dmcfreq cpufreq
B: PROP=0
B: EV=3
B: KEY=70010 a0004000040000 0 126010002000000 780000040008800 1eb7c000000000 2010000010004ffc

I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="rk805 pwrkey"
P: Phys=rk805_pwrkey/input0
S: Sysfs=/devices/platform/fdd40000.i2c/i2c-0/0-0020/rk805-pwrkey/input/input1
U: Uniq=
H: Handlers=event1 dmcfreq cpufreq
B: PROP=0
B: EV=3
B: KEY=10000000000000 0

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="jadard-touchscreen"
P: Phys=
S: Sysfs=/devices/virtual/input/input2
U: Uniq=
H: Handlers=event2 dmcfreq cpufreq
B: PROP=2
B: EV=b
B: KEY=10 0 0 0 400 0 0 0 0 0
B: ABS=665800000000000

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="adc-keys"
P: Phys=adc-keys/input0
S: Sysfs=/devices/platform/adc-keys/input/input3
U: Uniq=
H: Handlers=event3 dmcfreq cpufreq
B: PROP=0
B: EV=3
B: KEY=40000000 c004000000000 0

I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="gpio-key"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/gpio-key/input/input4
U: Uniq=
H: Handlers=event4 dmcfreq cpufreq
B: PROP=0
B: EV=3
B: KEY=40000800 c000000000000 0

你可能感兴趣的:(rk驱动,rk3568,getevent)