Trouble binding custom touchscreen driver to Android GUI (ICS on beaglebone)

4,049 views
Skip to first unread message

Ken Lauffenburger

unread,
Jul 21, 2012, 10:25:54 PM7/21/12
to row...@googlegroups.com
Hello list,

I'm working to integrate a custom touchscreen driver into Android ICS for use on a beaglebone platform.

I think I am close to getting this working, but I'm running into problems getting the Android system to accept input events from the touchscreen driver.

My driver registers with the Linux input driver just fine.  The device gets registered as /dev/input/event0 and it also shows up in /sys/devices/virtual/input/input0.

The problem is that I can't seem to get the touchscreen input to move the screen cursor or manipulate any GUI objects on the LCD screen.

When I run getevent, I get what looks to me like expected output, for instance:

root@android:/ # getevent
add device 1: /dev/input/event0
  name:     "ft5x0x_ts"
could not get driver version for /dev/input/mouse0, Not a typewriter
could not get driver version for /dev/input/mice, Not a typewriter
add device 2: /dev/input/event1
  name:     "Logitech USB Optical Mouse"
could not get driver version for /dev/input/mouse1, Not a typewriter
/dev/input/event0: 0001 014a 00000001
/dev/input/event0: 0003 0000 00000170
/dev/input/event0: 0003 0001 00000103
/dev/input/event0: 0003 0018 000000c8
/dev/input/event0: 0000 0000 00000000
/dev/input/event0: 0003 0000 0000016f
/dev/input/event0: 0000 0000 00000000
/dev/input/event0: 0003 0001 00000102
/dev/input/event0: 0000 0000 00000000
/dev/input/event0: 0003 0018 00000000
/dev/input/event0: 0001 014a 00000000
/dev/input/event0: 0000 0000 00000000

I have also added an Input Device Configuration File, per http://source.android.com/tech/input/input-device-configuration-files.html.  It looks like this:

root@android:/ # cat /system/usr/idc/ft5x0x_ts.idc
# Input configuration file for ft5x0x_ts touchscreen input device.

# This is an internal device
device.internal = 1

touch.deviceType = touchScreen
touch.orientationAware = 0

keyboard.layout = qwerty
keyboard.characterMap = qwerty2

cursor.mode = navigation
cursor.orientationAware = 0


Other information:
  • The touchscreen device is an I2C device.  (Not sure if it needs to look like a HID device to Android for it to be used.  If so, then I'm not sure how to do that.)
  • The driver is operating it in a non multi-touch mode.  It is reporting  BTN_TOUCH key code for touches and using ABS_X and ABS_Y absolute values for X-Y coordinates.  I checked the coordinates that are being reported, and they are in range and seem to be correct for the finger position on the panel.
  • The USB mouse that shows up in the getevent output is plugged into the beaglebone host USB port.  It does move the cursor and can manipulate GUI objects just fine.  The touchscreen will not work with or without the mouse plugged in.
  • Before I discovered the getevent utility, I wrote a utility that is similar to the Linux utility mev that I call pev.  Here is some sample output:
root@android:/ # pev /dev/input/event0
device name: ft5x0x_ts
Supported event types:
  Event type 0x00  (Synch Events)
  Event type 0x01  (Keys or Buttons)
  Event type 0x03  (Absolute Axes)
-------
Count: 80
Event: time 3259.132350 type 1 code 330 value 1
Event: time 3259.132380 type 3 code 0 value 397
Event: time 3259.132380 type 3 code 1 value 201
Event: time 3259.132380 type 3 code 24 value 200
Event: time 3259.132380 type 0 code 0 value 0
Count: 32
Event: time 3259.141627 type 3 code 1 value 203
Event: time 3259.141627 type 0 code 0 value 0
Count: 32
Event: time 3259.162501 type 3 code 1 value 205
Event: time 3259.162501 type 0 code 0 value 0
Count: 32
Event: time 3259.184474 type 3 code 1 value 208
Event: time 3259.184474 type 0 code 0 value 0
Count: 32
Event: time 3259.205653 type 3 code 1 value 213
Event: time 3259.205653 type 0 code 0 value 0
Count: 48
Event: time 3259.247249 type 3 code 24 value 0
Event: time 3259.247249 type 1 code 330 value 0
Event: time 3259.247279 type 0 code 0 value 0

If you have any ideas, please respond to help me solve this problem.

Thanks.

--ken


stefan.ober...@loxone.com

unread,
Aug 3, 2012, 3:38:19 AM8/3/12
to row...@googlegroups.com
Hello ken!

Just wanted to let you know that i am having _EXACTLY_ the same problem you described.
Did you find out anything more by now?

If i create a .idc file for my touchscreen then the cursor disappears the first time i send BTN_TOUCH 1.
If i dont create a .idc file the cursor stays painted (i also connected a USB HID mouse for testing)

logcat messages look fine to me.

cheer stefan

Matthias Kaehlcke

unread,
Aug 3, 2012, 4:17:10 AM8/3/12
to row...@googlegroups.com
Hi,

El Fri, Aug 03, 2012 at 12:38:19AM -0700 stefan.ober...@loxone.com ha dit:

> Just wanted to let you know that i am having _EXACTLY_ the same problem
> you described.
> Did you find out anything more by now?
> If i create a .idc file for my touchscreen then the cursor disappears the
> first time i send BTN_TOUCH 1.
> If i dont create a .idc file the cursor stays painted (i also connected a
> USB HID mouse for testing)
> logcat messages look fine to me.

the current version of rowboat contains some hacks in the InputReader

check if reverting ca3508dae052dd1801a7a6d685091ff3482cd1b0 in
frameworks/base improves your situation. in case your touchscreen uses
the ti_tscadc driver have also a look at
https://groups.google.com/forum/?fromgroups#!topic/rowboat/sE_OqvfCfss

best regards

matthias

--
Matthias Kaehlcke
Embedded Linux Developer
Amsterdam

The book of nature is written in the language of mathematics
(Galileo Galilei)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-

Stefan Oberpeilsteiner

unread,
Aug 3, 2012, 5:03:32 AM8/3/12
to row...@googlegroups.com, matthi...@kaehlcke.net
Hello Matthias,

I am not using the ti_tscadc, but i came across your fix for that as well.
Looks like you pointed me to the right file!

TI-Android-ICS-4.0.3_AM335x_3.0.1/frameworks/base/services/input/InputReader.cpp
------------------------------------------------------------------------------------------------------------------------------------
void SingleTouchMotionAccumulator::process(const RawEvent* rawEvent) {
    if (rawEvent->type == EV_ABS) {
        switch (rawEvent->scanCode) {
        case ABS_X:
            mAbsX = rawEvent->value;
            break;
        case ABS_Y:
#ifdef BEAGLEBONE
            mAbsY = AM335X_TS_YMAX - rawEvent->value + AM335X_TS_YMIN;
#else
            mAbsY = rawEvent->value;
#endif


That means if my Y_MAX is 2000 this code calculates 3907-2000+220 which results in 2127 as value for android. That could explain why the cursor isn't moving. 
I am always reporting y-values outside {y.min , y.may}.
I have to try change this back and recompile android.

I'll let you know if this was causing the problem me and ken encountered.

Thanks for your input!

cheers Stefan


Am Freitag, 3. August 2012 10:17:10 UTC+2 schrieb Matthias Kaehlcke:
Hi,

El Fri, Aug 03, 2012 at 12:38:19AM -0700 stefan.oberpeilsteiner@loxone.com ha dit:

ktsim...@alteio.net

unread,
Aug 7, 2012, 8:48:33 PM8/7/12
to row...@googlegroups.com
Hi guys,

I am working with a new 4.3" screen which has a ft5406 touch controller, so I am trying to port the ft5x06 driver in Beaglebone with Android ICS 4.0.3.
The lcd is working just fine so now i have to fix the touch driver.
As Ken said am getting the same:
driver in /sys/devices/virtual/input/input0
and with getevent I can see the same:

add device 1: /dev/input/event0
  name:     "ft5x0x_ts"
but when i am touching the display the android ICS 4.0.3 is getting stuck.
I have some drivers from the guys from New Haven but doesn't seem good.
First of all I would like to ask if someone had it done, and if yes yes can I have the driver of the ft5x06 or ft5x0x (.c and .h)?

Regards

Stefan Oberpeilsteiner

unread,
Aug 8, 2012, 1:57:16 AM8/8/12
to row...@googlegroups.com, ktsim...@alteio.net
Hi!

All i can say is that fixing SingleTouchMotionAccumulator::process(const RawEvent* rawEvent) in
TI-Android-ICS-4.0.3_AM335x_3.0.1/frameworks/base/services/input/InputReader.cpp
solved my problem. What do you mean by "getting stuck"?

cheers stefan

ktsim...@alteio.net

unread,
Aug 8, 2012, 9:44:58 AM8/8/12
to row...@googlegroups.com, ktsim...@alteio.net
hi stefan

you were working in beaglebone and android ics?
if yes can I have your ft5x06 drivers and the board setup for the driver?

Regards
kostas

Stefan Oberpeilsteiner

unread,
Aug 8, 2012, 9:51:47 AM8/8/12
to row...@googlegroups.com, ktsim...@alteio.net
Hello!

Yes i am working on beaglebone and android ics bot i am not using ft5x06 so i can't give you the dirvers and board setup.

cheers stefan

ktsim...@alteio.net

unread,
Aug 8, 2012, 11:14:55 AM8/8/12
to row...@googlegroups.com, ktsim...@alteio.net
And what exactly was the problem there?
in
TI-Android-ICS-4.0.3_AM335x_3.0.1/frameworks/base/services/input/InputReader.cpp

ktsim...@alteio.net

unread,
Aug 8, 2012, 11:16:08 AM8/8/12
to row...@googlegroups.com, ktsim...@alteio.net
I can see that there are the parameters of the default touchscreen.
What did you change?
Thanks again

Stefan Oberpeilsteiner

unread,
Aug 9, 2012, 1:24:50 AM8/9/12
to row...@googlegroups.com, ktsim...@alteio.net
Hello,

From the code-snippet below i removed #ifdef, #else, #endif, and   mAbsY = AM335X_TS_YMAX - rawEvent->value + AM335X_TS_YMIN;

cheers stefan

TI-Android-ICS-4.0.3_AM335x_3.0.1/frameworks/base/services/input/InputReader.cpp
------------------------------------------------------------------------------------------------------------------------------------
void SingleTouchMotionAccumulator::process(const RawEvent* rawEvent) {
    if (rawEvent->type == EV_ABS) {
        switch (rawEvent->scanCode) {
        case ABS_X:
            mAbsX = rawEvent->value;
            break;
        case ABS_Y:
#ifdef BEAGLEBONE
            mAbsY = AM335X_TS_YMAX - rawEvent->value + AM335X_TS_YMIN;
#else
            mAbsY = rawEvent->value;
#endif


Satish Patel

unread,
Aug 9, 2012, 1:27:50 AM8/9/12
to row...@googlegroups.com, ktsim...@alteio.net
Hi All,

We had a lot of comments around this.. and thank you all for your feedbacks...

Soon we are going to remove this hack..... As TSLIB is getting added to rowboat...
Thank matthias & android-x86 for contribution on this 

BR,
satish

--
You received this message because you are subscribed to the Google Groups "rowboat" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rowboat/-/-koM5tVY1joJ.
To post to this group, send email to row...@googlegroups.com.
To unsubscribe from this group, send email to rowboat+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rowboat?hl=en.



--
Regards,
satish patel

kulkarni....@gmail.com

unread,
Aug 18, 2012, 9:53:17 AM8/18/12
to row...@googlegroups.com, ktsim...@alteio.net
Hi frnds,

           Recently we have fixed this hanging problem..... in ft5x0x_ts.c driver irq handling function use disable_irq_nosync in place of disable_irq thats all it solves problem. but touch is working properly on GB, on ICS still issues are there... we have to use two fingers, one for holding at one point of touch and one to click...

kulkarni....@gmail.com

unread,
Aug 24, 2012, 9:15:30 AM8/24/12
to row...@googlegroups.com
Hi guys...

          yes... we fixed ft5x0x_ts driver issue... its working on both GB and ICS.....  to make it work on GB no driver changes are required except only one which i had posted last time... to make it work on ICS some 2-3 changes are need to be done on driver. ft5x06_ts.c in report_values routine make following changes...
1. wherever input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, event-pressure); is there replace it by    
input_report_abs(data->input_dev, ABS_PRESSURE, 0);

kulkarni....@gmail.com

unread,
Aug 24, 2012, 9:23:06 AM8/24/12
to row...@googlegroups.com, kulkarni....@gmail.com


On Friday, August 24, 2012 6:45:30 PM UTC+5:30, kulkarni....@gmail.com wrote:
Hi guys...

          yes... we have  fixed ft5x0x_ts driver issue... its working on both GB and ICS.....  to make it work on GB, no driver changes are required except only one which i had posted last time... to make it work on ICS some 2-3 changes are need to be done on driver. ft5x06_ts.c in report_values routine make following changes...
 
1. wherever input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, event-pressure); is there replace it by    
     input_report_abs(data->input_dev, ABS_PRESSURE, event->pressure);
 
2. wherever input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, 0); is there replace it by  two functions
        input_mt_sync(data->input_dev);
    input_sync(data->input_dev); in the same order...

3.pass one more parameter input_report_key(data->input_dev, BTN_TOUCH, 1); in report_values routine.
thats all .... it will work perfectly on ICS 4.0.3....

kuze...@gmail.com

unread,
Oct 8, 2012, 3:05:56 PM10/8/12
to row...@googlegroups.com, kulkarni....@gmail.com
Can you share fixed source code for ft5406?

пятница, 24 августа 2012 г., 16:23:06 UTC+3 пользователь kulkarni....@gmail.com написал:

bryan...@gmail.com

unread,
Oct 11, 2012, 2:31:19 AM10/11/12
to row...@googlegroups.com, kulkarni....@gmail.com, kuze...@gmail.com
I second that request. :-)

marco garzuoli

unread,
Jan 16, 2013, 3:40:46 AM1/16/13
to row...@googlegroups.com, kulkarni....@gmail.com, kuze...@gmail.com, bryan...@gmail.com
hello, I have same problem. I want use a usb touchscreen on my android platform...what can I do?

samari...@gmail.com

unread,
Apr 27, 2013, 1:41:45 PM4/27/13
to row...@googlegroups.com, stefan.ober...@loxone.com
I do have exactly the same problem as you!

Have you founded any sorta of solution??

Many Thanks,

Moreno - Italy

saqibkhan...@gmail.com

unread,
Jan 24, 2014, 6:17:14 PM1/24/14
to row...@googlegroups.com, kulkarni....@gmail.com
I am soo sorry.. this is an old thread.. but we are having the same kind off problem with out device.. plz plz plzzzzzzzzzzzzzzzzzzzzzz have a look at it and help us with it.. and your more experienced in it than us.. plz do reply at saqibkh...@gmail.com or head over to http://forum.xda-developers.com/showthread.php?t=2563508 .. I really await a positive response from u. 
Reply all
Reply to author
Forward
0 new messages