记录小米设备事件获取

来源:互联网 发布:putty软件下载 编辑:程序博客网 时间:2024/05/18 01:56

Android 系统里面有很多小工具,运行这些工具,我们可以掌握很多数据,再顺藤摸瓜,就可以针对设备做特殊的操作。


记录获取我手机的event信息,我的手机是小米版:

F:\eclipse\android_sdk-64\adt-bundle-windows-x86_64-20130219\sdk\platform-toolsadb shellshell@android:/ $ cat /proc/bus/input/devicescat /proc/bus/input/devicesI: Bus=0018 Vendor=0001 Product=0001 Version=0001N: Name="mione-keypad"---->特殊键 P: Phys=mione-keypad/input0S: Sysfs=/devices/platform/msm_ssbi.0/pm8058-core/pm8xxx-keypad/input/input0U: Uniq=H: Handlers=event0B: PROP=0B: EV=13B: KEY=40000000 0 0 0 0 0 0 10000 0 0 0 0 0 0 0 0 0 0 0 0 c0000 0 0 0B: MSC=10I: Bus=0018 Vendor=4654 Product=5000 Version=0100N: Name="ft5x0x"----> 触摸屏P: Phys=/devices/i2c-3/3-0038/input/input1S: Sysfs=/devices/i2c-3/3-0038/input/input1U: Uniq=H: Handlers=event1B: PROP=0B: EV=9B: ABS=6640000 0I: Bus=0000 Vendor=0000 Product=0000 Version=0000N: Name="pmic8xxx_pwrkey"---->按键P: Phys=pmic8xxx_pwrkey/input0S: Sysfs=/devices/platform/msm_ssbi.0/pm8058-core/pm8xxx-pwrkey/input/input2U: Uniq=H: Handlers=event2B: PROP=0B: EV=3B: KEY=100000 0 0 0I: Bus=0000 Vendor=0000 Product=0000 Version=0000N: Name="lightsensor"---->光感应器P: Phys=/devices/virtual/input/input3S: Sysfs=/devices/virtual/input/input3U: Uniq=H: Handlers=event3B: PROP=0B: EV=9B: ABS=100 0I: Bus=0000 Vendor=0000 Product=0000 Version=0000N: Name="proximity"---->近距离感应器(脸颊感应)P: Phys=/devices/virtual/input/input4S: Sysfs=/devices/virtual/input/input4U: Uniq=H: Handlers=event4B: PROP=0B: EV=9B: ABS=100 2000000I: Bus=0018 Vendor=0000 Product=0000 Version=0000N: Name="accelerometer"---->加速度计P: Phys=/devices/virtual/input/input5S: Sysfs=/devices/virtual/input/input5U: Uniq=H: Handlers=event5B: PROP=0B: EV=9B: ABS=7I: Bus=0018 Vendor=0000 Product=0000 Version=0000N: Name="compass"---->定位仪P: Phys=/devices/virtual/input/input6S: Sysfs=/devices/virtual/input/input6U: Uniq=H: Handlers=event6B: PROP=0B: EV=9B: ABS=7I: Bus=0000 Vendor=0000 Product=0000 Version=0000N: Name="8660_handset"---->线控按键P: Phys=pmic8058_othc/input0S: Sysfs=/devices/platform/msm_ssbi.0/pm8058-core/pm8058-othc.1/input/input7U: Uniq=H: Handlers=event7B: PROP=0B: EV=23B: KEY=10000 110 0 0 0 0 0B: SW=4

然后我们用getevent了解设备运作,getevent用来监听Handler 指定设备事件,如:
> adb shell getevent /dev/input/event1   (event1为屏幕事件)

接着点击一下手机屏幕,会看到类似以下内容:

[type] [code] [value]0003 0039 00000000   --》开始   (57)0003 0035 0000015d   --》x轴0x15d的位置 (53)0003 0036 0000011d   --》y轴0x11d的位置  (54)0003 003a 00000010   --》ABS_MT_PRESSURE  (58)0003 0032 00000010   --》ABS_MT_WIDTH_MAJOR  (50) 0000 0002 00000000   --》SYN                 (2)0000 0000 000000000003 0039 00000000   --》开始0003 0035 0000015d   --》x轴0x15d的位置0003 0036 0000011d   --》y轴0x11d的位置0003 003a 00000001   --》ABS_MT_PRESSURE 0003 0032 00000001   --》ABS_MT_WIDTH_MAJOR0000 0002 00000000   --》SYN0000 0000 000000000000 0002 000000000000 0000 00000000参见 /frameworks/base/include/ui/EventHub.h 可知code意义#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device (finger, pen, ...) */#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */

一次快速单击app图标触屏的监听:

getevent /dev/input/event1

0003 0039 00000037     初始化事件id0003 0039 00000000     初始化事件结束0003 0035 000000ae     坐标x0003 0036 000001ca     坐标y0003 003a 000000100003 0032 000000100000 0000 00000000     压下结束0003 003a 000000200003 0032 000000200000 0000 00000000     移动结束0003 0039 ffffffff     事件id清空0000 0000 00000000     一个事件的结束

原创粉丝点击