zoukankan      html  css  js  c++  java
  • 记录小米设备事件获取

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


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

    F:eclipseandroid_sdk-64adt-bundle-windows-x86_64-20130219sdkplatform-tools
    adb shell
    shell@android:/ $ cat /proc/bus/input/devices
    cat /proc/bus/input/devices
    I: Bus=0018 Vendor=0001 Product=0001 Version=0001
    N: Name="mione-keypad"			---->特殊键 
    P: Phys=mione-keypad/input0
    S: Sysfs=/devices/platform/msm_ssbi.0/pm8058-core/pm8xxx-keypad/input/input0
    U: Uniq=
    H: Handlers=event0
    B: PROP=0
    B: EV=13
    B: KEY=40000000 0 0 0 0 0 0 10000 0 0 0 0 0 0 0 0 0 0 0 0 c0000 0 0 0
    B: MSC=10
    
    
    I: Bus=0018 Vendor=4654 Product=5000 Version=0100
    N: Name="ft5x0x"			----> 触摸屏
    P: Phys=/devices/i2c-3/3-0038/input/input1
    S: Sysfs=/devices/i2c-3/3-0038/input/input1
    U: Uniq=
    H: Handlers=event1
    B: PROP=0
    B: EV=9
    B: ABS=6640000 0
    
    
    I: Bus=0000 Vendor=0000 Product=0000 Version=0000
    N: Name="pmic8xxx_pwrkey"			---->按键
    P: Phys=pmic8xxx_pwrkey/input0
    S: Sysfs=/devices/platform/msm_ssbi.0/pm8058-core/pm8xxx-pwrkey/input/input2
    U: Uniq=
    H: Handlers=event2
    B: PROP=0
    B: EV=3
    B: KEY=100000 0 0 0
    
    
    I: Bus=0000 Vendor=0000 Product=0000 Version=0000
    N: Name="lightsensor"			---->光感应器
    P: Phys=/devices/virtual/input/input3
    S: Sysfs=/devices/virtual/input/input3
    U: Uniq=
    H: Handlers=event3
    B: PROP=0
    B: EV=9
    B: ABS=100 0
    
    
    I: Bus=0000 Vendor=0000 Product=0000 Version=0000
    N: Name="proximity"			---->近距离感应器(脸颊感应)
    P: Phys=/devices/virtual/input/input4
    S: Sysfs=/devices/virtual/input/input4
    U: Uniq=
    H: Handlers=event4
    B: PROP=0
    B: EV=9
    B: ABS=100 2000000
    
    
    I: Bus=0018 Vendor=0000 Product=0000 Version=0000
    N: Name="accelerometer"			---->加速度计
    P: Phys=/devices/virtual/input/input5
    S: Sysfs=/devices/virtual/input/input5
    U: Uniq=
    H: Handlers=event5
    B: PROP=0
    B: EV=9
    B: ABS=7
    
    
    I: Bus=0018 Vendor=0000 Product=0000 Version=0000
    N: Name="compass"			---->定位仪
    P: Phys=/devices/virtual/input/input6
    S: Sysfs=/devices/virtual/input/input6
    U: Uniq=
    H: Handlers=event6
    B: PROP=0
    B: EV=9
    B: ABS=7
    
    
    I: Bus=0000 Vendor=0000 Product=0000 Version=0000
    N: Name="8660_handset"			---->线控按键
    P: Phys=pmic8058_othc/input0
    S: Sysfs=/devices/platform/msm_ssbi.0/pm8058-core/pm8058-othc.1/input/input7
    U: Uniq=
    H: Handlers=event7
    B: PROP=0
    B: EV=23
    B: KEY=10000 110 0 0 0 0 0
    B: 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 00000000
    0003 0039 00000000   --》开始
    0003 0035 0000015d   --》x轴0x15d的位置
    0003 0036 0000011d   --》y轴0x11d的位置
    0003 003a 00000001   --》ABS_MT_PRESSURE 
    0003 0032 00000001   --》ABS_MT_WIDTH_MAJOR
    0000 0002 00000000   --》SYN
    0000 0000 00000000
    0000 0002 00000000
    0000 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     初始化事件id
    0003 0039 00000000     初始化事件结束
    0003 0035 000000ae     坐标x
    0003 0036 000001ca     坐标y
    0003 003a 00000010
    0003 0032 00000010
    0000 0000 00000000     压下结束
    0003 003a 00000020
    0003 0032 00000020
    0000 0000 00000000     移动结束
    0003 0039 ffffffff     事件id清空
    0000 0000 00000000     一个事件的结束


  • 相关阅读:
    ThinkPHP 中入口文件中的APP_DEBUG为TRUE时不报错,改为FALSE时报错
    ASP.NET LinqDataSource数据绑定后,遇到[MissingMethodException: 没有为该对象定义无参数的构造函数。]问题。
    error 2593 operator << 不明确的可能的解决方法
    C++读取mysql中utf8mb4编码表数据乱码问题及UTF8转GBK编码
    arcgis flexviewer中由Application向widget传值
    Flash Builder中“Error: #2036 加载未完成”错误的解决方法
    ArcGIS Server API for JavaScript调用错误:已阻止跨源请求:同源策略禁止读取位于......
    Win10下E3-1231 V3开启Intel虚拟化技术(vt-x)安装HAXM
    GPS accuracy in Android
    解决Win7旗舰版开机后无线网络识别非常慢的问题
  • 原文地址:https://www.cnblogs.com/suncoolcat/p/3290113.html
Copyright © 2011-2022 走看看