Adb Shell getevent方法在Nexus 4上返回X和Y值的两倍 [英] Adb shell getevent method returns twice the value for X and Y on Nexus 4
问题描述
我目前正在尝试通过adb shell的 sendevent
命令生成复杂的手势。为了重播手势,我通过adb的 getevent
方法记录了事件。这是我的Nexus 4屏幕右下角的一个简单点击示例。
I am currently trying to generate a complex gesture via the sendevent
command of adb shell. In order to replay a gesture, I recorded the events via the getevent
method of adb. Here is a sample of a simple tap on the bottom right of my Nexus 4 screen.
/dev/input/event2: 0003 0039 00000059
/dev/input/event2: 0003 0035 000005ff
/dev/input/event2: 0003 0036 000008e6
/dev/input/event2: 0003 003a 0000002d
/dev/input/event2: 0000 0000 00000000
/dev/input/event2: 0003 0039 ffffffff
/dev/input/event2: 0000 0000 00000000
转换为十进制值(对于 sendevent
方法),它使:
Converted into decimal values (for the sendevent
method), it makes:
/dev/input/event2: 3 57 89
/dev/input/event2: 3 53 1535
/dev/input/event2: 3 54 2278
/dev/input/event2: 3 58 45
/dev/input/event2: 0 0 0
/dev/input/event2: 3 57 -1
/dev/input/event2: 0 0 0
如您所见,X的值(例如,第2行的53代码)为1535,Y的值(第3行的代码54)为2278。
As you can see, the value for X (ie the 53 code on line 2) is 1535 and the value for Y (the code 54 on line 3) is 2278.
作为我的Nexus,这怎么可能4屏幕尺寸仅为768 * 1 280?与实际大小相比,它似乎要乘以2。。。如果我在Nexus 5上做同样的事情,就不会发生这种情况。
How can this be possible, as my Nexus 4 screen size is only of 768*1280 ? It seems to be multiplied by a factor 2 comparing to the actual size... This is not happening when I do the same thing on a Nexus 5.
感谢帮助这一点,它使我发疯! ^^
Thanks for the help on this one, it drives me crazy ! ^^
推荐答案
这些是 input
设备(即触摸屏)的坐标。触摸屏是一个单独的设备,其分辨率可能与显示屏不同。
Those are input
device (i.e. touch screen) coordinates. Touch screen is a separate device which may have a different resolution from the display.
要检查触摸屏的分辨率,请执行
To check the resolution of your touch screen do
getevent -il /dev/input/event2 | grep ABS_MT_POSITION
并查看 max
值
这篇关于Adb Shell getevent方法在Nexus 4上返回X和Y值的两倍的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!