Replacing Touchscreen driver in Android Kernel

35,754

I succeeded to integrate the touchscreen driver. Here is a rough idea of the steps just to give an idea of how it works for the others who would face the same kind of problem.

First remove the original touchscreen driver to prevent conflict (make xconfig)

Originally, I had a driver that doesn't work eventhough it was provided by the touchscreen manufacturer. I decided to try the eGalax touchscreen driver already in the Kernel tree. This is a module driver. It is not enough to enable "module device drivers" in the make xconfig. Yes, it will allow to compile the .ko files. but it will not tell the building script what to do with the file.ko and they will not end up going with the kernel in the target system. So you have to take action by adding stuff to the build script or manually copy the file.ko in the proper root/modules location and add the loading of the module with the "insmod /modules/file.ko" command in the init.rc file. Don't forget to set the proper privileged to /modules and modules/file.ko with chmod command.

After that it basically worked, except for some minor problems not related to that question (the driver was for a slightly different chip with bits placed differently, easy to fix).

Share:
35,754
Sylvain Huard
Author by

Sylvain Huard

I work mainly on embedded system projects. I usually work on everything closer to the machine like hardware (analog, digital, FPGAs), BSPs, Kernel, drivers while still being involved in the application itself. In the past couple years, I mainly worked on building custom platforms SOC FPGAs porting Linux Kernel and Android to it. I also spent quiet a bit of time on system design and FPGA design with VHDL. I wrote a few simple Android apps. I've been using Python as a modelling tool for FPGA algorithms and as an analysis tool for data coming from FPGA simulations. All of that keeps quiet busy...

Updated on July 09, 2022

Comments

  • Sylvain Huard
    Sylvain Huard almost 2 years

    I'm adapting a Gingerbread kernel for my custom board. I'm trying to replace a resistive touch screen that uses an on-chip ADC controller (S5PV210 processor from Samsung). In my design, I need a capacitive controller supported by eGalaxyTouch driver. It's connected to the USB. The driver can be easily enabled from the "make xconfig" menu. It somewhat works since I added some traces on the serial console and I can see it installing during the kernel boot and I see it install and uninstall itself when connecting/disconnecting the USB cable. But it doesn't do anything in the Android user interface. It is an HID type device. The problem is it does not hook-up to the proper Android touchscreen software layer. I must have miss something. There must be something else to call to force this HID to be connected to another software layer managing the touchscreen.

    The touchscreen drivers are located at kernel/drivers/input/touchscreen. There is also some code straight in kernel/drivers/input.

    Any clues on how to link that HID device to the Android Touchscreen layer? I look how they did the old resistive one and it is not done through an HID because it's a "custom made" device with ADCs integrated in the CPU and it's not going through USB.

  • Mohammed Azharuddin Shaikh
    Mohammed Azharuddin Shaikh about 11 years
    can you tell how one can change/modify the kernel of device?, me too having the same requirement
  • Sylvain Huard
    Sylvain Huard about 11 years
    First of all, you should have the full source code of the kernel of the board you are using. If not, you will have to start from scratch and integrate the drivers for each and every piece of hardware you have on the board. It is a very long task. If you made your own CPU card, you most likely started from a reference design to not re-invent the wheel. You should start with the same kernel source and tool configuration that is used for the reference design you're design is based on. If you want to do the whole thing by yourself, think about time to market... Kernel is 30 000+files