Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,813,583 Members 37,484 Now Online
XDA Developers Android and Mobile Development Forum

[DEV] Beware of the touchscreen

Tip us?
 
sp3dev
Old
(Last edited by sp3dev; 29th October 2011 at 12:03 AM.)
#1  
Senior Member - OP
Thanks Meter 675
Posts: 554
Join Date: Jul 2006
Location: Kaluga/Moscow
Default [DEV] Beware of the touchscreen

Ok, in this thread I will describe one problem that I have faced with my Iconia and that was also reported by one other user on a forum.

Basically, Iconia uses Atmel mxt1386 touchscreen controller. The same controller is used in Asus EEE Transformer and Motorola Xoom and even Samsung Galaxy Tab 10.1. So far, there are a lot of reports of EEE Transformer's and Xoom's touchscreens suddenly stopping working and starting working after a full battery discharge.

One day after a reboot my Iconia stopped booting - it keeped hanging on the Acer logo and when I tried entering recovery it was hanging at "booting recovery kernel image". However, that only happened with Acer kernels. With my own kernel, ported from EEE Transformer, the tablet could boot. I have recompiled the acer kernel with framebuffer console and found out it got stuck at the touchscreen interrupt handler while EEE's driver just printed an error and stopped working.. Basically, the response I got from from the touchscreen was [1, 0x80, 0, 0, 0, 0, 0, 0]. And it was not detected with i2cdetect

At first, I thought my touchscreen cable was damaged. I have disassembled the tablet and tried twisting the cable to see if it gives any result. My result was that if I disconnect and reconnect the cable, an interrupt comes. Btw, the cable has sharp 'teeth' and you can crimp it pretty much like ethernet.

Ok, so then I added some printks to the driver. Turns out, when some data coming from the touchscreen was incorrect, the driver hanged (deadlocked) because the semaphore was pushed down two times and never upped. So, I have commented out semaphores and bingo - it continued booting. Although there were a lot of warn_slowpath errors and CRC error, it reported correct coordinates. I flashed Acer's kernel after it and it booted fine. Looks like a proper init by Acer driver reset the controller.

The archive in the link contains tegra i2c driver from the chromium tree (in case it finds i2c errors like nak, it retries the transmission several times) and the touchscreen driver. You need to comment out "#define USE_SEMA" to disable semaphores and build the kernel with it in case you encounter the problem..
http://www.mediafire.com/?jt6b19nr7rsy70s

I do not have another 'brick' to test if my solution works in all cases but I'm just leaving the stuff here in case anyone faces the trouble. To flash when your tablet is not booting you'll probably some help from sc2k..

What's the moral of the story? The moral is that as touchscreen is not used in recovery, it may be a good idea to add the 'hacked and buggy' driver to the recovery kernel to allow to recover the device by just booting recovery in case anyone faces the problem.. Of course it's better to fix the driver properly or even use the driver from mainline linux and patch it.

EDIT 29-oct-2011:
here is a link to the cwm recovery image with the 'hacked' driver. Boots just fine.
http://www.mediafire.com/?39jk1j15wkpr57o
Apple Macbook Pro Retina 2012, Sony Xperia Z
Me on github
Me on gitorious
uboot for Samsung Galaxy S2 Samsung Galaxy Nexus
GIT d- s a-- c++ UL P--- !J--- L++++ E--- W- N O? K? w--- o ?V PS+ PE Y+ PGP++ t+ ?5 X++ R* !tv b++ DI++ D++ G++ e* h+
BTC 14KZnQkZR2GLnme7pYGs68MQVJHWwHGt3B
The Following 7 Users Say Thank You to sp3dev For This Useful Post: [ Click to Expand ]
 
M..N
Old
#2  
Senior Member
Thanks Meter 94
Posts: 1,176
Join Date: Jul 2009
So just to clarify this is a software/recovery problem not a hardware problem?
The Following User Says Thank You to M..N For This Useful Post: [ Click to Expand ]
 
sp3dev
Old
#3  
Senior Member - OP
Thanks Meter 675
Posts: 554
Join Date: Jul 2006
Location: Kaluga/Moscow
This is a combined problem. It is a hardware problem as the touchscreen stops getting recognized by i2cdetect, probably due to firmware bugs.. It is a software problem because the driver behaves incorrectly when the hardware fails.
Apple Macbook Pro Retina 2012, Sony Xperia Z
Me on github
Me on gitorious
uboot for Samsung Galaxy S2 Samsung Galaxy Nexus
GIT d- s a-- c++ UL P--- !J--- L++++ E--- W- N O? K? w--- o ?V PS+ PE Y+ PGP++ t+ ?5 X++ R* !tv b++ DI++ D++ G++ e* h+
BTC 14KZnQkZR2GLnme7pYGs68MQVJHWwHGt3B
 
sp3dev
Old
#4  
Senior Member - OP
Thanks Meter 675
Posts: 554
Join Date: Jul 2006
Location: Kaluga/Moscow
Ok, I will post the reply from sc2k who investigated the issue a bit. Let's keep it here for reference. I think it will be nice to patch the mainline driver (from chromium or mainline linux) and use it instead of acer's driver but I won't probably do it unless I hit the issue again or make some progress with my chromium kernel

Quote:
Originally Posted by sc2k
Ok.. I finally understand the issue:

Your tochscreen always responded with [1, 0x80, 0, 0, 0, 0, 0, 0]
buffer[1].bit7 seems to be some kind of "message incomplete" bit. As this is always transmitted, the worker thread never releases the semaphore which causes the ATMEL_Initial to stop at ATMEL_SyncWithThreadToReadMsg.

After you disabled the semaphore, ATMEL_Initial continues. ConfigError is probably 0, so next function to be called will be ATMEL_CheckConfig.

This function first calls ATMEL_SendCMDgetCRC. As semaphores are disabled, this will probably not be able to receive the checksum (due to timing) so that ConfigChecksumError=1.

If ConfigChecksumError==1, ATMEL_CheckConfig will call ATMEL_WriteConfig and ATMEL_Backup that will probably be successful and thus fixes the configuration issue. Even if it does not complete succesfully, the whole recovery process is repeated until all conditions are satisfied.

Conclusion:
- Somehow the configuration in your touchscreen controller got messed up.
- Removing the semaphores triggered ATMEL_WriteConfig + ATMEL_Backup which probably fixed the issue.

I believe, a good fix would be to add a check "if (counts > 20) { up(&mxt->sema); goto fail; }" or similar to mxt_worker for irq_type == ATMEL_ReadResponseMsg_Noaddress. This would prevent these endless interrupt loop and allow the driver to fix the configuration.

Really nice bug that you have found in this driver
Apple Macbook Pro Retina 2012, Sony Xperia Z
Me on github
Me on gitorious
uboot for Samsung Galaxy S2 Samsung Galaxy Nexus
GIT d- s a-- c++ UL P--- !J--- L++++ E--- W- N O? K? w--- o ?V PS+ PE Y+ PGP++ t+ ?5 X++ R* !tv b++ DI++ D++ G++ e* h+
BTC 14KZnQkZR2GLnme7pYGs68MQVJHWwHGt3B
The Following User Says Thank You to sp3dev For This Useful Post: [ Click to Expand ]
 
andrearesti
Old
#5  
Junior Member
Thanks Meter 0
Posts: 5
Join Date: May 2005
Default Link to cwm recovery image invalid

Hi sp3dev,
sorry to ask but could you pls reupload your cwm recovery image? Mediafire says the file is not available any more.
I am not an expert in ROMs and I know nothing about cooking them or kernels. But I think I am having a problem similar to that described in your thread: after a sw update the touchscreen became unsensitive. Shutdown, reset, factory reset do not solve the problem. When I flash a new ROM to try and "reset" the screen controller, I get stuck at the "ACER" logo after flashing with CWM and rebooting the system. If I shut down and restart again, the machine starts but the touchscreen is still unresponsive. Luckily enough, I can use a USB mouse to interact with the device.
I am currently running HC 3.1 (stock), rooted. I took a full nandroid backup with CWM. Do you think it is safe to flash your recovery with the modified touchscreen driver (that is, if you are kind enough to re-upload it for me...)?
Thanks a lot for any advice you can provide.
Best, Andrea
 
qwertylesh
Old
#6  
Senior Member
Thanks Meter 39
Posts: 423
Join Date: May 2010
Location: Melbourne
I see that thor2002ro has seen this thread, but will we see the driver implemented in the next CWM release?
If it can help people recover from a known brick and if the stack does not introduce problems then I hope that we see something, at least a recovery instruction for the touchscreen added to CWM or the whole stack. aferall this could be something that ends up happening to alot of us :S

JB - Google Nexus 7
Locked -

ICS - Asus Transformer Prime TF201
Locked - Rooted - OTA disabled 9.4.2.15 - V6 SuperCharged [AutoSuperMinFree - KickAss Kernelized]


GB - HTC Desire A8183
Oxygen 2.3.2 | R: 5.11.05.27 | HB: Oxygen R2 | V6 SuperCharged [Balanced 3]
 
k1mu
Old
#7  
k1mu's Avatar
Recognized Contributor
Thanks Meter 1,551
Posts: 1,908
Join Date: Apr 2011
Location: Virginia

 
DONATE TO ME
I had this problem with my Galaxy Tab and tried the fixes mentioned but it just didn't work for me. I have, however, figured out what's really going wrong.

I always had this failure showing up in dmesg:
[ 1.707677] tegra-i2c tegra-i2c.1: I2c error status 0x00000008
[ 1.707913] tegra-i2c tegra-i2c.1: no acknowledge from address 0x4c
[ 1.708080] tegra-i2c tegra-i2c.1: Packet status 0x00010009
[ 1.709363] Warning: To wake up touch-ic in deep sleep, retry i2c communication!
[ 1.748037] tegra-i2c tegra-i2c.1: I2c error status 0x00000008
[ 1.748355] tegra-i2c tegra-i2c.1: no acknowledge from address 0x4c
[ 1.748523] tegra-i2c tegra-i2c.1: Packet status 0x00010009
[ 1.749788] sec_touch 1-004c: Failure accessing maXTouch device

So, it can't read from the touchscreen controller at address 0x4c. The fix mentioned in this thread was to re-write the configuration, with the assumption that the device was somehow wedged. That doesn't work either, since you can't write to 0x4c - same lack of acknowledgement.

I tried adding a reset. No change. Disconnected the battery overnight. Also no change.

Then, I realized what's going on. The MXT1386 has a "Firmware Update" mode. When you put it into update mode, the device address changes from 0x4c to 0x26! Once it gets into that mode, it doesn't respond to the original address. Since I don't have the docs for the device, I just called the driver function that updates the firmware. Once that process is complete and the chip reset, it reverts to its original address. At that point (after a final reboot), all is well.

I have a replacement kernel that you can install and boot which re-enables the touchpad. I'd suggest making a nandroid backup first, installing my kernel, then restoring the nandroid once it's fixed.

http://www.rickmurphy.net/mxt1386_fixer.zip. While this is a p4wifi (Gtab 10.1 Wifi-only) it'll probably fix the problem on a 3G tablet as well as long as you restore the correct kernel once it's done..

Whew. It's good to have the toy back working.
My Android devices:
vzw Samsung Galaxy S4 stock NC5 rooted
Samsung Galaxy Tab 2 10.1, also stock but rooted.

VZ Droid Incredible 2 rooted but otherwise stock.
Samsung Galaxy Tab 10.1
The Following 3 Users Say Thank You to k1mu For This Useful Post: [ Click to Expand ]
 
OTAw
Old
#8  
OTAw's Avatar
Senior Member
Thanks Meter 60
Posts: 265
Join Date: May 2012
Location: Chicago
Quote:
Originally Posted by k1mu View Post
I had this problem with my Galaxy Tab and tried the fixes mentioned but it just didn't work for me. I have, however, figured out what's really going wrong.

I always had this failure showing up in dmesg:
[ 1.707677] tegra-i2c tegra-i2c.1: I2c error status 0x00000008
[ 1.707913] tegra-i2c tegra-i2c.1: no acknowledge from address 0x4c
[ 1.708080] tegra-i2c tegra-i2c.1: Packet status 0x00010009
[ 1.709363] Warning: To wake up touch-ic in deep sleep, retry i2c communication!
[ 1.748037] tegra-i2c tegra-i2c.1: I2c error status 0x00000008
[ 1.748355] tegra-i2c tegra-i2c.1: no acknowledge from address 0x4c
[ 1.748523] tegra-i2c tegra-i2c.1: Packet status 0x00010009
[ 1.749788] sec_touch 1-004c: Failure accessing maXTouch device

So, it can't read from the touchscreen controller at address 0x4c. The fix mentioned in this thread was to re-write the configuration, with the assumption that the device was somehow wedged. That doesn't work either, since you can't write to 0x4c - same lack of acknowledgement.

I tried adding a reset. No change. Disconnected the battery overnight. Also no change.

Then, I realized what's going on. The MXT1386 has a "Firmware Update" mode. When you put it into update mode, the device address changes from 0x4c to 0x26! Once it gets into that mode, it doesn't respond to the original address. Since I don't have the docs for the device, I just called the driver function that updates the firmware. Once that process is complete and the chip reset, it reverts to its original address. At that point (after a final reboot), all is well.

I have a replacement kernel that you can install and boot which re-enables the touchpad. I'd suggest making a nandroid backup first, installing my kernel, then restoring the nandroid once it's fixed.

http://www.rickmurphy.net/mxt1386_fixer.zip. While this is a p4wifi (Gtab 10.1 Wifi-only) it'll probably fix the problem on a 3G tablet as well as long as you restore the correct kernel once it's done..

Whew. It's good to have the toy back working.
Though I don't have this problem, and hope never to, it is a scary scenario. Thanks for investing your time to come up with a fix for ppl who have this problem.

Sent from my GT-P7510 using xda app-developers app
  • Current Device: Samsung GS4 M919 (T-Mobile)
  • Rom: Stock TW
  • Kernel: Stock
  • Radio: Stock
  • Recovery: CWM 6.0.1.2
Phone history: Blackberry Curve 8900 > Samsung Vibrant T959 > Samsung Galaxy S3 T999 > T-Mobile Galaxy S4 M919
  • Device: Samsung Galaxy Tab 10.1 (GT-P7510)
  • Rom: (Unofficial) AOKP JB 4.1.2 11/12 Build
  • Kernel: A1 v1.7.4b
  • Recovery: CWM 5.8.3.1
Tablet history: Samsung Galaxy Tab 10.1
 
k1mu
Old
#9  
k1mu's Avatar
Recognized Contributor
Thanks Meter 1,551
Posts: 1,908
Join Date: Apr 2011
Location: Virginia

 
DONATE TO ME
Quote:
Originally Posted by OTAw View Post
Though I don't have this problem, and hope never to, it is a scary scenario. Thanks for investing your time to come up with a fix for ppl who have this problem.
Thanks. I've also sent a patch to the person who I thing maintains the driver. If they'll accept the fix, it'll automatically correct this problem regardless of the type of device being used. That'd be a good thing.
My Android devices:
vzw Samsung Galaxy S4 stock NC5 rooted
Samsung Galaxy Tab 2 10.1, also stock but rooted.

VZ Droid Incredible 2 rooted but otherwise stock.
Samsung Galaxy Tab 10.1
 
DIZAZTER
Old
#10  
Junior Member
Thanks Meter 0
Posts: 2
Join Date: Sep 2007
I have the common problem with my Acer Iconia A500.
The tablet's touchscreen suddenly stopping working. And didn't start working after reset, shutdown, deattaching the battery, or any firmware upgrades/downgrades.
Custom bootloaders and restores also didn't help.
It is starting working only when I shutdown the tablet and don't use it for a while.
When I turn on the tablet after 2-3 hours, the touchscreen works. But after 10-15 minutes of usage(or even idle), touchscreen stop working again.
I tried many ways to solve this problem, but nothing works for me.

When I tryed to figure out this issue, I found only a few topics in the internet, but all of them was leading to this thread.

So, tell me please, is there any workaround to this touchscreen problem?
I suggest, this is the hardware problem. But if there is any software fix, it would be good.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes