指定主副屏TP

38 阅读2分钟

目前有如下两种方式可以配置副屏TP: 1 修改EventHub.cpp 代码。 2 配置触摸屏的IDC文件。

1 修改代码 通过修改EventHub.cpp代码如下,在isExternalDeviceLocked 函数中判断设备名称为指定的副屏设备(例如副屏TP名称为gsl3673),则返回true。

image.png

或者通过productId指定

bool EventHub::Device::isExternalDeviceLocked() {

    if(identifier定义在
    Y:\pb-a3399bp\frameworks\native\include\input\InputDevice.h.product==0x0002){
       //ALOGD(" %d name: \"%s\"\n",__LINE__, identifier.name.string());
       return false;
    }
    if (configuration) {
        bool value;
        if (configuration->tryGetProperty(String8("device.internal"), value)) {
            return !value;
        }
    }
    return identifier.bus == BUS_USB || identifier.bus == BUS_BLUETOOTH;
}

其中 identifier定义在 frameworks\native\include\input\InputDevice.h

/*
 * Identifies a device.
 */
struct InputDeviceIdentifier {
    inline InputDeviceIdentifier() :
            bus(0), vendor(0), product(0), version(0) {
    }

    // Information provided by the kernel.
    std::string name;
    std::string location;
    std::string uniqueId;
    uint16_t bus;
    uint16_t vendor;
    uint16_t product;
    uint16_t version;

    // A composite input device descriptor string that uniquely identifies the device
    // even across reboots or reconnections.  The value of this field is used by
    // upper layers of the input system to associate settings with individual devices.
    // It is hashed from whatever kernel provided information is available.
    // Ideally, the way this value is computed should not change between Android releases
    // because that would invalidate persistent settings that rely on it.
    std::string descriptor;

    // A value added to uniquely identify a device in the absence of a unique id. This
    // is intended to be a minimum way to distinguish from other active devices and may
    // reuse values that are not associated with an input anymore.
    uint16_t nonce;

    /**
     * Return InputDeviceIdentifier.name that has been adjusted as follows:
     *     - all characters besides alphanumerics, dash,
     *       and underscore have been replaced with underscores.
     * This helps in situations where a file that matches the device name is needed,
     * while conforming to the filename limitations.
     */
    std::string getCanonicalName() const;
};

2 配置指定触摸屏设备的IDC文件 触摸屏设备对应的IDC文件中设置device.internal=0

image.png

3 查看配置是否成功 可以通过dumpsys input命令查看INPUT_DEVICE_CLASS_EXTERNAL 是否设置成功

4副屏方向设置 4.1 Rk3568 副屏方向配置 RK3568 存在双屏和三屏的使用场景: 在双屏场景下,副屏通过 persist.sys.rotation.einit-1 (属性值为 0,1,2,3)属性设置不同的方向 例如setprop persist.sys.rotation.einit-1 1,设置副屏旋转 90 度,设置该属性后需重启机器验证。

image.png

image.png

image.png