1. open错误

在InputReader::addDeviceLocked中open设备文件出错。

原因:没有权限。

解决方法:

修改:system/core/rootdir/init.rc

chmod 0666 /dev/xxx

重编内核。


2. 坐标错误

获得鼠标当前坐标位置(x,y)

mPointerController->getPosition(&x, &y);

将该坐标(x,y)传到驱动,再模拟该点的点击事件,出现坐标错误。

原因:

在PointerController类中,坐标根据显示方向displayOrientation做了调整,但CursorInputMapper中没有。

底层的坐标系统也不随显示方向变化。

解决方法:

在CursorInputMapper中无法获取mPointerController的displayOrientation(私有),

同时,CursorInputMapper中mParameters.orientationAware为false。

如果把它设为true,会发现鼠标移动也跟着变了,即鼠标的上下移动变成了光标的左右移动。

所以,只能在CursorInputMapper::configure中利用config->getDisplayInfo获取方向,

存到一个新定义的变量g_orientation中,而不要修改CursorInputMapper::mOrientation的值。


Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐