查看linux下事件

查看linux下事件

1、/dev/input/目录

# ls /dev/input/

by-path event0 event1 event2

#

每个event代表一个事件。

2、eventx对应的相关设备信息

/proc/bus/input/devices存放了与event对应的相关设备信息。

# cat /proc/bus/input/devices

I: Bus=0000 Vendor=0000 Product=0000 Version=0000

N: Name="rockchip,rk3308-vad Headphones"

P: Phys=ALSA

S: Sysfs=/devices/platform/vad-acodec-sound/sound/card0/input0

U: Uniq=

H: Handlers=event0

B: PROP=0

B: EV=21

B: SW=4

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/input1

U: Uniq=

H: Handlers=event1 cpufreq

B: PROP=0

B: EV=3

B: KEY=200000 0 0 0 1000000 8000 0 0 c0000 0 0 0

I: Bus=0019 Vendor=0001 Product=0001 Version=0100

N: Name="gpio-keys"

P: Phys=gpio-keys/input0

S: Sysfs=/devices/platform/gpio-keys/input/input2

U: Uniq=

H: Handlers=event2 cpufreq

B: PROP=0

B: EV=100003

B: KEY=100000 0 0 0

3、直接读取事件的输入

使用cat查看输入事件的内容,操作相应输入设备,事件会上报内容。

cat /dev/input/event4

转载说明:

1、https://blog.csdn.net/phmatthaus/article/details/127748541