A part of the thrill of using custom hardware is that eventually you will run across an obstacle. The resistive touchscreen that's used in the Lilliput and Xenarc monitors presented quite the thrill when connecting it to the ODROID-X2.

Upon plugging in the USB connector the initial response is delightful. The touchscreen will automatically begin responding to touch. The problem lies in where those touches occur based on the position of your finger on the screen. The X and Y axes are reversed, leaving you with a touchscreen that cant really be used. Unfortunately, the solution isn't as easy as it would be in Windows, where a simple recalibration of the touchscreen would correct the issue. The driver that allows the touchscreen to operate on the ODROID-X2 is a part of the system kernel files, and the only real way to apply any fix is to recompile the OS with the modified kernel files.

Luckily I have Googled enough to stumble on an easy to use guide to correct the issue and get the ODROID-X2 working in harmony with our standard touchscreen fare. This solution may work on other Android development boards, but obviously your source files will vary.

I must note that I take NO credit for the solutions presented here. It's mostly a combination of information found at these two sources:


-A computer running Ubuntu
-Android SDK with ADB installed (I used this guide to set it up)
-Download the Toolchain application for Ubuntu from here
-Download the Android Beta 1.6 Kernel Sources from here

1. Open the Terminal application in Ubuntu and run the following command. You will need admin access as well as the admin password as these are root commands:
sudo apt-get install build-essential libqt4-dev xz
2. If your Ubuntu is installed on a 64bit machine, you will need to run the following commands (if not, go to step 3)
sudo apt-get install package-name:i386
sudo apt-get update
sudo-apt-get install ia32-libs
3.Run these commands to install and configure Toolchain:
tar -jxvf arm-2010q1.tar.xz
cd arm-2010q1/bin
export CROSS_COMPILE=`pwd`/arm-none-linux-gnueabi-
4.Unpack the kernel sources. Run the following commands:
tar zxvf kernel_4412.tar.gz
cd kernel_4412
5.Configure Toolchain for your ODROID-X2 storage type.
If using the eMMC module enter:
make ARCH=arm odroidx2_android_emmc_defconfig
If using an SD card enter:
make ARCH=odroidx2_android_sdmmc_defconfig
6.At this point you can minimize terminal, and navigate to the directory where your kernel sources were unzipped (should be in Home folder, a folder called kernel_4412). In this folder, navigate to the file kernel/drivers/hid/hid-input.c. Open this file with a text editor, as we will be modifying a small portion of the file with the corrected code.

7.Find the hidinput_hid_event() function, and append the following code between the lines that read "input_event(input, EV_MSC, MSC_SCAN, usage->hid);" and "input_event(input, usage->type, usage->code, value);" . You can use the find/search capability to help locate these lines within the hidinput_hid_event() function:

-//+RDG: patch for eGalax touchscreen: swap X and Y, invert X
-if (usage->type == EV_ABS)
-        if (usage->hid == HID_GD_X) {
-                usage->code = 1;        // vs 0 (X becomes Y)
-                value = 4096 - value;
-        } else if (usage->hid == HID_GD_Y) {
-                usage->code = 0;        // vs 1 (Y becomes X)
-        }
-//printk("RDG: hidinput_hid_event: type = %d, code = %d, value = %d
(hid = 0x%x)\n", usage->type, usage->code, value, usage->hid);
(In the event you cant find this/don't want to be bothered with it, the modified version of the file is attached)

8. Save and close the file and maximize your terminal window. Run the following command to build the modules:
make -j4 ARCH=arm zImage modules
This step can take several minutes, so be patient.

9. copy the modules to the ODROID-X2 by running this command:
adb remount
for module in `find . -iname *.ko`; do adb push $module /system/lib/modules ; done
10.Copy the kernel... we're almost there:
adb push arch/arm/boot/zImage /system/lib/modules
11.Flash the kernel to complete the process!:
adb shell
cd /system/lib/modules
busybox dd conv=notrunc seek=2455 bs=512 if=zImage of=/dev/block/mmcblk0
adb reboot
This command reboots the ODROID and should fix the touchscreen axes!

Attached Files