A dirty patch to fix eGalax touchscreen axis swap/inversion

Showing 1-24 of 24 messages
A dirty patch to fix eGalax touchscreen axis swap/inversion rdg 11/28/11 9:50 AM
Hi all,

As you may know by reading this group, a few people are impacted by a
misbehavior or their eGalax touchscreen where X and Y axis are swapped
and/or one or two axis direction is inverted.

The Pointer Location utility (in Dev Tools) is a nice program that
shows the problem but lets some hope in its fixing if the input,
although inverted, is smooth and linear.

My context:
  - 800x480 screen
  - USB eGalax resistive touchscreen (EEF:1)
  - configuration cloned from asus_laptop

In this configuration, the eGalax USB device is handled by the HID
subsystem as a regular HID that sends "HID reports" when the screen is
touched.

After having determined the path from the report to the Input
Subsystem, I added the following code to the hidinput_hid_event()
function in kernel/drivers/hid/hid-input.c:

--- hid-input.c        2011-11-28 18:27:46.237516103 +0100
+++ hid-input.c.ori        2011-11-11 11:45:38.000000000 +0100
@@ -782,18 +782,6 @@
         if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) !=
value)
                 input_event(input, EV_MSC, MSC_SCAN, usage->hid);

-//+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
         input_event(input, usage->type, usage->code, value);

         if ((field->flags & HID_MAIN_ITEM_RELATIVE) && (usage->type ==
EV_KEY))

This patch addresses my very own problem (X/Y swap and X inversion)
and you may have to adjust it to meet your needs.

Obviously, yet efficient, this patch is rather ugly. I am not a Linux
expert at all and I can imagine there are other ways to achieve the
same result more cleanly, the cleaner way probably being to create a
specific driver to address the problem. Any suggestion from actual
experts are welcome ;-)

Remi

Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Chih-Wei Huang 11/28/11 5:50 PM
Hi Benjamin,
Could you comment it? Thanks!

2011/11/29 rdg <grave...@gmail.com>:

Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Alexandre Chappaz 11/30/11 1:08 AM
hi Remi, nicely done.

on which version did you get this working? honycomb by any chance?

Alexandre

A

On 29 nov, 02:50, Chih-Wei Huang <cwhu...@android-x86.org> wrote:
> Hi Benjamin,
> Could you comment it? Thanks!
>
> 2011/11/29 rdg <gravela...@gmail.com>:

Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Max 11/30/11 1:42 AM
I would recommend you this patch for gingerbread: https://groups.google.com/d/topic/android-porting/2KtxlHvJbGo/discussion
or TSLIB (ts_calibrate) for froyo.

Re: A dirty patch to fix eGalax touchscreen axis swap/inversion rdg 11/30/11 2:42 AM
Hi Alexandre,

This patch is not so nice, as it should diserve a more stringent test
to actually decide when to activate the special processing: currently,
it is just a quick and dirty patch :-(
I put it in a place that is potentially shared by every HID in the
system (mouse, keyboard, etc.) and the only discrimination I made is
the EV_ABS test. It's OK in my system as the touchscreen is the only
source of EV_ABS input events but I really should try to make sure
that these events actually come from the touchscreen.

I got it working on Gingerbread but it is a Linux kernel patch and I
suppose it will work with any version of Android, including Honeycomb.
You just have to add a few lines to kernel/drivers/hid/hid-input.c,
rebuild the kernel and move it to your device.

Remi

On 30 nov, 10:08, Alexandre Chappaz <alexandrechap...@gmail.com>
wrote:

Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Alexandre Chappaz 11/30/11 3:11 AM
Yes I understood it is a quite ugly patch, but anyway my device is
also touchonly device ( modded eeepc 701)
I was asking about the version because of what I read in another
thead, ppl having issues having TS working in honeycomb (
http://groups.google.com/group/android-x86/browse_thread/thread/b6308bebb624a9b9).

In this thread, the egalax TS is event not registered.
Seems like some big changes occured in the driver in the kernel ( hid-
egalax module is not avalaible any more in kernel 3.0 and is merged
into hid-multitouch ).
see http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=commit;h=7fd23a24717a327a66f3c32d11a20a2f169c824f.

This is why I was asking which version you tried.

when I installed android-x86  version 2.2_RC2, I could use correctly
the calibration procedure (
http://groups.google.com/group/android-x86/browse_thread/thread/a0f110144ae40b5c/cc52495dec1a93bf?lnk=gst&q=chappaz#cc52495dec1a93bf
)

Just wanted to try the honeycomb image.

Je ferais ca qd je trouverai le temps!
++

Re: A dirty patch to fix eGalax touchscreen axis swap/inversion rdg 12/1/11 1:52 AM
@Max:
Yes, this patch seems a lot more clean. I'll will try it.
However, it seems to me that it addresses a slightly different
problem, i.e. real TS calibration.
My screen *is* calibrated, but for some dark reasons, the way it is
handled by Linux as a generic HID is broken and there are some
"inversions". So, IMVHO, I would prefer to have the problem fix as
close as possible to the source, i.e. somewhere in the Linux input
system. This fix could be useful to run a vanilla Linux on my device
too.
If I go further, even the calibration issue should be handled at the
Linux level too: to me, it's a pity that Android has to deal with TS
calibration and touch events should be as directly usable as mouse and
keyboard events are. Still my opinion of course.

@Alexandre:
In my kernel configuration, the eGalax device is handled has a generic
HID and there is no special processing done in usbtouchscreen.c, even
if CONFIG_TOUCHSCREEN_USB_EGALAX is true (0x0eef, 0x0001 is
DEVTYPE_IGNORE.) I tried to add my own device handling at this level
but something I still don't understand makes that the rare packets I
can see in my read_data routine are unusable (not all touches gives
packets here and packet contents seems irrelevant.)
As far as I understand, the pointercal file generated by ts_calibrate
is not used by Gingerbread and Honeycomb as it was in Froyo. The patch
advised by Max may be a clue on how to do it.

A+
Remi

On 30 nov, 12:11, Alexandre Chappaz <alexandrechap...@gmail.com>
wrote:


> Yes I understood it is a quite ugly patch, but anyway my device is
> also touchonly device ( modded eeepc 701)
> I was asking about the version because of what I read in another
> thead, ppl having issues having TS working in honeycomb (http://groups.google.com/group/android-x86/browse_thread/thread/b6308...).

>
> In this thread, the egalax TS is event not registered.
> Seems like some big changes occured in the driver in the kernel ( hid-
> egalax module is not avalaible any more in kernel 3.0 and is merged
> into hid-multitouch ).
> seehttp://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=c....

>
> This is why I was asking which version you tried.
>
> when I installed android-x86  version 2.2_RC2, I could use correctly
> the calibration procedure (http://groups.google.com/group/android-x86/browse_thread/thread/a0f11...

Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Andrew Trimble 2/28/12 5:11 PM
Hi Remi,

I too own an eGalax screen that exhibits the orientation problems (IE: Calib. seems fine, but x=y and vice versa)
I tried numerous patches to get this to work, and almost gave up until I found your 'Dirty little patch' hehe.

For this project I am using a Xenarc 7" 705TSV. UsbId: 0eef:0001 rev 210. I just wanted to leave this post to let you know that your patch works on my screen! I can now load some on-screen android buttons and poke away and it's working as expected on GB.

I have noticed that the calibration is off slightly which for the most part Isn't noticeable until you try and bring down the notification bar, so I am also trying the calibration fix posted by Max to see if it helps but nothing to report on that yet :)

Anyways, thanks again Remi!

Re: A dirty patch to fix eGalax touchscreen axis swap/inversion jure matoh 7/17/12 3:00 AM
Hi!

I'm very new to android x86, and I'm wondering if it's possible to patch an already running system for the eGalax axis switch. I have an eee pc 701 with the 7" eGalax, so I'm pretty sure my problem is the same as yours. So - is it possible to change a file in the built system to make this switch or do I have to re-build the kernel? That seems a bit extreme and the only linux machine I have is the aforementioned eee pc.

Thank you for answering,

Jure
Re: A dirty patch to fix eGalax touchscreen axis swap/inversion rdg 7/18/12 1:59 AM
I am far from being a Linux expert but I am afraid this kind of patch can only be activated by building a kernel.
If you are an X86 wizard, you may consider directly hacking the binary but this is certainly a very hard task!

Sorry.

Le mardi 17 juillet 2012 12:00:35 UTC+2, jure matoh a écrit :
Re: A dirty patch to fix eGalax touchscreen axis swap/inversion jure matoh 7/18/12 3:32 AM
Thanks. Was afraid of that. According to instructions on androidx86 site I'll have to do repo sync. all 26GB of it. damn!


Dne sreda, 18. julij 2012 10:59:12 UTC+2 je oseba rdg napisala:
Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Andrew Trimble 7/18/12 10:03 AM
There is the possibility of replacing the hid kernel drivers with pre-patched ones, but I am pretty certain that a good portion of the Android system is stored in and image file, which mounted and chrooted to at startup. This is a problem because the image is not persistent, meaning  file system changes are only done in memory and are not written back to the image.
Oh and that image is stored inside a squashfs image just to make things more fun.

I now run a slightly modified eeepc build with no hid-input.c patch and followed Chih Wei's instructions and my egalax is working even better than it did with the patch.

If you are running an Android-x86 4.0-RC1 install you should be able to drop into a terminal and run ts_calibrate.
Instructions on how to do this are here https://groups.google.com/d/msg/android-x86/7aLHaRgX0Js/B-YrotG6Zv0J
Btw, pressing Ctrl+Alt+F1 will take you to a linux console where you can perform this and Ctrl+Alt+F7 will get you back to android if needed.


--
You received this message because you are subscribed to the Google Groups "Android-x86" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-x86/-/p1N3UJK5XhkJ.

To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-x86...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-x86?hl=en.



--
- Andrew Trimble

Re: A dirty patch to fix eGalax touchscreen axis swap/inversion jure matoh 8/6/12 3:04 AM
Works like a charm! Thank you!

Dne sreda, 18. julij 2012 19:03:08 UTC+2 je oseba Andrew Trimble napisala:
Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Mike Cwel 7/16/13 6:02 AM


Le lundi 28 novembre 2011 18:50:30 UTC+1, rdg a écrit :
Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Mike Cwel 7/16/13 6:06 AM
hello,
could someone post a how to tutorial
i can't get it to work
can't compile kernel

is it possible to have a flahable uptade?

i'm on odroid X2 with lilliput usb touchscreen

thanks


Le lundi 28 novembre 2011 18:50:30 UTC+1, rdg a écrit :
Hi all,
Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Mike Cwel 7/17/13 7:34 AM
I tried to do as described but i have errors.
Could someone upload an emmc or sd image with this changes so i can flash it?
I'm building a car pc.
If anyone is interested i can post some pictures.
I know I ask much but it is the only thing that I miss to finish my build.
So please help me
Thanks
Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Masaki Muranaka 7/17/13 9:39 PM
Hello,
At the first, no one can suggest about your issue
before you tell your android version.

If you use recent versions (at least jb-x86, maybe also ics-x86),
you can calibrate your touch panel without patches.
For more details, please learn ts_calibrate commend.

2013/7/17 Mike Cwel <mike....@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "Android-x86" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to android-x86...@googlegroups.com.
> To post to this group, send email to andro...@googlegroups.com.
> Visit this group at http://groups.google.com/group/android-x86.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
--
Masaki Muranaka
Monami-ya LLC, Japan.
Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Mike Cwel 7/18/13 2:23 AM
Hi,
I uptaded with the last official image from the odroid website. It is android 4.1.2.
I tried some software to calibrate the screen but when i press in the upper right corner the pressure is in the down left corner.
And i don't have ts_calibrate
Thank you for help
Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Masaki Muranaka 7/18/13 7:12 PM
Huh? You have x86 (not ARM) version of odroid? You know this group is
android-"x86", right?

2013/7/18 Mike Cwel <mike....@gmail.com>:
Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Mike Cwel 7/30/13 3:03 PM
hello,
I tried once again to modify the kernel but I have errors.
What I did :
--installed ubuntu 12.10 x64
--installed android sdk from this guide : http://androidforums.com/lg-spirit-4g/692656-install-adb-windows-ubuntu-12-04-12-10-a.html
--followed these steps : http://forum.odroid.com/viewtopic.php?f=51&t=83

but when I try to build the kernel and modules with this command : "make -j4 ARCH=arm zImage modules" after editing the hid-input.c like this

/* report the usage code as scancode if the key status has changed */

--- hid-input.c        2011-11-28 18:27:46.237516103 +0100
+++ hid-input.c.ori        2011-11-11 11:45:38.000000000 +0100
@@ -782,18 +782,6 @@

    if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value)
        input_event(input, EV_MSC, MSC_SCAN, usage->hid);


//+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

    input_event(input, usage->type, usage->code, value);

i get these errors

moi@moi-ET2400IN-1G:~/kernel_4412$ make -j4 ARCH=arm zImage modules
scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CC      drivers/hid/hid-input.o
drivers/hid/hid-input.c: In function 'hidinput_hid_event':
drivers/hid/hid-input.c:822: error: wrong type argument to unary minus
drivers/hid/hid-input.c:822: error: request for member 'c' in something not a structure or union
drivers/hid/hid-input.c:822: error: expected ';' before numeric constant
drivers/hid/hid-input.c:824: error: stray '@' in program
drivers/hid/hid-input.c:824: error: stray '@' in program
drivers/hid/hid-input.c:824: error: stray '@' in program
drivers/hid/hid-input.c:824: error: stray '@' in program
drivers/hid/hid-input.c:829: error: 'direction' undeclared (first use in this function)
drivers/hid/hid-input.c:829: error: (Each undeclared identifier is reported only once
drivers/hid/hid-input.c:829: error: for each function it appears in.)
drivers/hid/hid-input.c:830: error: expected ';' before 'if'
drivers/hid/hid-input.c:839: error: invalid suffix "x" on integer constant
drivers/hid/hid-input.c:839: error: stray '\' in program
drivers/hid/hid-input.c:839: warning: missing terminating " character
drivers/hid/hid-input.c:839: error: missing terminating " character
make[2]: *** [drivers/hid/hid-input.o] Error 1
make[1]: *** [drivers/hid] Error 2
make: *** [drivers] Error 2
make: *** Waiting for unfinished jobs....
moi@moi-ET2400IN-1G:~/kernel_4412$

note : in blue the lines are from the stock downloaded kernel and in red the lines that I have added

Could someone help me and say what' s wrong in the lines that I added?

Thank you very much.

If I get my touchscreen working without the swapped axis i would get my carpc working like it should and i could post some pictures or a video.

SO please HELP


Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Josh Higgins 7/31/13 1:55 AM
Mike, you are almost there.

It looks like you've copied the code into the file instead of applying it as a patch. To do it this way, all you must copy is this


//+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)
        }
}
//-RDG

In between the blue bits. The errors are generated by the symbols in the patch syntax - @,-,+, and new lines being distorted when copying and pasting.

Josh

Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Mike Cwel 7/31/13 2:59 AM
THANK YOU !!!!!!!
IT WORKS !!!!!!!!

Still some little mismatch in the touch but it will do

THANK YOU ONCE AGAIN


Le mercredi 31 juillet 2013 10:55:41 UTC+2, Josh Higgins a écrit :
Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Mike Cwel 7/31/13 11:53 AM
Hello,
As I said before, it works but.........my touchscreen is not responding at about 4 milimeters around the screen and I can't access top and bottom icons.
I used the set up from this thread but I think I have to change something to make it fit my own touchscreen.
I have this setting in devtools :

- screen layout : 0x10000023
- density : 1.0
- density dpi : 160
- hight pixels : 672
- scale density : 1.0
- width pixels : 1280
- xdpi : 160.15764
- ydpi : 160.42105

Could you tell me what to change and where?

Thank you once again for your help
Re: A dirty patch to fix eGalax touchscreen axis swap/inversion Mike Cwel 8/2/13 5:47 AM
No one can help?
More topics »