解决android终端接扫码器,扫描支付二维码信息丢失问题过程


平台: RK3288 Android5.1 / RK3368 Android6.0

错误log:
 

03-18 14:40:59.513 D/InputReader(  499): Input event: device=4 type=0x0004 code=0x0004 value=0x0007001f when=11280133292000
03-18 14:40:59.514 D/InputReader(  499): Input event: device=4 type=0x0001 code=0x0003 value=0x00000001 when=11280133292000
03-18 14:40:59.516 D/InputReader(  499): Input event: device=4 type=0x0004 code=0x0004 value=0x00070025 when=11280133292000
03-18 14:40:59.516 D/InputReader(  499): Input event: device=4 type=0x0001 code=0x0009 value=0x00000001 when=11280133292000
03-18 14:40:59.519 D/InputReader(  499): Input event: device=4 type=0x0004 code=0x0004 value=0x00070026 when=11280133292000
03-18 14:40:59.521 D/InputReader(  499): Input event: device=4 type=0x0001 code=0x000a value=0x00000001 when=11280133292000
03-18 14:40:59.523 D/InputReader(  499): Input event: device=4 type=0x0004 code=0x0004 value=0x00070024 when=11280133292000
03-18 14:40:59.524 D/InputReader(  499): Input event: device=4 type=0x0001 code=0x0008 value=0x00000001 when=11280133292000
03-18 14:40:59.526 D/InputReader(  499): Input event: device=4 type=0x0000 code=0x0000 value=0x00000001 when=11280133292000
03-18 14:40:59.531 D/InputReader(  499): BatchSize: 5 Count: 5
03-18 14:40:59.531 D/InputReader(  499): Input event: device=4 type=0x0000 code=0x0003 value=0x00000000 when=11280151267000
03-18 14:40:59.531 I/InputReader(  499): Detected input event buffer overrun for device INSPIRY TECH       INSPIRY READER.
03-18 14:40:59.531 D/InputReader(  499): Input event: device=4 type=0x0001 code=0x0009 value=0x00000000 when=11280151267000
03-18 14:40:59.531 D/InputReader(  499): Dropped input event while waiting for next input sync.
03-18 14:40:59.531 D/InputReader(  499): Input event: device=4 type=0x0004 code=0x0004 value=0x00070024 when=11280151267000
03-18 14:40:59.531 D/InputReader(  499): Dropped input event while waiting for next input sync.
03-18 14:40:59.531 D/InputReader(  499): Input event: device=4 type=0x0001 code=0x0008 value=0x00000000 when=11280151267000
03-18 14:40:59.531 D/InputReader(  499): Dropped input event while waiting for next input sync.
03-18 14:40:59.532 D/InputReader(  499): Input event: device=4 type=0x0000 code=0x0000 value=0x00000000 when=11280151267000
03-18 14:40:59.532 D/InputReader(  499): Recovered from input event buffer overrun.
03-18 14:40:59.533 D/InputReader(  499): BatchSize: 7 Count: 7
03-18 14:40:59.533 D/InputReader(  499): Input event: device=4 type=0x0004 code=0x0004 value=0x00070025 when=11280153194000
03-18 14:40:59.533 D/InputReader(  499): Input event: device=4 type=0x0001 code=0x0009 value=0x00000001 when=11280153194000
03-18 14:40:59.533 D/InputReader(  499): Input event: device=4 type=0x0004 code=0x0004 value=0x0007001f when=11280153194000
03-18 14:40:59.534 D/InputReader(  499): Input event: device=4 type=0x0001 code=0x0003 value=0x00000001 when=11280153194000
03-18 14:40:59.534 D/InputReader(  499): Input event: device=4 type=0x0004 code=0x0004 value=0x00070028 when=11280153194000
03-18 14:40:59.534 D/InputReader(  499): Input event: device=4 type=0x0001 code=0x001c value=0x00000001 when=11280153194000
03-18 14:40:59.535 D/InputReader(  499): Input event: device=4 type=0x0000 code=0x0000 value=0x00000000 when=11280153194000
03-18 14:40:59.535 D/InputReader(  499): BatchSize: 7 Count: 7
03-18 14:40:59.535 D/InputReader(  499): Input event: device=4 type=0x0004 code=0x0004 value=0x00070025 when=11280155194000
03-18 14:40:59.535 D/InputReader(  499): Input event: device=4 type=0x0001 code=0x0009 value=0x00000000 when=11280155194000
03-18 14:40:59.536 D/InputReader(  499): Input event: device=4 type=0x0004 code=0x0004 value=0x0007001f when=11280155194000
03-18 14:40:59.536 D/InputReader(  499): Input event: device=4 type=0x0001 code=0x0003 value=0x00000000 when=11280155194000
03-18 14:40:59.536 D/InputReader(  499): Input event: device=4 type=0x0004 code=0x0004 value=0x00070028 when=11280155194000
03-18 14:40:59.536 D/InputReader(  499): Input event: device=4 type=0x0001 code=0x001c value=0x00000000 when=11280155194000
03-18 14:40:59.537 D/InputReader(  499): Input event: device=4 type=0x0000 code=0x0000 value=0x00000000 when=11280155194000
03-18 14:40:59.546 I/PhoneWindow( 2202): 9Key up: repeat=0 flags=0x28
03-18 14:40:59.546 I/PhoneWindow( 2202): 15Key up: repeat=0 flags=0x28
03-18 14:40:59.546 I/PhoneWindow( 2202): 16Key up: repeat=0 flags=0x28
03-18 14:40:59.546 I/PhoneWindow( 2202): 14Key up: repeat=0 flags=0x28
03-18 14:40:59.574 I/PhoneWindow( 2202): 15Key up: repeat=0 flags=0x8
03-18 14:40:59.575 I/PhoneWindow( 2202): 9Key up: repeat=0 flags=0x8
03-18 14:40:59.575 I/PhoneWindow( 2202): 66Key up: repeat=0 flags=0x8
03-18 14:41:00.007 D/KeyguardUpdateMonitor(  982): received broadcast android.intent.action.TIME_TICK
03-18 14:41:00.008 D/KeyguardUpdateMonitor(  982): handleTimeUpdate

1:getevent -ltr /dev/input/event2
    找出输入设备节点,检查输入信息是否完整;
    
2:打开ALOGV的日志:
    打开ALOGV: #define LOG_NDEBUG 0
    打开ALOGI:#define LOG_NIDEBUG 0
    打开ALOGD:#define LOG_NDDEBUG 0
开启/frameworks/native/services/inputflinger/EventHub.cpp 调式日志:

diff --git a/frameworks/native/services/inputflinger/EventHub.cpp b/frameworks/native/services/inputflinger/EventHub.cpp
index 0763604..6b1c616 100644
--- a/frameworks/native/services/inputflinger/EventHub.cpp
+++ b/frameworks/native/services/inputflinger/EventHub.cpp
@@ -33,7 +33,7 @@


#define LOG_TAG "EventHub"


-// #define LOG_NDEBUG 0
+#define LOG_NDEBUG 0


#include "EventHub.h"


开启frameworks/native/services/inputflinger/InputReader.cpp 调式日志:

diff --git a/frameworks/native/services/inputflinger/InputReader.cpp b/frameworks/native/services/inputflinger/InputReader.cpp
old mode 100644
new mode 100755
index ef09daa..8284d58
--- a/frameworks/native/services/inputflinger/InputReader.cpp
+++ b/frameworks/native/services/inputflinger/InputReader.cpp
@@ -19,25 +19,25 @@
//#define LOG_NDEBUG 0


// Log debug messages for each raw event received from the EventHub.
-#define DEBUG_RAW_EVENTS 0
+#define DEBUG_RAW_EVENTS 1


// Log debug messages about touch screen filtering hacks.
-#define DEBUG_HACKS 0
+#define DEBUG_HACKS 1


// Log debug messages about virtual key processing.
-#define DEBUG_VIRTUAL_KEYS 0
+#define DEBUG_VIRTUAL_KEYS 1


// Log debug messages about pointers.
-#define DEBUG_POINTERS 0
+#define DEBUG_POINTERS 1


// Log debug messages about pointer assignment calculations.
-#define DEBUG_POINTER_ASSIGNMENT 0
+#define DEBUG_POINTER_ASSIGNMENT 1


// Log debug messages about gesture detection.
-#define DEBUG_GESTURES 0
+#define DEBUG_GESTURES 1


// Log debug messages about the vibrator.
-#define DEBUG_VIBRATOR 0
+#define DEBUG_VIBRATOR 1


#include "InputReader.h"

3.加入事件输入延时:(此步是没用的,实验证明,加入后,扫描失败100%)

frameworks/native/services/inputflinger/InputReader.cpp

@@ -852,7 +852,14 @@ InputReaderThread::~InputReaderThread() {
}


bool InputReaderThread::threadLoop() {
+       //nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
+       //ALOGD("zj add EventHub.cpp EventHub::getEvents sleep(1000) b now=%lld",now);
     mReader->loopOnce();
+       //zj add for too much keyevent
+       //usleep(20000);
+
+       //now = systemTime(SYSTEM_TIME_MONOTONIC);
+       //ALOGD("zj add EventHub.cpp EventHub::getEvents sleep(1000) e now=%lld",now);
     return true;
}

4.usb驱动里面drivers/input/evdev.c  EVDEV_BUF_PACKETS的值改大为128;

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index f4897c8..eee8eb2 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -13,7 +13,7 @@
#define EVDEV_MINOR_BASE       64
#define EVDEV_MINORS           32
#define EVDEV_MIN_BUFFER_SIZE  64U
-#define EVDEV_BUF_PACKETS      8
+#define EVDEV_BUF_PACKETS      128


#include <linux/poll.h>
#include <linux/sched.h>

 

 

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值