有没有人知道如何在Android上转储设备的HID描述符?我想得到几个HID描述符的解析转储并进行比较。干杯!
答案 0 :(得分:0)
答案 1 :(得分:0)
很容易列出所有输入设备adb shell中的命令如下:
I:\Users\linwei>adb shell getevent -S
add device 1: /dev/input/event6
name: "gpio-keys"
add device 2: /dev/input/event2
name: "alps"
add device 3: /dev/input/event5
name: "7k_handset"
add device 4: /dev/input/event4
name: "proximity_sensor"
add device 5: /dev/input/event3
name: "accelerometer_sensor"
add device 6: /dev/input/event1
name: "7x27a_kp"
add device 7: /dev/input/event0
name: "sec_touchscreen"
如果您想查看其中一个的详细信息。使用' getevent -i $ eventname'像这样显示:
I:\Users\linwei>adb shell getevent -i /dev/input/event1
add device 1: /dev/input/event1
bus: 0000
vendor 0000
product 0000
version 0000
name: "7x27a_kp"
location: ""
id: ""
version: 1.0.1
events:
KEY (0001): 0072 0073
input props:
<none>
因此,只需找到您隐藏设备名称并打印可能的信息。 如果要在Android上运行这些命令。您可以使用Runtime执行:
th = new Thread(new Runnable(){
private Process exec;
@Override
public void run() {
try {
exec = Runtime.getRuntime().exec(new String[]{"su","-c","getevent -i " + device});
InputStreamReader is = new InputStreamReader(
exec.getInputStream());
BufferedReader br = new BufferedReader(is);
String s;
while(((s = br.readLine()) != null) && run){
...
}
is.close();
exec.destroy();
} catch (IOException e) {
e.printStackTrace();
}
}