本文共 7215 字,大约阅读时间需要 24 分钟。
root@android:/ # getevent -hUsage: getevent [-t] [-n] [-s switchmask] [-S] [-v [mask]] [-d] [-p] [-i] [-l] [-q] [-c count] [-r] [device] -t: show time stamps -n: don't print newlines -s: print switch states for given bits -S: print all switch states -v: verbosity mask (errs=1, dev=2, name=4, info=8, vers=16, pos. events=32, props=64) -d: show HID descriptor, if available -p: show possible events (errs, dev, name, pos. events) -i: show all device info and possible events -l: label event types and names in plain text -q: quiet (clear verbosity mask) -c: print given number of events then exit -r: print rate events are received
root@android:/ # getevent/dev/input/event5: 0005 0002 00000001device的名字:事件类型 键码类别 具体的数值/dev/input/event5: 0000 0000 00000000表示一次输入结束
#define EV_SYN 0x00#define EV_KEY 0x01#define EV_REL 0x02#define EV_ABS 0x03#define EV_MSC 0x04#define EV_SW 0x05#define EV_LED 0x11#define EV_SND 0x12#define EV_REP 0x14#define EV_FF 0x15#define EV_PWR 0x16#define EV_FF_STATUS 0x17#define EV_MAX 0x1f#define EV_CNT (EV_MAX+1)
oot@android:/ # getevent -i add device 1: /dev/input/event2 bus: 0000 vendor 0000 product 0000 version 0000 name: "pmic8xxx_pwrkey" location: "pmic8xxx_pwrkey/input0" id: "" version: 1.0.1 events: KEY (0001): 0074 input props:2. 输出 audio jack事件.....add device 5: /dev/input/event10 bus: 0000 vendor 0000 product 0000 version 0000 name: "msm8960-snd-card Headset Jack" location: "ALSA" id: "" version: 1.0.1 events: SW (0005): 0002* 0004* 0006 000e 000f 0010 input props: add device 6: /dev/input/event9 bus: 0000 vendor 0000 product 0000 version 0000 name: "msm8960-snd-card Button Jack" location: "ALSA" id: "" version: 1.0.1 events: KEY (0001): 0100 0101 0102 0103 0104 0105 0106 0107 input props:
/* * Switch events */#define SW_LID 0x00 /* set = lid shut */#define SW_TABLET_MODE 0x01 /* set = tablet mode */#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" set = radio enabled */#define SW_RADIO SW_RFKILL_ALL /* deprecated */#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */#define SW_DOCK 0x05 /* set = plugged into dock */#define SW_LINEOUT_INSERT 0x06 /* set = inserted */#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */#define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */#define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */#define SW_LINEIN_INSERT 0x0d /* set = inserted */#define SW_HPHL_OVERCURRENT 0x0e /* set = over current on left hph */#define SW_HPHR_OVERCURRENT 0x0f /* set = over current on right hph */#define SW_UNSUPPORT_INSERT 0x10 /* set = unsupported device inserted */#define SW_MAX 0x20#define SW_CNT (SW_MAX+1)root@android:/ # getevent /dev/input/event10 0005 0002 00000001 (0002 表示earphone)0005 0004 00000001 (0004 表示microphone)0000 0000 00000000 插入 拔出Headset 0005 0002 000000010005 0004 000000010000 0000 00000000 0005 0002 000000000005 0004 000000000000 0000 00000000Headphone 0005 0002 000000010000 0000 00000000 0005 0002 000000000000 0000 00000000invalid 0005 0010 000000010000 0000 00000000 0005 0010 000000000000 0000 00000000
转载地址:http://plolo.baihongyu.com/