android主板带两个i2c tp接口,现在需要点两个不一样分辨率的屏,一个1920x1080 lvds(主屏),一个1366x768 edp(副屏),每个屏都是带有i2c触摸屏的,而且以及按对应的分辨率调好了。
如果使用相同触摸i2c的触摸屏,则需要拷贝一份驱动,然后把相应的驱动名称以及驱动的相关函数改一下即可,如是gt9xx,可以在驱动名称以及驱动函数中将gt9xx改为gt9xx_2。现在要做双屏异触,但是接起来测试的时候。edp对应的触摸分辨率却是不对的。不能够完整的触摸到整个界面。
后面想到edp是副屏用,对应的触摸屏也应该要做副设备处理。i2c触摸默认是做主设备上报的。解决办法就是在frameworks/native/services/inputflinger/reader/EventHub.cpp中,将edp副屏对应的触摸配置为InputDeviceClass::EXTERNAL类型的设备。
首先将openDeviceLocked函数中的设备信息打印出来。可以直接修改ALOGV为ALOGI。
@@ -2013,17 +2017,17 @@ void EventHub::openDeviceLocked(const std::string& devicePath) {
int32_t deviceId = mNextDeviceId++;
std::unique_ptr<Device> device = std::make_unique<Device>(fd, deviceId, devicePath, identifier);
- ALOGV("add device %d: %s\n", deviceId, devicePath.c_str());
- ALOGV(" bus: %04x\n"
+ ALOGI("add device %d: %s\n", deviceId, devicePath.c_str());
+ ALOGI(" bus: %04x\n"
" vendor %04x\n"
" product %04x\n"
" version %04x\n",
identifier.bus, identifier.vendor, identifier.product, identifier.version);
- ALOGV(" name: \"%s\"\n", identifier.name.c_str());
- ALOGV(" location: \"%s\"\n", identifier.location.c_str());
- ALOGV(" unique id: \"%s\"\n", identifier.uniqueId.c_str());
- ALOGV(" descriptor: \"%s\"\n", identifier.descriptor.c_str());
- ALOGV(" driver: v%d.%d.%d\n", driverVersion >> 16, (driverVersion >> 8) & 0xff,
+ ALOGI(" name: \"%s\"\n", identifier.name.c_str());
+ ALOGI(" location: \"%s\"\n", identifier.location.c_str());
+ ALOGI(" unique id: \"%s\"\n", identifier.uniqueId.c_str());
+ ALOGI(" descriptor: \"%s\"\n", identifier.descriptor.c_str());
+ ALOGI(" driver: v%d.%d.%d\n", driverVersion >> 16, (driverVersion >> 8) & 0xff,
driverVersion & 0xff);
// Load the configuration file for the device.
然后判断设备是否是触摸设备,并根据设备的name名称或者location信息来做判断,是否将其设置为EXTERNAL设备。如下面代码为将触摸名称gt9xx的触摸配置为主触摸,其他的为副触摸。
+ if(device->classes.test(InputDeviceClass::TOUCH) || device->classes.test(InputDeviceClass::TOUCH_MT)) {
+ if(!strstr(identifier.name.c_str(), "gt9xx")){
+ ALOGI("touchscreen:%s used to main devices",identifier.name.c_str());
+ }else{
+ ALOGI("touchscreen:%s used to external devices",identifier.name.c_str());
+ device->classes |= InputDeviceClass::EXTERNAL;
+ }
+ }
+ }
if (device->classes.any(InputDeviceClass::JOYSTICK | InputDeviceClass::DPAD) &&
device->classes.test(InputDeviceClass::GAMEPAD)) {