Forum

Full Version: eGalax touchscreen calibration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Correct
Code:
calib_x_d=1280;calib_x_fact= -0.66667;calib_y_d=720;calib_y_fact=-0.666667;swap_axes=1;
Ok, so you cannot see the pointer when using the touchscreen, and it has no effect on the reported pointer value when touching the screen.

So at max x-pos., the equation gives: 1280 - (-0.666 * 1280) - 1280 = 852.48
and at min x-pos, , the equation gives: 1280 - (-0.666 * 0) - 1280 = 0

can you find the corresponding evtest values for top left and bot right, it might help
(7th Jun, 2013 03:47 AM)Markamc Wrote: [ -> ]Ok, so you cannot see the pointer when using the touchscreen, and it has no effect on the reported pointer value when touching the screen.

So at max x-pos., the equation gives: 1280 - (-0.666 * 1280) - 1280 = 852.48
and at min x-pos, , the equation gives: 1280 - (-0.666 * 0) - 1280 = 0

can you find the corresponding evtest values for top left and bot right, it might help
With current config i see the pointer in xbmc, but its only moving in the wrong direction.
Ok, by changing the sign of the scale factor will reverse the direction of the axis, try it in a spread sheet.

max x = 1280 -(0.666 * 1280) - 1280 = -852.48
minx x = 0 -(0.666 * 1280) - 0 = 0
so, range is 0 < x < -852.2, which is the opposite of the other range result, 0 < x < 852.4

Not sure why you can't see any difference? check the syntax of the calib file for errors maybe?
Without the - sign where ever i touch, the mouse jumps to 1280,720.

Quote:The simplest way to swap axes is to switch the four wires cable plug's orientation which comes from the touchscreen to the touch controller.
Maybe i can do this?


Do i need to swap this cable? looks a lot like the one coming from the touchscreen in the blog post.
I swapped the cable and now its working!
Now only thing left to do is the calibration.

But its driving me crazy, the formula mentioned in the blog isn't accurate.
Is there another way to find those values?
(##Disclaimer .....works with 1a5 and beta1 for me)

Ok, this is a long process atm, but does work, for me at least.

I was originally looking into changing the xbmc patch, but not had the time yet.

Method : TS_CALIBRATE

Enter the following, line by line and obviously follow the instructions:

Terminal

sudo su
stop xbmc
apt-get install libtool automake build-essential git
git clone git://github.com/kergoth/tslib.git
cd tslib
./autogen.sh
./configure
make
make install

edit the ts.conf file and remove the '# ' from '# module-raw input' on line:2 using:

Terminal

nano /usr/local/etc/ts.conf
(NB remove the space too, it will give a 'segmentation fault')
Close and save the ts.conf file

Next enter the following at the prompt......

Terminal

ls -l /dev/input/by-id

The output shows the input event that your touchscreen is linked to, My egalax TS is on /dev/input/event2

Terminal

root@xbian:/home/xbian/tslib# ls -l /dev/input/by-id
total 0
lrwxrwxrwx 1 root root 9 Jan 1 1970 usb-Riitek_Micro_Keyboard-event-kbd -> ../event0
lrwxrwxrwx 1 root root 9 Jan 1 1970 usb-Riitek_Micro_Keyboard-event-mouse -> ../event1
lrwxrwxrwx 1 root root 9 Jan 1 1970 usb-Riitek_Micro_Keyboard-if01-event-mouse -> ../event1
lrwxrwxrwx 1 root root 9 Jan 1 1970 usb-Riitek_Micro_Keyboard-if01-mouse -> ../mouse0
lrwxrwxrwx 1 root root 9 Jan 1 1970 usb-Riitek_Micro_Keyboard-mouse -> ../mouse0
lrwxrwxrwx 1 root root 9 Jan 1 1970 usb-eGalax_Inc._Touch-event-if00 -> ../event2
root@xbian:/home/xbian/tslib#

Paste the following lines at the prompt......

*** NB. change export TSLIB_TSDEVICE=/dev/input/eventX to suit your device event no. where 'X' is your value.

Terminal

export LD_LIBRARY_PATH=/usr/local/lib
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event2 <----***
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/usr/local/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/lib/ts

and then

Terminal

ts_calibrate

Terminal

root@xbian:/home/xbian/tslib# ts_calibrate
xres = 1280, yres = 720
Took 16 samples...
Top left : X = 317 Y = 108
Took 34 samples...
Top right : X = 324 Y = 1937
Took 16 samples...
Bot right : X = 1863 Y = 1933
Took 19 samples...
Bot left : X = 1856 Y = 113
Took 11 samples...
Center : X = 1067 Y = 1028
-21.938232 -0.000184 0.646745
-75.615356 0.402788 -0.001534
Calibration constants: -1437744 -12 42385 -4955528 26397 -100 65536
root@xbian:/home/xbian/tslib#

The information you want is from the end of the output

Terminal

Center : X = 1067 Y = 1028
-21.938232 -0.000184 0.646745
-75.615356 0.402788 -0.001534

Top line is X, bottom Y
x offest is -21.938232 , x scale factor is 0.646745
y offest is -75.615356 , y scale factor is 0.402788

so for our calib file we need this:

Code:
calib_x_d=1302;calib_x_fact=-0.647;calib_y_d=796;calib_y_fact=-0.402;swap_axes=1;

Create the calib file and enter the above calibration into the editor with:

Terminal

mkdir /usr/share/eGalaxCalibration
nano /usr/share/eGalaxCalibration/touchscreen_axes_calib


As you can see, I needed to change the direction of both axes by changing the sign on the scale factor and I also needed to swap the axes too, swap_axes=1.
ThHe offset values need to be "subtracted" from those already "programmed" into xbmc patch, hence (1280 -) -22 = 1302 (approx) and (720 -) -76 = 796

Hope it helps

bye y'all

(##Disclaimer .....works with 1a5 and beta1 for me)
Works almost here...
Terminal

make[1]: Leaving directory `/home/xbian/tslib'
root@xbian:/home/xbian/tslib# nano /usr/local/etc/ts.conf
root@xbian:/home/xbian/tslib# export LD_LIBRARY_PATH=/usr/local/lib
root@xbian:/home/xbian/tslib# export TSLIB_CONSOLEDEVICE=none
root@xbian:/home/xbian/tslib# export TSLIB_FBDEVICE=/dev/fb0
root@xbian:/home/xbian/tslib# export TSLIB_TSDEVICE=/dev/input/event2
root@xbian:/home/xbian/tslib# export TSLIB_CALIBFILE=/etc/pointercal
root@xbian:/home/xbian/tslib# export TSLIB_CONFFILE=/usr/local/etc/ts.conf
root@xbian:/home/xbian/tslib# export TSLIB_PLUGINDIR=/usr/local/lib/ts
root@xbian:/home/xbian/tslib# ts_calibrate
ts_open: No such file or directory

And if i run it directly (on pi not ssh):
ts_calibrate: error while loading shared libraries: libts-1.9.so.0: cannot open shared object file: No Such file or directory
Sorry my fault, just edited post above,
Change the line
export TSLIB_TSDEVICE=/dev/input/event2
to suit your event device

I'll have a look later, I had that error at some point, and manage to fix it

Think it will work SSH, if you set the paths, if you run it locally, you need to set paths too.
Terminal

xbian@xbian /dev/input $ ls
by-id by-path event0 event1 mice mouse0 mouse1
I used event0 but its still giving this error:
ts_calibrate: error while loading shared libraries: libts-1.0.so.0: cannot open shared object file: No such file or directory

do i have to paste the export things in the file or execute them? Because i executed them.
you can paste them for now, it's fine

I'll check later, I thought I'd prevented this error:

ts_calibrate: error while loading shared libraries: libts-1.0.so.0: cannot open shared object file: No such file or directory

Just tested on mine,

if I set the path export LD_LIBRARY_PATH= then i get the error

when I set it as export LD_LIBRARY_PATH=/usr/local/lib

Entering,
find / -name libts-1.0.so.0

the file is located in /usr/local/lib

I have no error, I am testing on beta1, i will check a5
Entering the lines in the file does not work, same error.



xbian@xbian / $ sudo find / -name libts-1.0.so.0
/usr/local/lib/libts-1.0.so.0

So it does exists :/
Also on Beta 1 here
Ok, will test later and update instructions if I find a problem....and be a bit clearer with the instructions, for now just paste the "export path=" section to prompt, not into the ts.conf file.
Will try again with a fresh beta 1 image.
I've modified the instructions slightly to avoid confusion and then tried it out on a fresh beta1 installation with no errors.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Reference URL's