android4.0与2.3版本的TP代码区别

来源:互联网 发布:seo去哪里接私活 编辑:程序博客网 时间:2024/06/03 17:22
  
   在android2.3上调试TP时,只需要把linux驱动调通,android就可以正常使用了,而到android4.0上又有些不同了,针对linux驱动,需添加如下内容:
   1、在手指按下时需调用如下函数上报Key Down:
      input_report_key(structinput_dev *input, BTN_TOUCH, 1);
   2、在手指释放时需调用如下函数上报Key Up:
      input_report_key(struct input_dev *input,BTN_TOUCH, 0);
   这样通过的话,可以在android4.0上看到有鼠标指针(圆圈)可以移动,把触摸屏做成了笔记本电脑上的鼠标触摸屏了,后来再查了下,原来需要添加一个idc文件,具体识别优先级参考:http://source.android.com/tech/input/input-device-configuration-files.html这篇文档,会按下面的顺序识别配置文件:
  • /system/usr/idc/Vendor_XXXX_Product_XXXX_Version_XXXX.idc
  • /system/usr/idc/Vendor_XXXX_Product_XXXX.idc
  • /system/usr/idc/DEVICE_NAME.idc
  • /data/system/devices/idc/Vendor_XXXX_Product_XXXX_Version_XXXX.idc
  • /data/system/devices/idc/Vendor_XXXX_Product_XXXX.idc
  • /data/system/devices/idc/DEVICE_NAME.idc
  为了方便,我直接创建一个“设备名.idc”的文件,直接放到/system/usr/idc/目录下,相应的内容参考如下:
   # BasicParameters
   touch.deviceType =touchScreen
   touch.orientationAware =1

   # Size
   touch.size.calibration =diameter
   touch.size.scale =10
   touch.size.bias = 0
   touch.size.isSummed =0

   # Pressure
   # Driver reports signalstrength as pressure.
   #
   # A normal thumb touchtypically registers about 200 signal strength
   # units although we don'texpect these values to be accurate.
  touch.pressure.calibration = amplitude
   touch.pressure.scale =0.005

   # Orientation
  touch.orientation.calibration = none
  这样配置好后,在android4.0上的TP就可以正常使用了,而不会成为滑鼠触屏了。
   参考文档:http://source.android.com/tech/input/input-device-configuration-files.html

原创粉丝点击