Announcement

Collapse
No announcement yet.

The Android Head Unit Build - Touchscreen Setup

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 07:19 PM.
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

  • #2
    Thanks for the guide. Upgrading to beta 1.7.1?

    Comment


    • #3
      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

      Comment


      • #4
        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.)
        Follow Me on Twitter or Facebook
        Live mp3Car Facebook Chat

        Comment


        • #5
          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

          Comment


          • #6
            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.)
            Follow Me on Twitter or Facebook
            Live mp3Car Facebook Chat

            Comment


            • #7
              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!

              Comment


              • #8
                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

                Comment


                • #9
                  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

                  Comment


                  • #10
                    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

                    Comment


                    • #11
                      Originally posted by masr1979 View Post
                      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
                      Hi masr1979: UART module is not needed for OS upgrade. First you have to upgrade to 1.6 then you can upgrade to 1.7(.1). All the steps are described on the official download site (I did it last week (I have a U2)).

                      Comment


                      • #12
                        Yea as komorg mentioned, the update procedure has changed for 1.7. You now need to download the update file ON the ODROID-X2, save it to a folder on the SD card (sorry don't remember what the folder is called and hardkernels link is currently done), then go into android settings and do a software update. This new update procedure should work out better in the long run. I still haven't done it though.


                        Little snag on the build... I put all of the components on the double DIN radio cage, was going to power up the board to test JUST before I put it in the car, and now the Lilliput 669 has the dreaded white screen of death . Luckily I have another one in my car now, so i'll just have to swap it out. NO clue why the Lilliput died it hasn't even been powered on in over a week.
                        Last edited by Sonicxtacy02; 07-01-2013, 08:17 AM.
                        mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
                        Follow Me on Twitter or Facebook
                        Live mp3Car Facebook Chat

                        Comment


                        • #13
                          Okay, thanks for the info guys. For the life of me I can't find that info anywhere on their forums... well more so because they seem to be down currently. Sucks about the screen, I have not had too much luck with screens either. Think I've gone through 3 of them. Very happy with the current samsung led screen I have though, even in direct sunlight I can see what I'm doing, as opposed to the lilly lcds.

                          *edit* Ok, so just found the info on the hardkernel main site, not the forums*edit*

                          Comment


                          • #14
                            A possible alternative to Lilliput...

                            I have my eye on the open-frame version of this screen but it is not available yet...
                            http://www.chalk-elec.com/?p=1712
                            It has capacitive touch, ambient light sensor, audio decoding from HDMI to 2.5mm phono plug, ....
                            Last edited by JamesE; 07-11-2013, 12:51 PM.

                            Comment

                            Working...
                            X