快速定位是否是kl文件问题

来源:互联网 发布:知乎怎么收藏文章 编辑:程序博客网 时间:2024/06/06 07:47

   今天调试了一下touch,发现back 和menu key都正常,但是home不能用,于是追了一下,发现可以快速定位问题

在inputdispatcher.cpp里

void InputDispatcher::notifyKey(const NotifyKeyArgs* args) {
//#if DEBUG_INBOUND_EVENT_DETAILS
    ALOGD("matt-notifyKey - eventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, action=0x%x, "
            "flags=0x%x, keyCode=0x%x, scanCode=0x%x, metaState=0x%x, downTime=%lld",
            args->eventTime, args->deviceId, args->source, args->policyFlags,
            args->action, args->flags, args->keyCode, args->scanCode,
            args->metaState, args->downTime);
//#endif

这里发现log不同

back

01-01 05:00:14.019  1444  1912 D InputReader: matt-matt-InputReader::loopOnce()
01-01 05:00:14.019  1444  1912 D InputReader: matt-BatchSize: 2 Count: 2
01-01 05:00:14.019  1444  1912 D InputReader: matt-Input event: device=5 type=0x0001 code=0x009e value=0x00000001 when=129753013000
01-01 05:00:14.019  1444  1912 D InputReader: matt- KeyboardInputMapper::process-case EV_KEY.
01-01 05:00:14.019  1444  1912 E EventHub: matt-mapKey-status=-2
01-01 05:00:14.019  1444  1912 E EventHub: matt-mapKey-status-1=0
01-01 05:00:14.019  1444  1912 E InputReader: matt- processKey- if (down)
01-01 05:00:14.019  1444  1912 E InputReader: matt- processKey-getListener()->notifyKey(&args)
01-01 05:00:14.019  1444  1912 D InputReader: matt- MultiTouchInputMapper::process
01-01 05:00:14.019  1444  1912 D InputReader: matt-Input event: device=5 type=0x0000 code=0x0000 value=0x00000000 when=129753013000
01-01 05:00:14.019  1444  1912 D InputReader: matt- KeyboardInputMapper::process-case EV_SYN.
01-01 05:00:14.019  1444  1912 D InputReader: matt- MultiTouchInputMapper::process
01-01 05:00:14.020  1444  1912 D InputReader: matt-syncTouch: pointerCount 0 -> 0, touching ids 0x00000000 -> 0x00000000, hovering ids 0x00000000 -> 0x00000000
01-01 05:00:14.020  1444  1912 D InputDispatcher: matt-notifyKey - eventTime=129753013000, deviceId=5, source=0x101, policyFlags=0x0, action=0x0, flags=0x8, keyCode=0x4, scanCode=0x9e, metaState=0x0, downTime=129753013000
01-01 05:00:14.090  1444  1912 D InputReader: matt-matt-InputReader::loopOnce()
01-01 05:00:14.090  1444  1912 D InputReader: matt-BatchSize: 2 Count: 2
01-01 05:00:14.090  1444  1912 D InputReader: matt-Input event: device=5 type=0x0001 code=0x009e value=0x00000000 when=129823783000
01-01 05:00:14.090  1444  1912 D InputReader: matt- KeyboardInputMapper::process-case EV_KEY.
01-01 05:00:14.090  1444  1912 E EventHub: matt-mapKey-status=-2
01-01 05:00:14.090  1444  1912 E EventHub: matt-mapKey-status-1=0
01-01 05:00:14.090  1444  1912 E InputReader: matt- processKey-getListener()->notifyKey(&args)
01-01 05:00:14.090  1444  1912 D InputReader: matt- MultiTouchInputMapper::process
01-01 05:00:14.090  1444  1912 D InputReader: matt-Input event: device=5 type=0x0000 code=0x0000 value=0x00000000 when=129823783000
01-01 05:00:14.090  1444  1912 D InputReader: matt- KeyboardInputMapper::process-case EV_SYN.
01-01 05:00:14.090  1444  1912 D InputReader: matt- MultiTouchInputMapper::process
01-01 05:00:14.090  1444  1912 D InputReader: matt-syncTouch: pointerCount 0 -> 0, touching ids 0x00000000 -> 0x00000000, hovering ids 0x00000000 -> 0x00000000
01-01 05:00:14.090  1444  1912 D InputDispatcher: matt-notifyKey - eventTime=129823783000, deviceId=5, source=0x101, policyFlags=0x0, action=0x1, flags=0x8, keyCode=0x4, scanCode=0x9e, metaState=0x0, downTime=129753013000

home

01-01 05:00:54.292  1444  1912 D InputReader: matt-matt-InputReader::loopOnce()
01-01 05:00:54.292  1444  1912 D InputReader: matt-BatchSize: 2 Count: 2
01-01 05:00:54.293  1444  1912 D InputReader: matt-Input event: device=5 type=0x0001 code=0x0066 value=0x00000001 when=170026604000
01-01 05:00:54.293  1444  1912 D InputReader: matt- KeyboardInputMapper::process-case EV_KEY.
01-01 05:00:54.293  1444  1912 E EventHub: matt-mapKey-status=-2
01-01 05:00:54.293  1444  1912 E EventHub: matt-mapKey-status-1=0
01-01 05:00:54.293  1444  1912 E InputReader: matt- processKey- if (down)
01-01 05:00:54.293  1444  1912 E InputReader: matt- processKey-getListener()->notifyKey(&args)
01-01 05:00:54.293  1444  1912 D InputReader: matt- MultiTouchInputMapper::process
01-01 05:00:54.293  1444  1912 D InputReader: matt-Input event: device=5 type=0x0000 code=0x0000 value=0x00000000 when=170026604000
01-01 05:00:54.293  1444  1912 D InputReader: matt- KeyboardInputMapper::process-case EV_SYN.
01-01 05:00:54.293  1444  1912 D InputReader: matt- MultiTouchInputMapper::process
01-01 05:00:54.293  1444  1912 D InputReader: matt-syncTouch: pointerCount 0 -> 0, touching ids 0x00000000 -> 0x00000000, hovering ids 0x00000000 -> 0x00000000
01-01 05:00:54.293  1444  1912 D InputDispatcher: matt-notifyKey - eventTime=170026604000, deviceId=5, source=0x101, policyFlags=0x0, action=0x0, flags=0x8, keyCode=0x7a, scanCode=0x66, metaState=0x0, downTime=170026604000
01-01 05:00:54.323  1444  1912 D InputReader: matt-matt-InputReader::loopOnce()
01-01 05:00:54.323  1444  1912 D InputReader: matt-BatchSize: 2 Count: 2
01-01 05:00:54.323  1444  1912 D InputReader: matt-Input event: device=5 type=0x0001 code=0x0066 value=0x00000000 when=170056937000
01-01 05:00:54.323  1444  1912 D InputReader: matt- KeyboardInputMapper::process-case EV_KEY.
01-01 05:00:54.323  1444  1912 E EventHub: matt-mapKey-status=-2
01-01 05:00:54.323  1444  1912 E EventHub: matt-mapKey-status-1=0
01-01 05:00:54.323  1444  1912 E InputReader: matt- processKey-getListener()->notifyKey(&args)
01-01 05:00:54.323  1444  1912 D InputReader: matt- MultiTouchInputMapper::process
01-01 05:00:54.323  1444  1912 D InputReader: matt-Input event: device=5 type=0x0000 code=0x0000 value=0x00000000 when=170056937000
01-01 05:00:54.323  1444  1912 D InputReader: matt- KeyboardInputMapper::process-case EV_SYN.
01-01 05:00:54.323  1444  1912 D InputReader: matt- MultiTouchInputMapper::process
01-01 05:00:54.323  1444  1912 D InputReader: matt-syncTouch: pointerCount 0 -> 0, touching ids 0x00000000 -> 0x00000000, hovering ids 0x00000000 -> 0x00000000
01-01 05:00:54.323  1444  1912 D InputDispatcher: matt-notifyKey - eventTime=170056937000, deviceId=5, source=0x101, policyFlags=0x0, action=0x1, flags=0x8, keyCode=0x7a, scanCode=0x66, metaState=0x0, downTime=170026604000


很明显看到home的keyCode=0x7a不对,所以应该是kl文件的问题,因为目前没有自己的kl文件所以用的是defaultkl也就是

/system/usr/keylayout目录下的Generic.kl

所以pull出来一看发现

key 102   MOVE_HOME

而正确的应该是

key 102   HOME

修改之后pull进去发现ok了

而匹配这个过程是在InputReader.cpp里的

void KeyboardInputMapper::processKey(nsecs_t when, bool down, int32_t scanCode,
        int32_t usageCode) 完成的。


如果想要确定新增一个kl文件,那么到eventhub.c里的

EventHub::openDeviceLocked

{

 ALOGE("  matt-name:       \"%s\"\n", identifier.name.string());

}

log:

05-07 12:58:03.761  1597  2515 E EventHub: matt-add device 9: /dev/input/event0
05-07 12:58:03.761  1597  2515 E EventHub:   matt-bus:        0000
05-07 12:58:03.761  1597  2515 E EventHub:   matt-name:       "ft5x06_ts"
05-07 12:58:03.761  1597  2515 E EventHub:   matt-location:   ""
05-07 12:58:03.761  1597  2515 E EventHub:   matt-unique id:  ""
05-07 12:58:03.761  1597  2515 E EventHub:   matt-descriptor: "a3d3ffc870334637db1e8bbfb999c8c212cbcbc9"
05-07 12:58:03.761  1597  2515 E EventHub:   matt-driver:     v1.0.1

新增ft5x06_ts.kl

0 0