[MTK] How to detect VOL UP/DOWN, POWER button

文摘 Android Kernel MediaTek 2020-02-16 阅读:6076

[DESCRIPTION]
How to detect VOL UP/DOWN, POWER button
[SOLUTION]
可用adb command來get input event的方式來得知是否有按key

  • 先看mtk-kpd是哪一個event

#adb shell getevent -p

add device 1: /dev/input/event0
  name:     "mtk-kpd"
  events:
    KEY (0001): 0066  006b  0072  0073  0074  008b  009e  00d3
                00d4  00e7
  input props:
    <none>

這個例子是/dev/input/event0

  • 再用下列command來看是否有發event

#adb shell getevent -rtl /dev/input/event0
  • 再按key,就可以看到如下driver發的input event

[1262304450.816227] EV_KEY       KEY_POWER            DOWN
[1262304450.816227] EV_SYN       SYN_REPORT           00000000
[1262304450.944967] EV_KEY       KEY_POWER            UP
[1262304450.944967] EV_SYN       SYN_REPORT           00000000
[1262304457.083719] EV_KEY       KEY_VOLUMEDOWN       DOWN
[1262304457.083719] EV_SYN       SYN_REPORT           00000000
[1262304457.229295] EV_KEY       KEY_VOLUMEDOWN       UP
[1262304457.229295] EV_SYN       SYN_REPORT           00000000
[1262304459.095400] EV_KEY       KEY_VOLUMEUP         DOWN
[1262304459.095400] EV_SYN       SYN_REPORT           00000000
[1262304459.293722] EV_KEY       KEY_VOLUMEUP         UP
[1262304459.293722] EV_SYN       SYN_REPORT           00000000

0条评论

© 2024 芯缘异码. Powered by Typecho