Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lopestom/685cdd9c71476e9daf95ca612066e23f to your computer and use it in GitHub Desktop.
Save lopestom/685cdd9c71476e9daf95ca612066e23f to your computer and use it in GitHub Desktop.
Fixing Touchscreen - custom recovery

Touchscreen not working in custom recovery on Mediatek devices - MTK - mtxxxx

This is not a complete guide. But a start for future discussions.

A little information

As far as we know, companies may or may not include touchscreen drivers in the kernel. In such situations, experts analyze the kernel and modify it to include the correct driver and try to make the touch screen work. If you've seen the situation happen and you don't have extra touchscreen driver files, go to the links to learn about it or ask for help:

How to modify a (Meditek) Android kernel - github thanks for @ADeadTrousers

Unlocking touchpad driver when booting in recovery mode on MTK processors - 4pda thanks for Chela_vek

Touch Input not working on TWRP 3.1.1 for Mediatek MT6753 Device - github

Current Conditions

Nowadays, some companies have decided to separate into a file or other files that can determine touchscreen drivers and touchscreen operation. In this sense, it is important for those who are going to compile the custom recovery to pay attention to some definitions in the device tree and to the correct files.

Some time ago I saw some devices with these details and today I also had to think about it because I received a device with the same problem. I researched some possible solutions and left posts here: Problem with touch screen

I've even made some changes like this before but I had no idea it was a solution to the problem because there were no devices available to solve it.

Now everyone who is going to collect (compile or PORTing) custom recovery should pay attention to firmware files

Is need the stock ROM to get the vendor.img and extracting that to have \vendor\firmware\files - May have one or more files.

  • With PORTing

    • Copy the files like novatek****.bin and or chippone-tddi-****.bin (specially for XiaoMi devices) in the \ramdisk\vendor\firmware\
    • Repack and have the new-file.img
    • Test.
  • Compiling

    • Add files to the device tree in the same way in the structure device_manufacture_model /recovery/root/vendor/firmware/files

    • Change false or unset # the device_manufacture_model/BoardConfig.mk option

      TW_SCREEN_BLANK_ON_BOOT := true

      for this

      #TW_SCREEN_BLANK_ON_BOOT := true

Some devices come with additional locks, and only those who understand the source code of the device can try to change something and do the necessary tests. I'm talking about compiling a new kernel, which is more complicated. But there is a thread for this on xda or 4pda.

It all depends on what you have and what you can do.

📴

Touchscreen not working in custom recovery on Mediatek devices - MTK Helio - mtxxxx

New information

Since I started understanding and building Custom Recovery years ago, I've come across device trees mainly for Qualcomm about including drivers and modules so that sensors like vibration and screen touch can work.

Since I wrote Touchscreen not working in custom recovery on Mediatek devices - MTK - mtxxxx I really tried to solve it through the guide.

Experience and Knowledge

But there is no proprietary files in /vendor/firmware/*files for touch screen* that can fix touch screen. Since I wrote the previous guide, I went looking for a specific file. Then I remembered my previous experience with Qualcomm. This means that in order to use some sensors we put the appropriate module file. So I thought I'd look up the module file for the touchscreen.

It remained only to find out which file is responsible for touching the screen.

Of so many existing module files in /recovery/root/lib/modules/ I didn't find anything. I remembered that there are more module files in /vendor/lib/modules/ and I had to look for some interesting files. Then I found the ilitek_v3.ko file and searched => ILITEK Touch Screen Driver Controller.

Added corresponding flag in the device tree:

TW_LOAD_VENDOR_MODULES := "ilitek_v3.ko"

Use debugging tool

Before any correction, it is also important to think technically with the parallel help of logcat - dmesg - or any debugging tool. I did it myself and then forgot, because I went by intuition. But many times we must and can find errors and correct them quickly.

In the logcat file I made, I looked for words like TOUCH and this came up:

11-19 19:44:10.973 1387 1569 D EventHub: No input device configuration file found for device 'ILITEK_TDDI'.
11-19 19:44:10.976 1387 1569 I EventHub: New device: id=2, fd=214, path='/dev/input/event3', name='ILITEK_TDDI', classes=KEYBOARD | TOUCH | TOUCH_MT, configuration='', keyLayout='/system/usr/keylayout/Generic.kl', keyCharacterMap='/system/usr/keychars/Generic.kcm', builtinKeyboard=false,
11-19 19:44:10.986 1387 1569 I InputReader: Touch device 'ILITEK_TDDI' could not query the properties of its associated display. The device will be inoperable until the display size becomes available.
11-19 19:44:10.986 1387 1569 I InputReader: Device added: id=5, eventHubId=2, name='ILITEK_TDDI', descriptor='ce54e173162f908fc75d1d0abe2023f80d6773d1',sources=0x00001103
11-19 19:44:11.004 1387 1387 W InputReader: Device ILITEK_TDDI is associated with display ADISPLAY_ID_NONE.
11-19 19:44:11.012 1387 1569 I InputReader: Disabling ILITEK_TDDI (device 5) because the associated viewport is not active
11-19 19:44:11.814 1387 1569 I InputReader: Device reconfigured: id=5, name='ILITEK_TDDI', size 720x1600, orientation 0, mode 1, display id 0

Updating some information for Android 13.

Use deviceinfohw app and in settings select admin part or full information part. Go to the main part of the application and you will see a line with a touch screen - touchscreen.

Click to open Example

Example

To make it more clear, you should know the name of the *.ko file that refers to the touchscreen driver. Depending on the name that appears in deviceinfohw app, the *.ko file may be located in the firmware img files: \vendor\lib\modules\ or/and \vendor_dlkm\lib\modules\ ;

The *_fw.bin files can be located in the \vendor\firmware\ folder;

Sometimes the touchscreen driver file name is not the same as the *.ko file or even the *_fw.bin file. Therefore, you must be sure that some *.ko or *_fw.bin file is a touchscreen driver.

Many devices have *.ko and *_fw.bin files, but the touchscreen driver is located directly in the kernel. So there is no need to add *.ko or *_fw.bin files apart from modules.


Then you realize you've chosen the right direction to fix with the specified driver.

Compile img file and test if that solve touchscreen.

📴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment