平台: RK3399 android12。
客户整机是USB接口的TP且需要双屏异触,方案如下。
双屏异触的修改方法有两种:
1、修改 EventHub.cpp 代码。
2、 配置触摸屏的IDC文件。
这里采取第二次方法。
通过 adb shell dumpsys input 确认触摸屏的PID和VID。补丁如下:
Index: device/rockchip/rk3399/Vendor_32d7_Product_0001.idc =================================================================== --- device/rockchip/rk3399/Vendor_32d7_Product_0001.idc (nonexistent) +++ device/rockchip/rk3399/Vendor_32d7_Product_0001.idc (revision 2735) @@ -0,0 +1,12 @@ +# Filename:Vendor_32d7_Product_0001.idc +# My TouchScreen Device configuration file. + +touch.deviceType = touchScreen +device.internal = 0 +touch.orientationAware = 1 + +keyboard.layout = Vendor_32d7_Product_0001 +keyboard.orientationAware = 1 + +cursor.mode = navigation +cursor.orientationAware = 1 \ No newline at end of file Property changes on: device/rockchip/rk3399/Vendor_32d7_Product_0001.idc ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: device/rockchip/rk3399/Vendor_32d7_Product_0002.idc =================================================================== --- device/rockchip/rk3399/Vendor_32d7_Product_0002.idc (nonexistent) +++ device/rockchip/rk3399/Vendor_32d7_Product_0002.idc (revision 2735) @@ -0,0 +1,12 @@ +# Filename:Vendor_32d7_Product_0002.idc +# My TouchScreen Device configuration file. + +touch.deviceType = touchScreen +device.internal = 1 +touch.orientationAware = 1 + +keyboard.layout = Vendor_32d7_Product_0002 +keyboard.orientationAware = 1 + +cursor.mode = navigation +cursor.orientationAware = 1 \ No newline at end of file Property changes on: device/rockchip/rk3399/Vendor_32d7_Product_0002.idc ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: device/rockchip/rk3399/device.mk =================================================================== --- device/rockchip/rk3399/device.mk (revision 2734) +++ device/rockchip/rk3399/device.mk (revision 2735) @@ -134,6 +134,10 @@ PRODUCT_COPY_FILES += \ device/rockchip/rk3399/public.libraries.txt:vendor/etc/public.libraries.txt +PRODUCT_COPY_FILES += \ + device/rockchip/rk3399/Vendor_32d7_Product_0001.idc:system/usr/idc/Vendor_32d7_Product_0001.idc \ + device/rockchip/rk3399/Vendor_32d7_Product_0002.idc:system/usr/idc/Vendor_32d7_Product_0002.idc + #fireware for dp PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/dptx.bin:root/lib/firmware/rockchip/dptx.bin
此方法 是在系统是0度情况下验证是OK的。如果系统默认是270度的即:SF_PRIMARY_DISPLAY_ORIENTATION := 270
副屏也旋转270度,persist.sys.rotation.einit=3
那么需要在IDC文件里面配置屏幕的初始旋转角度。例如:
Index: device/rockchip/rk3399/Vendor_32d7_Product_0001.idc =================================================================== --- device/rockchip/rk3399/Vendor_32d7_Product_0001.idc (revision 2736) +++ device/rockchip/rk3399/Vendor_32d7_Product_0001.idc (revision 2737) @@ -4,6 +4,7 @@ touch.deviceType = touchScreen device.internal = 0 touch.orientationAware = 1 +touch.orientation = ORIENTATION_0 keyboard.layout = Vendor_32d7_Product_0001 keyboard.orientationAware = 1 Index: device/rockchip/rk3399/Vendor_32d7_Product_0002.idc =================================================================== --- device/rockchip/rk3399/Vendor_32d7_Product_0002.idc (revision 2736) +++ device/rockchip/rk3399/Vendor_32d7_Product_0002.idc (revision 2737) @@ -4,6 +4,7 @@ touch.deviceType = touchScreen device.internal = 1 touch.orientationAware = 1 +touch.orientation = ORIENTATION_270 keyboard.layout = Vendor_32d7_Product_0002 keyboard.orientationAware = 1
IDC文件的解析是在frameworks/native/services/inputflinger/reader/mapper/TouchInputMapper.cpp 文件里面的configureParameters 函数里进行配置。
device.internal
定义:device.internal
= 0
| 1
指定输入设备属于内置组件,还是外部连接(很可能可拆卸)的外围设备。
-
如果值为
0
,则该设备为外部设备。 -
如果值为
1
,则该设备为内部设备。 -
如果未指定该值,则 USB (BUS_USB) 或蓝牙 (BUS_BLUETOOTH) 总线上的所有设备的默认值均为
0
,否则,值为1
。
touch.orientationAware = 1 确保触摸屏后续能够和显示一起旋转。
IDC文件的具体配置可以参考谷歌文档:https://source.android.google.cn/docs/core/interaction/input/touch-devices?hl=zh-cn
疑问:
因为通过IDC文件来进行区分主副屏的TP,发现通过系统属性SF_PRIMARY_DISPLAY_ORIENTATION来设置主屏幕的旋转角度,那么主屏的touch.orientation 需要一起旋转相同的角度。
副屏是通过 persist.sys.rotation.einit 来设置旋转角度。副屏TP必须 touch.orientation = ORIENTATION_0 ,否则副屏TP 是对不上的。
为什么会存在这种差异?
新需求:
因为客户的整机主副屏存在多种角度的组合。需要一个统一的方法来实现双屏异触。这个目前还没有实现。
标签:异触,Vendor,双屏,Product,rockchip,android12,device,32d7,idc From: https://www.cnblogs.com/dodo-asw/p/18129635