原理图:
硬件检查:
R24电阻按键不按下时电压为:2.98v
R24电阻S1按键按下时电压为:0.19v
R25电阻S2按键按下时电压为:0.39v
R26电阻S3按键按下时电压为:0.6v
R27电阻S4按键按下时电压为:0.8v
问题:
按键与键值显示错误。
设备树文件:
#include <dt-bindings/input/input.h>
#include "sun8i-v3s-licheepi-zero.dts"
/ {
model = "Lichee Pi Zero with Dock";
compatible = "licheepi,licheepi-zero-dock", "licheepi,licheepi-zero",
"allwinner,sun8i-v3s";
};
&codec {
allwinner,audio-routing =
"Headphone", "HP",
"Headphone", "HPCOM",
"MIC1", "Mic",
"Mic", "HBIAS";
status = "okay";
};
&lradc {
vref-supply = <®_vcc3v0>;
status = "okay";
button@200 {
label = "Volume Up";
linux,code = <KEY_VOLUMEUP>;
channel = <0>;
voltage = <200000>;
};
button@400 {
label = "Volume Down";
linux,code = <KEY_VOLUMEDOWN>;
channel = <0>;
voltage = <400000>;
};
button@600 {
label = "Select";
linux,code = <KEY_SELECT>;
channel = <0>;
voltage = <600000>;
};
button@800 {
label = "Start";
linux,code = <KEY_OK>;
channel = <0>;
voltage = <800000>;
};
};
&mmc1 {
pinctrl-0 = <&mmc1_pins>;
pinctrl-names = "default";
broken-cd;
bus-width = <4>;
vmmc-supply = <®_vcc3v3>;
status = "okay";
};
测试代码:https://elinux.org/images/9/93/Evtest.c
以下我是按照原理图上的S1,S2,S3,S4按键的顺序按下的,输出的信息完全不对,求教。
# ./evtest /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "1c22800.lradc"
Supported events:
Event type 0 (Sync)
Event type 1 (Key)
Event code 114 (VolumeDown)
Event code 115 (VolumeUp)
Event code 352 (Ok)
Event code 353 (Select)
Testing ... (interrupt to exit)
Event: time 17480.008424, type 1 (Key), code 114 (VolumeDown), value 1
Event: time 17480.008424, -------------- Report Sync ------------
Event: time 17480.246700, type 1 (Key), code 114 (VolumeDown), value 0
Event: time 17480.246700, -------------- Report Sync ------------
Event: time 17480.727180, type 1 (Key), code 352 (Ok), value 1
Event: time 17480.727180, -------------- Report Sync ------------
Event: time 17480.942028, type 1 (Key), code 352 (Ok), value 0
Event: time 17480.942028, -------------- Report Sync ------------
Event: time 17481.465484, type 1 (Key), code 352 (Ok), value 1
Event: time 17481.465484, -------------- Report Sync ------------
Event: time 17481.680335, type 1 (Key), code 352 (Ok), value 0
Event: time 17481.680335, -------------- Report Sync ------------
Event: time 17482.195977, type 1 (Key), code 352 (Ok), value 1
Event: time 17482.195977, -------------- Report Sync ------------
Event: time 17482.445982, type 1 (Key), code 352 (Ok), value 0
Event: time 17482.445982, -------------- Report Sync ------------
我按下S1按键再松开:
Event: time 17480.008424, type 1 (Key), code 114 (VolumeDown), value 1
Event: time 17480.008424, -------------- Report Sync ------------
Event: time 17480.246700, type 1 (Key), code 114 (VolumeDown), value 0
Event: time 17480.246700, -------------- Report Sync ------------
如上它显示的是S2按键(VolumeDown)的信息和键值,为什么呢?
我按下S2、S3、S4键都是显示的是S4按键(KEY_OK)的信息,为什么呢?
Event: time 17480.727180, type 1 (Key), code 352 (Ok), value 1
Event: time 17480.727180, -------------- Report Sync ------------
Event: time 17480.942028, type 1 (Key), code 352 (Ok), value 0
Event: time 17480.942028, -------------- Report Sync ------------
查看中断列表:
# cat /proc/interrupts
CPU0
19: 576 GIC-0 27 Level arch_timer
21: 0 GIC-0 50 Level sun4i_timer0
22: 0 GIC-0 82 Level 1c02000.dma-controller
23: 5039 GIC-0 92 Level sunxi-mmc
24: 159 GIC-0 93 Level sunxi-mmc
25: 1 GIC-0 103 Level musb-hdrc.1.auto
26: 0 GIC-0 72 Level 1c20400.rtc
32: 2 GIC-0 62 Level sun4i-a10-lradc-keys
34: 226 GIC-0 32 Level serial
35: 63 GIC-0 38 Level mv64xxx_i2c
IPI0: 0 CPU wakeup interrupts
IPI1: 0 Timer broadcast interrupts
IPI2: 0 Rescheduling interrupts
IPI3: 0 Function call interrupts
IPI4: 0 CPU stop interrupts
IPI5: 0 IRQ work interrupts
IPI6: 0 completion interrupts
Err: 0
有中断:
32: 2 GIC-0 62 Level sun4i-a10-lradc-keys
以上就是所有的信息
离线