Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Rock5/guide/Touch Screen Portable Monitor

< Rock5‎ | guide
Revision as of 11:01, 12 April 2023 by Yanw (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page is how rock5 created the IDC file for Touch Screen Portable Monitor

What is idc?

idc (Input Device Configuration) is an input device configuration file, which contains device-specific configuration attributes that affect the behavior of the input device. For touch screen devices, an idc file is always required to define its behavior.

How to edit IDC files

Confirm the VID and PID of the Touch Screen.

  $ lsusb
  Bus 002 Device 005: ID 27c0:0858

Name the IDC file according to the ID.

  $ ls /system/usr/idc
  Vendor_27c0_Product_0858.idc

Edit IDC file

  $ cat Vendor_27c0_Product_0858.idc
  touch.deviceType = touchScreen
  device.internal= 1
  touch.orientationAware = 1
  keyboard.layout = Vendor_27c0_Product_0858
  keyboard.orientationAware = 1
  cursor.mode = navigation
  cursor.orientationAware = 1

The specific attribute configuration of the file can refer to https://source.android.com/docs/core/interaction/input/input-device-configuration-files

How to load IDC file

Create an IDC file under the device/rockchip/rk3588 directory of the SDK.

 $ vim  Vendor_27c0_Product_0858.idc

Add in the device.mk file.

 PRODUCT_COPY_FILES += $(LOCAL_PATH)/Vendor_27c0_Product_0858.idc:$(TARGET_COPY_OUT_SYSTEM)/usr/idc/Vendor_27c0_Product_0858.idc

Recompile the firmware.

 $ source build/envsetup.sh
 $ lunch ${PRODUCT_NAME}-userdebug
 $ ./build.sh -Au

FAQ

how to rotate the screen.

Modify the value of SF_PRIMARY_DISPLAY_ORIENTATION in device/rockchip/rk3588/BoardConfig.mk
 
 - SF_PRIMARY_DISPLAY_ORIENTATION := 0
 + SF_PRIMARY_DISPLAY_ORIENTATION := 270

The touch screen cannot rotate with the screen.

 Add a patch to the framework/native directory,the content is as follows
 
 diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
 index decbea4c3e..42c4612159 100644
 --- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp
 +++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
 @@ -17,7 +17,7 @@
 #include "../Macros.h"
  
 #include "TouchInputMapper.h"
 -
 +#include "cutils/properties.h"
  #include "CursorButtonAccumulator.h"
  #include "CursorScrollAccumulator.h"
  #include "TouchButtonAccumulator.h" 
 @@ -668,6 +668,29 @@ void TouchInputMapper::configureSurface(nsecs_t when, bool* outResetNeeded) {
    if (viewportChanged) {
        mViewport = *newViewport;

 +         char buffer_orientation[270];
 +        memset(buffer_orientation, 0, sizeof(buffer_orientation));
 +        property_get("persist.sys.panel.flip", buffer_orientation, "270");
 +        int cmpRet = atoi(buffer_orientation);
 +        ALOGE("persist.sys.hwrotation= %d",cmpRet);
 +        if (cmpRet == 0)
 +        {
 +            mViewport.orientation = DISPLAY_ORIENTATION_0;
 +        }
 +
 +        else if (cmpRet == 90)
 +        {
 +            mViewport.orientation = DISPLAY_ORIENTATION_90;
 +        }
 +        else if (cmpRet == 180)
 +        {
 +            mViewport.orientation = DISPLAY_ORIENTATION_180;
 +        }
 +        else if (cmpRet == 270)
 +        {
 +            mViewport.orientation = DISPLAY_ORIENTATION_270;
 +        }
 +
        if (mDeviceMode == DEVICE_MODE_DIRECT || mDeviceMode == DEVICE_MODE_POINTER) {
            // Convert rotated viewport to natural surface coordinates.
            int32_t naturalLogicalWidth, naturalLogicalHeight;
 --