Post Reply

[DEV] Working HTC touchscreen driver fix for ICS, no porting necessary

OP swm5126

4th November 2011, 04:58 PM   |  #1  
OP Senior Member
Thanks Meter: 199
 
263 posts
Join Date:Joined: Dec 2009
Donate to Me
Alright. Well. This is interesting.

I've fixed the original HTC touchscreen driver for use in ICS. I'm assuming it will work on other HTC phones as well, since the fix is FAR less intrusive in terms of changing existing code, or trying to port other drivers.

I was working on trying to map out the Samsung and HTC drivers in terms of data they let the system see as they are running. Getting no where fast, I remembered a couple days ago when I was attempting to get the touch keys working with the Samsung driver. Originally, I had added this code to the mxt224 driver above the line 'set_bit(EV_ABS, ts->input_dev->evbit);':

added to mxt224.c
Code:
set_bit(EV_SYN, ts->input_dev->evbit);
set_bit(EV_KEY, ts->input_dev->evbit);
set_bit(BTN_TOUCH, ts->input_dev->keybit);
set_bit(BTN_2, ts->input_dev->keybit);
I assumed this may have something to do with the softkeys, since it was present in the HTC driver with all four lines. By this I mean that in the HTC driver, that section looked like this:

atmel.c
Code:
set_bit(EV_SYN, ts->input_dev->evbit);
set_bit(EV_KEY, ts->input_dev->evbit);
set_bit(BTN_TOUCH, ts->input_dev->keybit);
set_bit(BTN_2, ts->input_dev->keybit);
set_bit(EV_ABS, ts->input_dev->evbit);
It worked fine in CM7 after doing this, but I lost all touchscreen in ICS, with it not even registering touch data anymore.

Back to my main point, I decided to see what would happen if I totally removed those four lines from the atmel.c file (HTC driver) and see what happens in ICS. Long story short, it works. Apparently ICS doesn't use or absolutely hates one or all four of those input preprocessors. So yeah I kinda **** bricks that it was that simple.

I'm going to try to see if its one or just all of these keybits that's causing the problem and I'll report back.

Instructions
If you want to try this, follow along:
  1. Get rid of build settings for the Samsung driver if you've been messing with that
  2. open up our favorite driver driver/input/touchscreen/atmel.c
  3. CRTL+F, search for EV_SYN
  4. Comment or delete all of the set_bit() lines except for the last one, EV_ABS
    Your atmel.c should only have this line now, where all five were before:

    Code:
    set_bit(EV_ABS, ts->input_dev->evbit);
  5. Clean your make environment and make sure your config files are set to use atmel-touchscreen
  6. **** bricks
Last edited by swm5126; 4th November 2011 at 05:09 PM.
The Following 19 Users Say Thank You to swm5126 For This Useful Post: [ View ]
4th November 2011, 05:21 PM   |  #2  
twistedumbrella's Avatar
Recognized Developer
Thanks Meter: 6,411
 
6,331 posts
Join Date:Joined: Sep 2007
More
so it should look like:

Code:
	ts->input_dev->name = "atmel-touchscreen";
//	set_bit(EV_SYN, ts->input_dev->evbit);
//	set_bit(EV_KEY, ts->input_dev->evbit);
//	set_bit(BTN_TOUCH, ts->input_dev->keybit);
//	set_bit(BTN_2, ts->input_dev->keybit);
	set_bit(EV_ABS, ts->input_dev->evbit);
?
The Following User Says Thank You to twistedumbrella For This Useful Post: [ View ]
4th November 2011, 05:33 PM   |  #3  
OP Senior Member
Thanks Meter: 199
 
263 posts
Join Date:Joined: Dec 2009
Donate to Me
Quote:
Originally Posted by twistedumbrella

so it should look like:

Code:
	ts->input_dev->name = "atmel-touchscreen";
//	set_bit(EV_SYN, ts->input_dev->evbit);
//	set_bit(EV_KEY, ts->input_dev->evbit);
//	set_bit(BTN_TOUCH, ts->input_dev->keybit);
//	set_bit(BTN_2, ts->input_dev->keybit);
	set_bit(EV_ABS, ts->input_dev->evbit);
?

Yeah try that. I've run into something though, which must be something stupid I'm doing but I can't figure out what the hell it is.

I've gone through each of those that I commented out to see if it was just one of the set_bits that was making it not work. But even with them all on now it's still working in ICS. I've cleaned my builds between each time. I think I'm going crazy! Because it didn't work before!
The Following 2 Users Say Thank You to swm5126 For This Useful Post: [ View ]
4th November 2011, 05:37 PM   |  #4  
twistedumbrella's Avatar
Recognized Developer
Thanks Meter: 6,411
 
6,331 posts
Join Date:Joined: Sep 2007
More
Quote:
Originally Posted by swm5126

Yeah try that. I've run into something though, which must be something stupid I'm doing but I can't figure out what the hell it is.

I've gone through each of those that I commented out to see if it was just one of the set_bits that was making it not work. But even with them all on now it's still working in ICS. I've cleaned my builds between each time. I think I'm going crazy! Because it didn't work before!

I'm building now and I will see what I can find out. It might be as simple as it forced the build to refresh in some way? Ill see what happens and let you know.
4th November 2011, 05:47 PM   |  #5  
twistedumbrella's Avatar
Recognized Developer
Thanks Meter: 6,411
 
6,331 posts
Join Date:Joined: Sep 2007
More
I'm already engaged, but I think she will understand... Will you marry me? haha, it worked!

And then I see this : http://android.modaco.com/topic/3481...y-system-dump/
Last edited by twistedumbrella; 4th November 2011 at 05:51 PM.
The Following User Says Thank You to twistedumbrella For This Useful Post: [ View ]
4th November 2011, 06:05 PM   |  #6  
w9jds's Avatar
Member
Flag Villa Park
Thanks Meter: 40
 
85 posts
Join Date:Joined: Jun 2009
More
Can you post the zip with it working? Please
Last edited by w9jds; 4th November 2011 at 06:07 PM.
4th November 2011, 06:07 PM   |  #7  
twistedumbrella's Avatar
Recognized Developer
Thanks Meter: 6,411
 
6,331 posts
Join Date:Joined: Sep 2007
More
Quote:
Originally Posted by w9jds

Can you post the zip with it working?

http://dl.dropbox.com/u/11023553/imo...4Mhz_vAOSP.zip

That is the Thunderbolt version

swm5126, I cannot than you enough for all the help. I really wouldn't have gotten anywhere without it. Least we can toast to a success!
But I am still looking into what needs to be commented, just a little excited to actually touch ICS. lol.
The Following User Says Thank You to twistedumbrella For This Useful Post: [ View ]
4th November 2011, 06:10 PM   |  #8  
OP Senior Member
Thanks Meter: 199
 
263 posts
Join Date:Joined: Dec 2009
Donate to Me
Quote:
Originally Posted by twistedumbrella

I'm already engaged, but I think she will understand... Will you marry me? haha, it worked!

And then I see this : http://android.modaco.com/topic/3481...y-system-dump/

Unfortunately I'm engaged too, so no dice!

Can't wait to take a look at those

Quick question, does your pointer in ICS seem to go back up to the top left hand corner of the screen? Or aren't you in pointer mode?
4th November 2011, 06:13 PM   |  #9  
LorD ClockaN's Avatar
Recognized Developer
Flag Veli Losinj
Thanks Meter: 27,499
 
13,235 posts
Join Date:Joined: Sep 2008
Donate to Me
More
for me it does!!
but I still can't unlock the F screen...
4th November 2011, 06:20 PM   |  #10  
OP Senior Member
Thanks Meter: 199
 
263 posts
Join Date:Joined: Dec 2009
Donate to Me
Quote:
Originally Posted by LorD ClockaN

for me it does!!
but I still can't unlock the F screen...

Awesome! Glad I'm not crazy and this works. They must have deprecated some of the input preprocessors. I'm just surprised using them in the driver basically made the touchscreen inoperable in ICS.

One step closer...to something! Now to figure out those pesky idc files to get this to work without the pointers.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Android Software Development by ThreadRank