【RK3288 Android10 T8pro usb hid-multitouch idc配置】
文章目录
- 【RK3288 Android10 T8pro usb hid-multitouch idc配置】
- 背景
- 代码分析
- 1. 读取配置文件
- 2. 标志内外置屏幕
- 3. 设置输入设备
- 4. findviewport()
- 5. 根据对应的viewport来计算相应的mapping的参数
- 结论
背景
T8pro Android10,使用usb接口的hid-multitouch触摸,发现触摸映射区域异常,后来增加了idc文件,指定映射到主屏后正常。本文档主要分析一下idc文件的作用。
代码分析
1. 读取配置文件
这里会读取配置文件,及我们自己添加的触摸的idc(inputdeviceconfiguration),如果有这个idc配置文件,就回去读取device.internal这个属性,如果是1,则表示是内置,isExternalDeviceLocked返回0.
如果没有配置文件,就会返回总线类型是否是usb(0003)或者蓝牙。可以从下面的日志中看到我们的usb hid-multitouch是usb总线的。所以返回1,表示是内置。
05-15 14:04:26.766 387 478 E EventHub: liangji add device 1: /dev/input/event2
05-15 14:04:26.766 387 478 E EventHub: liangji bus: 0003
05-15 14:04:26.766 387 478 E EventHub: liangji name: "USBest Technology SiS HID Touch Controller"
05-15 14:04:26.766 387 478 E EventHub: liangji location: "usb-ff500000.usb-1.4/input0"
05-15 14:04:26.766 387 478 E EventHub: liangji unique id: ""
05-15 14:04:26.767 387 478 E EventHub: liangji descriptor: "bc7b0abb0520bb52c8097b668a54d31978583d09"
...
05-15 14:04:26.770 387 478 E EventHub: liangji New device: id=1, fd=127, path='/dev/input/event2', name='USBest Technology SiS HID Touch Controller', classes=0x80000014, configuration='/system/usr/idc/Vendor_0457_Product_f817.idc', keyLayout='', keyCharacterMap='', builtinKeyboard=false,
2. 标志内外置屏幕
根据isExternalDeviceLocked()的返回,这里会|=上外置的标志,
INPUT_DEVICE_CLASS_EXTERNAL = 0X80000000
3. 设置输入设备
这里会用上面2中的标志位来进行判断是否是内置还是外置,然后设置到对应的inputdevice中去
4. findviewport()
TouchInputMapper::configure()中最终执行映射的是在TouchInputMapper::configuresurface中(),里面会调用findviewport(),根据是external还是internal来获取对应的DisplayViewport
这里我们可以看到如果外置视窗如果获取失败了,就默认新建一个内置视窗,所以T8使用usb触摸+单屏+无idc配置也能正常触摸。
5. 根据对应的viewport来计算相应的mapping的参数
下图是出错时的现象,由于没有设置idc,导致isExternalDeviceLocked返回1,默认usb总线是外置设备。然后findviewport获取到的实际上是虚线部分,并且physicalTOP的坐标符号不正确,导致后来计算出奇怪的映射范围
####这里是有添加idc文件,指定内置设备的时候获取的内置视窗数值,如上图实线所示
05-15 11:19:30.973 384 475 E InputReader: liangji ----------------------------------------
05-15 11:19:30.973 384 475 E InputReader: liangji mViewport.logicalBottom = 800, mViewport.logicalTop = 0
05-15 11:19:30.973 384 475 E InputReader: liangji mViewport.logicalRight = 1280, mViewport.logicalLeft = 005-15 11:19:30.973 384 475 E InputReader: liangji mViewport.physicalBottom = 800, mViewport.physicalTop = 0
05-15 11:19:30.973 384 475 E InputReader: liangji mViewport.physicalRight = 1280, mViewport.physicalLeft = 005-15 11:19:30.973 384 475 E InputReader: liangji mViewport.deviceHeight = 800, mViewport.deviceWidth = 128005-15 11:19:30.973 384 475 E InputReader: liangji naturalLogicalWidth = 1280, naturalLogicalHeight = 800
05-15 11:19:30.973 384 475 E InputReader: liangji naturalPhysicalWidth = 1280, naturalPhysicalHeight = 800
05-15 11:19:30.973 384 475 E InputReader: liangji naturalPhysicalLeft = 0, naturalPhysicalTop = 0
05-15 11:19:30.973 384 475 E InputReader: liangji naturalDeviceWidth = 1280, naturalDeviceHeight = 800
05-15 11:19:30.973 384 475 E InputReader: liangji ----------------------------------------
05-15 11:19:30.973 384 475 E InputReader: liangji Device reconfigured: id=1, name='USBest Technology SiS HID Touch Controller', size 1280x800, orientation 0, mode 1, display id 0####这里是未添加idc文件,或者是idc里面指定外置的时候,获取的外置视窗数值,如上图虚线所示
05-15 11:28:31.334 387 477 E InputReader: liangji ----------------------------------------
05-15 11:28:31.334 387 477 E InputReader: liangji mViewport.logicalBottom = 800, mViewport.logicalTop = 0
05-15 11:28:31.334 387 477 E InputReader: liangji mViewport.logicalRight = 1280, mViewport.logicalLeft = 005-15 11:28:31.334 387 477 E InputReader: liangji mViewport.physicalBottom = 1297, mViewport.physicalTop = 622
05-15 11:28:31.335 387 477 E InputReader: liangji mViewport.physicalRight = 1080, mViewport.physicalLeft = 005-15 11:28:31.335 387 477 E InputReader: liangji mViewport.deviceHeight = 1920, mViewport.deviceWidth = 108005-15 11:28:31.335 387 477 E InputReader: liangji naturalLogicalWidth = 800, naturalLogicalHeight = 1280
05-15 11:28:31.335 387 477 E InputReader: liangji naturalPhysicalWidth = 675, naturalPhysicalHeight = 1080
05-15 11:28:31.335 387 477 E InputReader: liangji naturalPhysicalLeft = 623, naturalPhysicalTop = 0
05-15 11:28:31.335 387 477 E InputReader: liangji naturalDeviceWidth = 1920, naturalDeviceHeight = 1080
05-15 11:28:31.335 387 477 E InputReader: liangji ----------------------------------------
05-15 11:28:31.335 387 477 E InputReader: liangji Device reconfigured: id=1, name='USBest Technology SiS HID Touch Controller', size 2275x1280, orientation 1, mode 1, display id 0
05-15 11:28:31.335 387 477 E EventHub: liangji EventHub::getDeviceLocked deviceId = 1, index = 1
结论
触摸
如果不是使用usb总线,即便是双屏也无需配置idc
如果是usb总线触摸,双屏显示时必须配置idc,且idc内部必须指定devic.internal=1;单屏可以不配置idc。