当前位置: 移动技术网 > IT编程>移动开发>Android > android4.0与2.3版本的TP代码区别解析

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

2019年07月24日  | 移动技术网IT编程  | 我要评论

与美男群居的日子,ecs精英,丁少华资料

通常来说在android2.3上调试tp时,只需要把linux驱动调通,android就可以正常使用了。但是到了android4.0上又有些不同了,针对linux驱动,需添加如下一些内容:

1、在手指按下时需调用如下函数上报key down:

input_report_key(struct input_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/目录下,相应的内容参考如下:

# basic parameters
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 signal strength as pressure.
#
# a normal thumb touch typically registers about 200 signal strength
# units although we don't expect these values to be accurate.
touch.pressure.calibration = amplitude
touch.pressure.scale = 0.005

# orientation
touch.orientation.calibration = none

这样配置好后,在android4.0上的tp就可以正常使用了,而不会成为滑鼠触屏了。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网