Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,804,462 Members 42,802 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
swm5126
Old
(Last edited by swm5126; 4th November 2011 at 05:09 PM.)
#1  
Senior Member - OP
Thanks Meter 199
Posts: 263
Join Date: Dec 2009

 
DONATE TO ME
Default [DEV] Working HTC touchscreen driver fix for ICS, no porting necessary

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
The Following 19 Users Say Thank You to swm5126 For This Useful Post: [ Click to Expand ]
 
twistedumbrella
Old
#2  
twistedumbrella's Avatar
Recognized Developer
Thanks Meter 6,253
Posts: 6,216
Join Date: Sep 2007

 
DONATE TO ME
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: [ Click to Expand ]
 
swm5126
Old
#3  
Senior Member - OP
Thanks Meter 199
Posts: 263
Join Date: Dec 2009

 
DONATE TO ME
Quote:
Originally Posted by twistedumbrella View Post
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: [ Click to Expand ]
 
twistedumbrella
Old
#4  
twistedumbrella's Avatar
Recognized Developer
Thanks Meter 6,253
Posts: 6,216
Join Date: Sep 2007

 
DONATE TO ME
Quote:
Originally Posted by swm5126 View Post
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.
 
twistedumbrella
Old
(Last edited by twistedumbrella; 4th November 2011 at 05:51 PM.)
#5  
twistedumbrella's Avatar
Recognized Developer
Thanks Meter 6,253
Posts: 6,216
Join Date: Sep 2007

 
DONATE TO ME
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/
The Following User Says Thank You to twistedumbrella For This Useful Post: [ Click to Expand ]
 
w9jds
Old
(Last edited by w9jds; 4th November 2011 at 06:07 PM.)
#6  
w9jds's Avatar
Member
Thanks Meter 40
Posts: 85
Join Date: Jun 2009
Location: Villa Park
Can you post the zip with it working? Please
 
twistedumbrella
Old
#7  
twistedumbrella's Avatar
Recognized Developer
Thanks Meter 6,253
Posts: 6,216
Join Date: Sep 2007

 
DONATE TO ME
Quote:
Originally Posted by w9jds View Post
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: [ Click to Expand ]
 
swm5126
Old
#8  
Senior Member - OP
Thanks Meter 199
Posts: 263
Join Date: Dec 2009

 
DONATE TO ME
Quote:
Originally Posted by twistedumbrella View Post
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?
 
LorD ClockaN
Old
#9  
LorD ClockaN's Avatar
Recognized Developer
Thanks Meter 27,442
Posts: 13,177
Join Date: Sep 2008
Location: Veli Losinj

 
DONATE TO ME
for me it does!!
but I still can't unlock the F screen...
New ROM/kernel versions depend strictly on my wife's sex drive, so ask her for ETA!!

IceColdJelly IRC channel
HTC One X -> IceColdJelly422
Build IceColdJelly422 from source - link

One X: IceColdJelly JB - OneX - git, IceColdAOKP ICS - OneX - git
Desire HD: IceColdSandwich - git, AOSP GB kernel - 10.0, Sense GB kernel

If you like my work, please consider buying me a beer via paypal to my email: davor@losinj.com
Help me get some extra space on dropbox - link
 
swm5126
Old
#10  
Senior Member - OP
Thanks Meter 199
Posts: 263
Join Date: Dec 2009

 
DONATE TO ME
Quote:
Originally Posted by LorD ClockaN View Post
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.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes