[Miscellaneous Android Development] YetAnotherForumUser:
Modified touchscreen driver, with rudimentary jitter filter

It might work, but is it the best way? Why not hack the driver itself instead? The mere fact that the driver is built into the kernel shall not stop the wily hacker...

So said, so done. I hacked up the driver (from the amlogic source) to be able to load it as a module (using Skrilax_CZ' symsearch module to be able to access the gpio_XXX calls). This new module can be loaded by first unbinding the built-in module, followed by loading the new module - it will bind to the touschscreen without problems.

unbinding the built-in driver is easy:

# echo "0-0055" > /sys/bus/i2c/drivers/Goodix-TS/unbind

You'll want to do this from within an adb shell session, for obvious reasons... You can go back to the original driver by unloading your alternative module (optional, but why not) and binding the built-in driver to the hardware:

# echo "0-0055" > /sys/bus/i2c/drivers/Goodix-TS/bind

The module loads and works OK in gingerbread. In ICS it works when you can get it to load/unload, but the system often locks up on unbinding the driver and/or loading the module.

For now I have only implemented a simple weighted filter which does not really produce usable results yet. I had a look at the filter code in InputReader.cpp and might experiment with that instead.

So far, this work has not resulted in an actual improvement - the screen still jitters and is a lot slower to respond. This is caused by the simpleminded filter I put in there, and that will have to be fixed. There are many ways to filter jitter, each with their own pros and cons. In this case we want a filter which is fast to respond (to limit lag) and effective at filtering low frequency noise.

I'll put the source online when I have a bit more time, now duty calls. If anyone has some ready-made filter code which you'd like to try, post the code and we can all have a go at hacking it.

---- (time passes, crickets chirp, the wind blows through the willows) ---

OK, found a spot of time to pack up some files, added to this post. Unpack the tarball in the kernel directory to hack on the driver, or unpack it anywhere to just extract the modules. To hack the driver, do a make menuconfig to include the symsearch module (it should be preselected) and change the goodix_touch driver to load as a module. Hack away, and do a 'make CROSS_COMPILE=arm-none-linux-gnueabi- modules' (replace CROSS_COMPILE with your own tool chain settings if you use a different one). Push the resulting modules to your device. Unbind the built-in driver and load the modules (symsearch first!). Be annoyed by the laggy touchscreen and decide that you can do better. Do better and show us the results. In code:

cd /var/src/amlogic/kernel <----- edit this path
tar xzf /path/to/goodix_touch-mod.tar.gz
make menuconfig
(change goodix_touch to load as a module)
make CROSS_COMPILE=arm-none-linux-gnueabi- modules <---- edit CROSS_COMPILE if needed
push drivers/misc/symsearch/symsearch.ko /sdcard/
push drivers/amlogic/input/touch_screen/goodix_touch.ko /sdcard/

adb shell
# echo "0-0055" > /sys/bus/i2c/drivers/Goodix-TS/unbind
# insmod /sdcard/symsearch.ko
# insmod /sdcard/goodix_touch.ko <--- this should make the touchscreen come alive

If you want to see some debugging info:

# echo 1 > /sys/devices/i2c-0/0-0055/debug

To stop the flood:

# echo 0 > /sys/devices/i2c-0/0-0055/debug

To go back to the built-in driver:

# rmmod goodix_touch
# echo "0-0055" > /sys/bus/i2c/drivers/Goodix-TS/bind

BTW, the new driver is called 'Goodix-TS-mod' (/sys/bus/i2c/drivers/Goodix-TS-mod)