Touch Calibration in Android 2.1

262 views
Skip to first unread message

Mehran

unread,
Sep 3, 2010, 8:32:45 AM9/3/10
to android-platform
Hay there,
I am developing android 2.1 for our custom smdk6410 board. My problem
is TOUCHCALIBRATION support in driver and application.

in android 1.5 somone made some custom things in '/android/frameworks/
base/services/java/com/android/server/inputdevices.java' to read
calibration data from file 'etc/pointercal' and this data was written
by calibration applicaiton.

But when i tried to port these changes in android 2.1, the structure
of "inputdevices.java" was totally different. im fighting from last
two days but got no progress.


Someone please guide the proper way, that how can i add 'Calibration'
support in my android. some code if possible.

Michael Trimarchi

unread,
Sep 4, 2010, 1:08:37 PM9/4/10
to android-...@googlegroups.com
touchscreen.patch

Mehran

unread,
Sep 5, 2010, 2:01:31 AM9/5/10
to android-platform
Thank you Michael.

I have got a lot of help from ur sample. But these is something
missing till now.

I am using a application of mine, which makes the touch dead after i
calibrate.

Im also trying to use this app; http://gitorious.org/0xdroid/packages_apps_tscalibration
but it also do not give good results. It saves total 20 values in
pointercal file, and driver reads 7 of them as
x1,x2,y1,y2,z1,z2,S

Can you please guide where is the problem? can someone give
application code to work with the above patch given by Michael?






On Sep 4, 10:08 pm, Michael Trimarchi <trimar...@gandalf.sssup.it>
wrote:
>  touchscreen.patch
> 5KViewDownload

Mehran

unread,
Sep 5, 2010, 2:12:33 AM9/5/10
to android-platform
in generateabsmotion: Do we need to overright all the samples from our
'tInfo' or some of them? my current code is making all of them
according to "tInfo"


________________________________________________________


for (int i = 0; i <numPointers; i + +){
final int j = i *
MotionEvent.NUM_SAMPLE_DATA;
float x = reportData[j +
MotionEvent.SAMPLE_X];
float y = reportData[j +
MotionEvent.SAMPLE_Y];


if (absX != null) {
if (device.tInfo != null)
reportData[j + MotionEvent.SAMPLE_X] =
(device.tInfo.x1 * x +
device.tInfo.y1 * y +
device.tInfo.z1) / device.tInfo.s;
else
reportData[j + MotionEvent.SAMPLE_X] =
((reportData[j + MotionEvent.SAMPLE_X]-
absX.minValue)
/ absX.range) * w;


________________________________________________________

Kan-Ru Chen

unread,
Sep 5, 2010, 2:56:36 AM9/5/10
to android-...@googlegroups.com
Hi Mehran,

On Sun, Sep 5, 2010 at 2:01 PM, Mehran <mehra...@gmail.com> wrote:
> Thank you Michael.
>
> I have got a lot of help from ur sample. But these is something
> missing till now.
>
> I am using a application of mine, which makes the touch dead after i
> calibrate.
>
> Im also trying to use this app; http://gitorious.org/0xdroid/packages_apps_tscalibration
> but it also do not give good results. It saves total 20 values in
> pointercal  file, and driver reads 7 of them as
> x1,x2,y1,y2,z1,z2,S

No, the driver, the linear plugin actually, reads the 20 values then
turns them into the 7 values, the transformation matrix.

>
> Can you please guide where is the problem? can someone give
> application code to work with the above patch given by Michael?

Please note that
http://gitorious.org/0xdroid/packages_apps_tscalibration is
deprecated, our new code base uses
http://gitorious.org/0xdroid/packages_apps_tscalibration2 instead.

Our calibration process is integrated into the Android framework, you
can check the commit log in
http://gitorious.org/0xdroid/frameworks_base/

Basically the procedure is:

when device added:
config device and tslib
monitor on tslib fd
monitor on pointercal changes

when tslib fd has new event:
read calibrated value from tslib

when pointercal changed:
reconfigure tslib

Cheers,
Kanru
http://0xlab.org

Mehran

unread,
Sep 5, 2010, 3:05:37 AM9/5/10
to android-platform
Dear Kanru,

My Mistake#1

>No, the driver, the linear plugin actually, reads the 20 values then
>turns them into the 7 values, the transformation matrix.

StringTokenizer st = new StringTokenizer( new
String(mBuffer, 0, 0, len));
t = new TransformInfo ();
t.x1 = Integer.parseInt( st.nextToken() );
t.y1 = Integer.parseInt( st.nextToken() );
t.z1 = Integer.parseInt( st.nextToken() );
t.x2 = Integer.parseInt( st.nextToken() );
t.y2 = Integer.parseInt( st.nextToken() );
t.z2 = Integer.parseInt( st.nextToken() );
t.s = Integer.parseInt( st.nextToken() );

Directly reading and splitting first 7 values from file.

Can you please give me the original 20 values reading algorithm, so
that i can implement that in my ''inputdevices.java'

_______________________________________________
Mistake#2.
> when device added:
> config device and tslib
> monitor on tslib fd
> monitor on pointercal changes

Well, i didnt added TSLIB in my code, and dono how to do it. but i
doubt that it does not contains TSLIB support. I was just trying to
change the INPUTDEVICES,Java file.
Can u please tell me that is TSLIB nessesary? and if nessesary, how
can i add n compile it? step by step please im new to linux.




Regards,
Mehran

Kan-Ru Chen

unread,
Sep 5, 2010, 3:33:00 AM9/5/10
to android-...@googlegroups.com
On Sun, Sep 5, 2010 at 3:05 PM, Mehran <mehra...@gmail.com> wrote:
> Dear Kanru,
>
> My Mistake#1
>
>>No, the driver, the linear plugin actually, reads the 20 values then
>>turns them into the 7 values, the transformation matrix.
>
>            StringTokenizer st = new StringTokenizer( new
> String(mBuffer, 0, 0, len));
>            t = new TransformInfo ();
>            t.x1 = Integer.parseInt( st.nextToken() );
>            t.y1 = Integer.parseInt( st.nextToken() );
>            t.z1 = Integer.parseInt( st.nextToken() );
>            t.x2 = Integer.parseInt( st.nextToken() );
>            t.y2 = Integer.parseInt( st.nextToken() );
>            t.z2 = Integer.parseInt( st.nextToken() );
>            t.s = Integer.parseInt( st.nextToken() );
>
> Directly reading and splitting first 7 values from file.
>
> Can you please give me the original 20 values reading algorithm, so
> that i can implement that in my ''inputdevices.java'

The code is in external/tslib

>
> _______________________________________________
> Mistake#2.
>> when device added:
>>        config device and tslib
>>        monitor on tslib fd
>>        monitor on pointercal changes
>
> Well, i didnt added TSLIB in my code, and dono how to do it. but i
> doubt that it does not contains TSLIB support. I was just trying to
> change the INPUTDEVICES,Java file.
> Can u please tell me that is TSLIB nessesary? and if nessesary, how
> can i add n compile it? step by step please im new to linux.
>

It depends. TSLib is complicated, if you only implement a subset of
the functionality in your framework then I think tslib isn't
necessary.

We did not modify InputDevice.java, our tslib integration is done in
libs/ui/EventHub.cpp. The code is there, I'm sorry I can't tell you
more ;-)

Cheers,
Kanru
http://0xlab.org

Mehran

unread,
Sep 16, 2010, 9:27:50 AM9/16/10
to android-platform
I have ported TSLIN in my platform and also added tscalibration
application. [tscalibration2 is not downloadable]
After that, i added the changes of libs/ui/EventHub.cpp into mine from
OXDROID famerowk/base/..

?But doing these, my touch is no more working. Can someone help me in
the code of libs/ui/EventHub.cpp or whatever im missing
?What is the diff in tscalibration and tscalibration2?

Nomi

unread,
Sep 17, 2010, 8:00:10 AM9/17/10
to android-platform


I am using the same for Eclair 2.1 on SMDK6410,

Added tslib support, modified "libs/ui/EventHub.cpp" according to
oxdroid
and also added TSLIB Calibration application from oxdroid.

but my touch has stopped working, any help?

huseyin bashan

unread,
Sep 17, 2010, 8:33:46 AM9/17/10
to Nomi, android-...@googlegroups.com

hi,

please check the following items;

1. did you port touch IC and its board connection kernel driver?
2. did you add export parameters to init.rc?
3. run ts_calibrate for creating " etc/pointercal "
4. port framework changes to you android framework

HB

Mehran

unread,
Sep 17, 2010, 10:58:46 AM9/17/10
to android-platform

1. did you port touch IC and its board connection kernel driver?
MY touch kernel driver is working, and it works without TSLIB and
framwork modifications.

2. did you add export parameters to init.rc? I have
not done this, im checking it, please provide some help.
3. run ts_calibrate for creating " etc/pointercal " I dont
know the process to run ts_calibrate :: i ran touchcalibration from
OXDROID; but now, touch is totally not working.
4. port framework changes to you android framework YES, i have
ported the changes in framework accordoing to OXDROID





On Sep 17, 5:33 pm, huseyin bashan <huseyin.bas...@ardictech.com>
wrote:

Nomi

unread,
Sep 18, 2010, 1:17:47 AM9/18/10
to android-platform
There are two questions on my end:

1. What is the location of init.rc , can i get sample exports?
2. How to run ts_test and ts_calibrate on my device?





On Sep 17, 7:58 pm, Mehran <mehrang...@gmail.com> wrote:
> 1. did you porttouchIC  and its board connection kernel driver?
> MYtouchkernel driver is working, and it works without TSLIB and
> framwork modifications.
>
> 2. did you add  export parameters to init.rc?                 I have
> not done this, im checking it, please provide some help.
> 3. run ts_calibrate for creating  " etc/pointercal "           I dont
> know the process to run ts_calibrate :: i ran touchcalibration from
> OXDROID; but now,touchis totally not working.
> 4. port  framework changes  to youandroidframework   YES, i have
> ported the changes in framework accordoing to OXDROID
>
> On Sep 17, 5:33 pm, huseyin bashan <huseyin.bas...@ardictech.com>
> wrote:
>
>
>
> > hi,
>
> > please check the following items;
>
> > 1. did you porttouchIC  and its board connection kernel driver?
> > 2. did you add  export parameters to init.rc?
> > 3. run ts_calibrate for creating  " etc/pointercal "
> > 4. port  framework changes  to youandroidframework
>
> > HB
>
> > On 09/17/2010 03:00 PM, Nomi wrote:
>
> > > I am using the same for Eclair2.1on SMDK6410,
>
> > > Added tslib support, modified "libs/ui/EventHub.cpp" according to
> > > oxdroid
> > > and also added TSLIBCalibrationapplication from oxdroid.
>
> > > but mytouchhas stopped working, any help?
>
> > > On Sep 16, 6:27 am, Mehran<mehrang...@gmail.com>  wrote:
>
> > >> I have ported TSLIN in my platform and also added tscalibration
> > >> application. [tscalibration2 is not downloadable]
> > >> After that, i added the changes of libs/ui/EventHub.cpp into mine from
> > >> OXDROID famerowk/base/..
>
> > >> ?But doing these, mytouchis no more working. Can someone help me in

Mehran

unread,
Sep 18, 2010, 2:32:24 AM9/18/10
to android-platform
init.rc is located in
/home/guo/android_2.1_r1_smdk6410/smdk6410/android/out/target/product/
smdk6410/root
you can export your variables like PATH is exported

i dont know the 2nd question. someone answer please, me too need it

M.Naeem Shahzad

unread,
Sep 18, 2010, 3:29:41 AM9/18/10
to android-...@googlegroups.com
thx mehran...i also able to export paths but what about my second question can anyone reply me....its argent...thanks in advance

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


huseyin bashan

unread,
Sep 18, 2010, 6:26:11 AM9/18/10
to mehra...@gmail.com, android-...@googlegroups.com

     export TSLIB_CONSOLEDEVICE none
     export TSLIB_FBDEVICE /dev/graphics/fb0                   - or  fb1 , fb2...  depends on your framebuffer usage
     export TSLIB_TSDEVICE /dev/input/event0                    - or  event1 event2...   depends on your other input events      
     export TSLIB_CALIBFILE /etc/pointercal
     export TSLIB_CONFFILE /etc/ts.conf
     export TSLIB_PLUGINDIR /system/lib/ts

Huseyin Bashan from TURKEY

Mehran

unread,
Sep 19, 2010, 4:16:33 AM9/19/10
to android-platform
Dear all, i have done the following exports and now ANDROID resets
itself just after it loads.

***
export TSLIB_TSDEVICE /dev/input/event1
export TSLIB_CALIBFILE /etc/pointercal
export TSLIB_CONFFILE /etc/ts.conf
export TSLIB_PLUGINDIR /usr/lib/ts
export POINTERCAL_FILE /etc/pointercal
export TSLIB_CONSOLEDEVICE none
export TSLIB_FBDEVICE /dev/graphics/fb0
export TSLIB_CONFFILE /etc/ts.conf
export TSLIB_PLUGINDIR /system/lib/ts
***
***
Please check the shell output:

C:\Users\Mehran>adb shell
# getevent
getevent
add device 1: /dev/input/event2
name: "bma150-sensor"
add device 2: /dev/input/event1
name: "S3C TouchScreen"
could not get driver version for /dev/input/mouse0, Not a typewriter
add device 3: /dev/input/event0
name: "s3c-keypad"
could not get driver version for /dev/input/mice, Not a typewriter



Please someone reply; thanks

Mehran

unread,
Sep 19, 2010, 8:26:36 AM9/19/10
to android-platform
please see my LOG.
I think, touchscreen is registered as keyboard too.


INFO/SystemServer(1837): Sensor Service
01-01 00:00:44.165:
INFO/SystemServer(1837): Window Manager
01-01 00:00:44.190:

INFO/tslib(1837): New device: path=/dev/input/event2 name=bma150-
sensor id=0x10000 (of 0x1) index=1 fd=61 classes=0x0
01-01 00:00:44.190: ERROR/tslib(1837): geting ENV VAR TSLIB_CONFFILE =/
etc/ts.conf. Device Name= /dev/input/event1
01-01 00:00:44.200:
INFO/tslib(1837): 2:devname = qwerty, keylayout =qwerty,
keylayoutFilename = /system/usr/keylayout/qwerty.kl
01-01 00:00:44.205:
INFO/tslib(1837): New keyboard: publicID=0 device->id=0x10001
devname='S3C TouchScreen' propName='hw.keyboards.0.devname'
keylayout='/system/usr/keylayout/qwerty.kl'
01-01 00:00:44.205:
INFO/tslib(1837): New device: path=/dev/input/event1 name=S3C
TouchScreen id=0x10001 (of 0x2) index=2 fd=62 classes=0x67
01-01 00:00:44.205: ERROR/tslib(1837): could not get driver version
for /dev/input/mouse0, Not a typewriter
01-01 00:00:44.205:
INFO/tslib(1837): 2:devname = qwerty, keylayout =qwerty,
keylayoutFilename = /system/usr/keylayout/qwerty.kl
01-01 00:00:44.210:
INFO/tslib(1837): New keyboard: publicID=65538 device->id=0x10002
devname='s3c-keypad' propName='hw.keyboards.65538.devname' keylayout='/
system/usr/keylayout/qwerty.kl'
01-01 00:00:44.210:
INFO/tslib(1837): New device: path=/dev/input/event0 name=s3c-keypad
id=0x10002 (of 0x3) index=3 fd=64 classes=0x1
01-01 00:00:44.210: ERROR/tslib(1837): could not get driver version
for /dev/input/mice, Not a typewriter




Mehran

unread,
Sep 20, 2010, 3:24:13 AM9/20/10
to android-platform
BOTH touchscreen and keypad stopped working due to Oxdroid Framework
Changes.
Please help
Reply all
Reply to author
Forward
0 new messages