执行cat / proc /巴士/输入/设备"&QUOT的结果国米pretation;和亚行的shell命令 [英] Interpretation of the result of "cat /proc/bus/input/devices" and adb shell commands

查看:191
本文介绍了执行cat / proc /巴士/输入/设备"&QUOT的结果国米pretation;和亚行的shell命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定如果关于通过注射亚行活动的问题应该是在计算器或的Andr​​oid爱好者的,请移动它,如果它不属于这里。

I'm unsure if the question about injecting events via adb is supposed to be in StackOverflow or Android Enthusiasts, please move it if it doesn't belong here.

不管怎样,我的问题如下:

Anyway, my question is as follows.

我显然必须确定设备的类型发送和接收事件。我不能触摸事件明显发送到键盘的设备。

I obviously have to determine the "type" of device for sending and receiving events. I can't obviously send a touch event to the keypad device.

在大量的调查研究,我发现了的SendEvent getevent 命令。

After a lot of research I found the sendevent and getevent commands.

所以,我要很长的preSS发送到手机的电源按钮。

So, I want to send a long press to the power button of a phone.

我目前使用的:

sendevent /dev/input/event3 1 116 0
sendevent /dev/input/event3 1 116 1

本工程对 HTC野火 (点击的链接输入设备上),因为键盘包含了电源键和 116 恰好扫描code为电源键。

This works on the HTC Wildfire(click on the link for the input devices) because the keypad contains the power button and 116 happens to be the scan code for the power key.

我知道什么是的/ dev /输入/ EVENT3 / 116 0或1 代表。什么是 1 在中间的/ dev /输入/ EVENT3 / 116 代表什么?我如何获得呢?

I know what /dev/input/event3/ and 116 and 0 or 1 stand for. What does the 1 in-between /dev/input/event3/ and 116 stand for? How do I obtain it?

移动到 的Nexus 4 。现在,我已经注意到,它有一个单独的powerkey和键盘处理程序

Moving on to the Nexus 4. Now, I've noticed that it has a separate powerkey and keypad handler

关于的SendEvent getevent 上XDA。

推荐答案

1 在中间的/ dev /输入/ EVENT3 / 116代表<一个HREF =htt​​ps://www.kernel.org/doc/Documentation/input/event-$c$cs.txt相对=nofollow> EV_KEY 事件类型常数:

The 1 "in-between /dev/input/event3/ and 116" stands for EV_KEY event type constant:


      
  • EV_KEY:
      用于描述的键盘,按钮,或其他键样的状态的变化
      设备。

  •   

您可能已经发现,在你自己,如果你已经用完 getevent -l的/ dev /输入/ EVENT3 / 和pressed电源键。

You could have found that on your own if you had run getevent -l /dev/input/event3/ and pressed the power key.

另外要找出电源键输入设备名称,我会推荐解析的输出 getevent -pl 而不是的/ proc /巴士/内容输入/设备。您正在寻找该器件具有 KEY_POWER 在事件一节中列出:

Also to find out the power key input device name I would recommend parsing output of getevent -pl instead of contents of /proc/bus/input/devices. The device you are looking for has KEY_POWER listed in the events section:

add device X: /dev/input/eventX
  name:     "xxxxxxxxxx"
  events:
    KEY (0001): KEY_POWER

和适当的长电源键preSS序列(如preSS并保持1秒钟,然后松开)将是:

And the proper long power key press sequence (as in press and hold for 1 second and then release) would be:

sendevent /dev/input/eventX 1 116 1
sendevent /dev/input/eventX 0 0 0
sleep 1
sendevent /dev/input/eventX 1 116 0
sendevent /dev/input/eventX 0 0 0

请注意: getevent -pl 不适用于姜饼及以下

Note: getevent -pl is not available for Gingerbread and below.

这篇关于执行cat / proc /巴士/输入/设备&QUOT;&QUOT的结果国米pretation;和亚行的shell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆