linux 事件协议分析

来源:互联网 发布:淘宝新手发货 编辑:程序博客网 时间:2024/06/08 16:03
//
// _class & CLASS_KEYBOARD(0x00000001) == 1
//  keyboard event
//
// EX:
//
Read CLASS_KEYBOARD : EV_KEY
 Event deviceId: 65540,type: 0x1, scancode: 0x74,  keyCode: 0x1a, flags: 1, value: 1, when: 3831734487000
Read CLASS_KEYBOARD : SYN_REPORT
 Event deviceId: 65540,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 3831736232000
Read CLASS_KEYBOARD : EV_KEY
 Event deviceId: 65540,type: 0x1, scancode: 0x74,  keyCode: 0x1a, flags: 1, value: 0, when: 3831874527000
Read CLASS_KEYBOARD : SYN_REPORT
 Event deviceId: 65540,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 3831875164000
//
//Protocol
//
EV_KEY::xxx            //down    xxx key is down
EV_SYN::SYN_REPORT        //report  
EV_KEY::xxx               //up      xxx key is up
EV_SYN::SYN_REPORT        //report  


//
// (_class & CLASS_TOUCHSCREEN(0x00000004) == 1 ) && (_class & CLASS_TOUCHSCREEN_MT(0x00000010) == 0 
//  single touch screen
//
// EX:
//
Read CLASS_TOUCHSCREEN : EV_ABS
 Event deviceId: 0,type: 0x3, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 166, when: 83226491000
Read CLASS_TOUCHSCREEN : EV_ABS
 Event deviceId: 0,type: 0x3, scancode: 0x1,  keyCode: 0x1, flags: 0, value: 242, when: 83226580000
Read CLASS_TOUCH : EV_KEY : BTN_TOUCH
 Event deviceId: 0,type: 0x1, scancode: 0x14a,  keyCode: 0x0, flags: 0, value: 1, when: 83226659000
Read CLASS_TOUCHSCREEN : SYN_REPORT
 Event deviceId: 0,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 83226812000
Read CLASS_TOUCHSCREEN : EV_ABS
 Event deviceId: 0,type: 0x3, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 167, when: 88243099000
Read CLASS_TOUCHSCREEN : SYN_REPORT
 Event deviceId: 0,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 88243267000
Read CLASS_TOUCHSCREEN : EV_ABS
 Event deviceId: 0,type: 0x3, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 168, when: 88259031000
Read CLASS_TOUCHSCREEN : SYN_REPORT
 Event deviceId: 0,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 88259135000
Read CLASS_TOUCH : EV_KEY : BTN_TOUCH
 Event deviceId: 0,type: 0x1, scancode: 0x14a,  keyCode: 0x0, flags: 0, value: 0, when: 90508923000
Read CLASS_TOUCHSCREEN : SYN_REPORT
 Event deviceId: 0,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 90509047000
//
//Protocol
//
//down
EV_ABS::ABS_X             //absolute x-axis value
EV_ABS::ABS_Y             //absolute y-axis value
EV_KEY::BTN_TOUCH         //state     == 1  down
EV_SYN::SYN_REPORT        //report  
//move
//1: both
EV_ABS::ABS_X              
EV_ABS::ABS_Y
EV_SYN::SYN_REPORT        //report  
//2: x           
EV_ABS::ABS_X
EV_SYN::SYN_REPORT        //report 
//3: y 
EV_ABS::ABS_Y
EV_SYN::SYN_REPORT        //report  
...                       //more
//up
EV_KEY::BTN_TOUCH         //state   == 0   up
EV_SYN::SYN_REPORT        //report 




//
// _class & CLASS_TOUCHSCREEN(0x00000004) == 1
//  multi_touch screen
//  see: Tegra_odm.c  search: ABS_MT_TOUCH_MAJOR
// EX:
//
//single finger
//
//finger down:
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x30,  keyCode: 0x30, flags: 0, value: 1, when: 4636891598000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x35,  keyCode: 0x35, flags: 0, value: 209, when: 4636891638000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x36,  keyCode: 0x36, flags: 0, value: 269, when: 4636891652000
Read CLASS_TOUCHSCREEN_MT : SYN_MT_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x2,  keyCode: 0x2, flags: 0, value: 0, when: 4636891665000
Read CLASS_TOUCHSCREEN_MT : SYN_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 4636891675000
//finger move:
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x30,  keyCode: 0x30, flags: 0, value: 1, when: 4636902628000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x35,  keyCode: 0x35, flags: 0, value: 209, when: 4636902669000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x36,  keyCode: 0x36, flags: 0, value: 268, when: 4636902682000
Read CLASS_TOUCHSCREEN_MT : SYN_MT_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x2,  keyCode: 0x2, flags: 0, value: 0, when: 4636902695000
Read CLASS_TOUCHSCREEN_MT : SYN_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 4636902705000
... //more
//finger up:
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x30,  keyCode: 0x30, flags: 0, value: 0, when: 4637274042000
Read CLASS_TOUCHSCREEN_MT : SYN_MT_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x2,  keyCode: 0x2, flags: 0, value: 0, when: 4637274073000
Read CLASS_TOUCHSCREEN_MT : SYN_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 4637274082000


//
//Protocol_1(single finger)
//
EV_ABS::ABS_MT_TOUCH_MAJOR
EV_ABS::ABS_MT_POSITION_X
EV_ABS::ABS_MT_POSITION_Y
EV_SYN::SYN_MT_REPORT        //report 


EV_SYN::SYN_REPORT           //report 
...     //more
EV_ABS::ABS_MT_TOUCH_MAJOR
EV_SYN::SYN_MT_REPORT        //report 
EV_SYN::SYN_REPORT           //report 


//
//multi_finger
//
//finger_1 down:
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x30,  keyCode: 0x30, flags: 0, value: 1, when: 5246937870000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x35,  keyCode: 0x35, flags: 0, value: 220, when: 5246938447000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x36,  keyCode: 0x36, flags: 0, value: 188, when: 5246938690000
Read CLASS_TOUCHSCREEN_MT : SYN_MT_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x2,  keyCode: 0x2, flags: 0, value: 0, when: 5246938931000


//finger_2 down:
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x30,  keyCode: 0x30, flags: 0, value: 1, when: 5246939139000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x35,  keyCode: 0x35, flags: 0, value: 219, when: 5246939346000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x36,  keyCode: 0x36, flags: 0, value: 678, when: 5246941381000
Read CLASS_TOUCHSCREEN_MT : SYN_MT_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x2,  keyCode: 0x2, flags: 0, value: 0, when: 5246941663000


//report two fingers
Read CLASS_TOUCHSCREEN_MT : SYN_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 5246941871000


//finger_1 move:
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x30,  keyCode: 0x30, flags: 0, value: 1, when: 5246949798000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x35,  keyCode: 0x35, flags: 0, value: 219, when: 5246949839000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x36,  keyCode: 0x36, flags: 0, value: 188, when: 5246949853000
Read CLASS_TOUCHSCREEN_MT : SYN_MT_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x2,  keyCode: 0x2, flags: 0, value: 0, when: 5246949865000


//finger_2 move:
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x30,  keyCode: 0x30, flags: 0, value: 1, when: 5246949878000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x35,  keyCode: 0x35, flags: 0, value: 219, when: 5246949890000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x36,  keyCode: 0x36, flags: 0, value: 677, when: 5246949902000
Read CLASS_TOUCHSCREEN_MT : SYN_MT_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x2,  keyCode: 0x2, flags: 0, value: 0, when: 5246949913000


//report two fingers
Read CLASS_TOUCHSCREEN_MT : SYN_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 5246949923000


//finger_1 move:
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x30,  keyCode: 0x30, flags: 0, value: 1, when: 5246962686000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x35,  keyCode: 0x35, flags: 0, value: 219, when: 5246962723000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x36,  keyCode: 0x36, flags: 0, value: 188, when: 5246962737000
Read CLASS_TOUCHSCREEN_MT : SYN_MT_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x2,  keyCode: 0x2, flags: 0, value: 0, when: 5246962749000


//finger_2 move:
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x30,  keyCode: 0x30, flags: 0, value: 1, when: 5246962761000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x35,  keyCode: 0x35, flags: 0, value: 220, when: 5246962773000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x36,  keyCode: 0x36, flags: 0, value: 677, when: 5246962784000
Read CLASS_TOUCHSCREEN_MT : SYN_MT_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x2,  keyCode: 0x2, flags: 0, value: 0, when: 5246962796000


//report two fingers
Read CLASS_TOUCHSCREEN_MT : SYN_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 5246962806000


//finger_2 move:  finger_1 is up 
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x30,  keyCode: 0x30, flags: 0, value: 1, when: 5246999654000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x35,  keyCode: 0x35, flags: 0, value: 219, when: 5246999691000
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x36,  keyCode: 0x36, flags: 0, value: 188, when: 5246999705000
Read CLASS_TOUCHSCREEN_MT : SYN_MT_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x2,  keyCode: 0x2, flags: 0, value: 0, when: 5246999717000


//report two fingers
Read CLASS_TOUCHSCREEN_MT : SYN_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 5246999727000


//all fingers up
Read CLASS_TOUCHSCREEN_MT : EV_ABS
 Event deviceId: 65542,type: 0x3, scancode: 0x30,  keyCode: 0x30, flags: 0, value: 0, when: 5247036729000
Read CLASS_TOUCHSCREEN_MT : SYN_MT_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x2,  keyCode: 0x2, flags: 0, value: 0, when: 5247036763000
Read CLASS_TOUCHSCREEN_MT : SYN_REPORT
 Event deviceId: 65542,type: 0x0, scancode: 0x0,  keyCode: 0x0, flags: 0, value: 0, when: 5247036775000


//
//Protocol_1(multi_finger)
//
//finger_1
EV_ABS::ABS_MT_TOUCH_MAJOR
EV_ABS::ABS_MT_POSITION_X
EV_ABS::ABS_MT_POSITION_Y
EV_SYN::SYN_MT_REPORT        //report finger_1
...     //more
//finger_n
EV_ABS::ABS_MT_TOUCH_MAJOR
EV_ABS::ABS_MT_POSITION_X
EV_ABS::ABS_MT_POSITION_Y
EV_SYN::SYN_MT_REPORT        //report finger_n


EV_SYN::SYN_REPORT           //report all




EV_ABS::ABS_MT_TOUCH_MAJOR
EV_SYN::SYN_MT_REPORT        //report 
EV_SYN::SYN_REPORT           //report 


//
//others:
//
//~/software/eclipse/android-sdk-linux_86/tools$ ./emulator -avd vaney -partition-size 256
原创粉丝点击