View RSS Feed

Sonicxtacy02

Automotive Computing (R)Evolution - The Android Head Unit Build - Touchscreen Setup

Rate this Entry
by , 06-25-2013 at 07:50 PM (10697 Views)

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:

http://forum.odroid.com/viewtopic.php?f=51&t=83
https://groups.google.com/forum/#!to...86/uNo7a39-s3I



Requirements
-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

Steps
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:
Code:
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)
Code:
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:
Code:
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:
Code:
tar zxvf kernel_4412.tar.gz
cd kernel_4412
5.Configure Toolchain for your ODROID-X2 storage type.
If using the eMMC module enter:
Code:
make ARCH=arm odroidx2_android_emmc_defconfig
If using an SD card enter:
Code:
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:

Code:
-//+RDG: patch for eGalax touchscreen: swap X and Y, invert X
direction
-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);
-}
-//-RDG
(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:
Code:
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:
Code:
adb remount
for module in `find . -iname *.ko`; do adb push $module /system/lib/modules ; done
10.Copy the kernel... we're almost there:
Code:
adb push arch/arm/boot/zImage /system/lib/modules
11.Flash the kernel to complete the process!:
Code:
adb shell
cd /system/lib/modules
busybox dd conv=notrunc seek=2455 bs=512 if=zImage of=/dev/block/mmcblk0
sync
exit
adb reboot
This command reboots the ODROID and should fix the touchscreen axes!

Attached Thumbnails Attached Files

Submit "Automotive Computing (R)Evolution - The Android Head Unit Build - Touchscreen Setup" to Digg Submit "Automotive Computing (R)Evolution - The Android Head Unit Build - Touchscreen Setup" to del.icio.us Submit "Automotive Computing (R)Evolution - The Android Head Unit Build - Touchscreen Setup" to StumbleUpon Submit "Automotive Computing (R)Evolution - The Android Head Unit Build - Touchscreen Setup" to Google

Comments

Leave Comment Leave Comment
View Thread

Last 3 Posts