Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: The Android Head Unit Build - Touchscreen Setup

  1. #1
    Mo' Programming Mo' Problems
    Auto Apps:loading...
    Sonicxtacy02's Avatar
    Join Date
    Sep 2004
    Location
    Woodbridge, VA
    Posts
    8,168
    Blog Entries
    51

    The Android Head Unit Build - Touchscreen Setup


    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!
    Last edited by Sonicxtacy02; 06-25-2013 at 07:19 PM.

  2. #2
    Newbie
    Join Date
    Mar 2012
    Posts
    5
    Thanks for the guide. Upgrading to beta 1.7.1?

  3. #3
    Constant Bitrate
    Join Date
    Dec 2005
    Location
    Raleigh, NC
    Posts
    115
    Thank you for this. When I get time I'll try to get information in here about differences for the MK808B which luckily also has the kernel source available on Github. The one thing that is very disappointing about the MK808B out of the box is that an eGalax touch screen does nothing at all when plugged in. That should be something that can be worked around as well though.
    "You're just about as useless as JPEGs to Helen Keller" - Wierd Al

  4. #4
    Mo' Programming Mo' Problems
    Auto Apps:loading...
    Sonicxtacy02's Avatar
    Join Date
    Sep 2004
    Location
    Woodbridge, VA
    Posts
    8,168
    Blog Entries
    51
    Quote Originally Posted by komorg View Post
    Thanks for the guide. Upgrading to beta 1.7.1?
    Yup have the file downloaded and the instructions up, just haven't followed them yet. I'm of course hoping for the miracle update that somehow adds HFP Bluetooth support!
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Find my plugins on the MP3Car App Store!
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

  5. #5
    Variable Bitrate chris350's Avatar
    Join Date
    Aug 2007
    Location
    Queens, NYC
    Posts
    334
    there has to be an easier way
    CarPc
    Project "Driver"

    Planning [99.9%]

    Parts Collected [98.5%]

    Installation & Fabrication [98%]

    Total Completion Level [96.9 %]

    http://www.mp3car.com/vbulletin/work...ct-driver.html

  6. #6
    Mo' Programming Mo' Problems
    Auto Apps:loading...
    Sonicxtacy02's Avatar
    Join Date
    Sep 2004
    Location
    Woodbridge, VA
    Posts
    8,168
    Blog Entries
    51
    Quote Originally Posted by chris350 View Post
    there has to be an easier way
    Believe me, if I could find an easier way I would have lol. Any manipulation of the kernel files without recompile wouldn't persist after a reboot. I guess an app that could reassign the press correcting the axes in near time is an option but it would have to be considered as a hack.

    Luckily, I've been told that unless that kernel file is updated, which isn't likely, the fix will survive OS upgrades as they come out.
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Find my plugins on the MP3Car App Store!
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

  7. #7
    Newbie
    Join Date
    Mar 2012
    Posts
    5
    Months ago I've started looking for a solution to get HFP to my tablet, no success yet (I'm afraid it depends on the BT driver/stack and I'm not familiar with this). I would like this feature, very-very-very!

  8. #8
    Constant Bitrate
    Join Date
    Dec 2005
    Location
    Raleigh, NC
    Posts
    115
    Well, I borked my MK808B. It seems that it's possibly recoverable but I did learn a lot. Namely, no one has yet to recompile the kernel for the MK808B and get the wifi/bluetooth working. They have for the standard MK808 as it's a different wifi chipset.

    The ODROID-X2 sounds like a much more promising device. Good luck with your build, I look forward to all progress updates!
    "You're just about as useless as JPEGs to Helen Keller" - Wierd Al

  9. #9
    Maximum Bitrate rray's Avatar
    Join Date
    Apr 2012
    Location
    SF Bay Area
    Posts
    705
    I noticed the Odroid is on the official CyanogenMod release list. Makes this device get much more development support by those XDA hackers.

    Sent from my SCH-I535 using Tapatalk 4 Beta

  10. #10
    Newbie
    Join Date
    May 2008
    Posts
    9
    That's the Odroid U2 though. Sonicxtacy02, how the heck do you go about upgrading to 1.7.1? Fastboot? Recovery? I'm really trying to get away with not getting that uart right now. Glad to see the project is coming along

Page 1 of 2 12 LastLast

Similar Threads

  1. The Android Head Unit Build - The Quest for Power
    By Sonicxtacy02 in forum Mp3Car Blog Talk
    Replies: 15
    Last Post: 08-26-2013, 05:20 PM
  2. The Android Head Unit Build - Hardware Overview
    By Sonicxtacy02 in forum Mp3Car Blog Talk
    Replies: 38
    Last Post: 07-26-2013, 01:43 PM
  3. Replies: 25
    Last Post: 07-09-2013, 01:22 PM
  4. Android as a head unit
    By S_K_U_N_X in forum General Hardware Discussion
    Replies: 20
    Last Post: 06-16-2013, 11:28 PM
  5. Android head unit... Check it out.
    By X219c in forum CarPC News
    Replies: 3
    Last Post: 08-16-2012, 04:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •