Android One Devices Get Unofficial CM12 Port

Android One was initially announced right before Android Lollipop. By releasing these cheap, yet … more

WhatsApp Decides to Protect Your Data

When Facebook bought WhatsApp for the absurdly large sum of $19bn back in February, they took the tech … more

Bring Back LTE on the Google Nexus 4 Running Lollipop

One of the predecessors of the latest, largest, and greatest Gooogle Nexus 6(theGoogle … more

Google Maps, My Maps, YouTube, Androidify, Slides, Music Updated–Here’s What’s New

In the last few weeks, Google has been … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Kernel patch for 3-10 point multi-touch

OP tchebb

19th December 2010, 06:04 AM   |  #1  
OP Recognized Developer
Flag Waltham, MA
Thanks Meter: 215
 
188 posts
Join Date:Joined: Jul 2010
Donate to Me
More
I've had this patch for a while now, but I decided to finally post it here in the hope it might help someone. I kept hearing about how much better the Incredible's touchscreen is compared to the Nexus One's, so I wondered why it could only handle a maximum of 2 touches. It seems that the Incredible uses the Atmel mXT224 as its touch controller. The summary from Atmel clearly states "True 12-bit multiple touch with independent XY tracking for up to 10 concurrent touches in real time with touch size reporting." It turns out, it's actually quite a simple kernel mod to enable all 10 touches (although I've noticed the tracking quality start to degrade above 5). I've been running this on my Incredible for a month or so, and I've noticed no ill effects from it.

All you need to do is edit arch/arm/mach-msm/board-incrediblec.c, and replace
Code:
struct atmel_i2c_platform_data incrediblec_atmel_ts_data[] = {
	{
		.version = 0x016,
		.abs_x_min = 1,
		.abs_x_max = 1023,
		.abs_y_min = 2,
		.abs_y_max = 966,
		.abs_pressure_min = 0,
		.abs_pressure_max = 255,
		.abs_width_min = 0,
		.abs_width_max = 20,
		.gpio_irq = INCREDIBLEC_GPIO_TP_INT_N,
		.power = incrediblec_atmel_ts_power,
		.config_T6 = {0, 0, 0, 0, 0, 0},
		.config_T7 = {50, 15, 25},
		.config_T8 = {10, 0, 20, 10, 0, 0, 5, 15},
		.config_T9 = {139, 0, 0, 18, 12, 0, 16, 38, 3, 7, 0, 5, 2, 15, 2, 10, 25, 5, 0, 0, 0, 0, 0, 0, 0, 0, 159, 47, 149, 81, 40},
		.config_T15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T19 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T20 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T22 = {15, 0, 0, 0, 0, 0, 0, 0, 16, 0, 1, 0, 7, 18, 25, 30, 0},
		.config_T23 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T24 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T25 = {3, 0, 200, 50, 64, 31, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T27 = {0, 0, 0, 0, 0, 0, 0},
		.config_T28 = {0, 0, 2, 4, 8, 60},
		.object_crc = {0xDB, 0xBF, 0x60},
		.cable_config = {35, 30, 8, 16},
		.GCAF_level = {20, 24, 28, 40, 63},
		.filter_level = {15, 60, 963, 1008},
	},
	{
		.version = 0x015,
		.abs_x_min = 13,
		.abs_x_max = 1009,
		.abs_y_min = 15,
		.abs_y_max = 960,
		.abs_pressure_min = 0,
		.abs_pressure_max = 255,
		.abs_width_min = 0,
		.abs_width_max = 20,
		.gpio_irq = INCREDIBLEC_GPIO_TP_INT_N,
		.power = incrediblec_atmel_ts_power,
		.config_T6 = {0, 0, 0, 0, 0, 0},
		.config_T7 = {50, 15, 25},
		.config_T8 = {12, 0, 20, 20, 0, 0, 20, 0},
		.config_T9 = {139, 0, 0, 18, 12, 0, 32, 40, 2, 7, 0, 5, 2, 0, 2, 10, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 159, 47, 149, 81},
		.config_T15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T19 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T20 = {7, 0, 0, 0, 0, 0, 0, 30, 20, 4, 15, 5},
		.config_T22 = {7, 0, 0, 25, 0, -25, 255, 4, 50, 0, 1, 10, 15, 20, 25, 30, 4},
		.config_T23 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T24 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T25 = {3, 0, 200, 50, 64, 31, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T27 = {0, 0, 0, 0, 0, 0, 0},
		.config_T28 = {0, 0, 2, 4, 8, 60},
		.object_crc = {0x19, 0x87, 0x7E},
	},
	{
		.version = 0x014,
		.abs_x_min = 13,
		.abs_x_max = 1009,
		.abs_y_min = 15,
		.abs_y_max = 960,
		.abs_pressure_min = 0,
		.abs_pressure_max = 255,
		.abs_width_min = 0,
		.abs_width_max = 20,
		.gpio_irq = INCREDIBLEC_GPIO_TP_INT_N,
		.power = incrediblec_atmel_ts_power,
		.config_T6 = {0, 0, 0, 0, 0, 0},
		.config_T7 = {50, 15, 25},
		.config_T8 = {12, 0, 20, 20, 0, 0, 10, 15},
		.config_T9 = {3, 0, 0, 18, 12, 0, 48, 45, 2, 7, 0, 0, 0, 0, 2, 10, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 47, 143, 81},
		.config_T15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T19 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T20 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T22 = {5, 0, 0, 25, 0, -25, 255, 4, 50, 0, 1, 10, 15, 20, 25, 30, 4},
		.config_T23 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T24 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T25 = {3, 0, 200, 50, 64, 31, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T27 = {0, 0, 0, 0, 0, 0, 0},
		.config_T28 = {0, 0, 2, 4, 8, 60},
	}
};
with
Code:
struct atmel_i2c_platform_data incrediblec_atmel_ts_data[] = {
	{
		.version = 0x016,
		.abs_x_min = 1,
		.abs_x_max = 1023,
		.abs_y_min = 2,
		.abs_y_max = 966,
		.abs_pressure_min = 0,
		.abs_pressure_max = 255,
		.abs_width_min = 0,
		.abs_width_max = 20,
		.gpio_irq = INCREDIBLEC_GPIO_TP_INT_N,
		.power = incrediblec_atmel_ts_power,
		.config_T6 = {0, 0, 0, 0, 0, 0},
		.config_T7 = {50, 15, 25},
		.config_T8 = {10, 0, 20, 10, 0, 0, 5, 15},
		.config_T9 = {139, 0, 0, 18, 12, 0, 16, 38, 3, 7, 0, 5, 2, 15, 10, 10, 25, 5, 0, 0, 0, 0, 0, 0, 0, 0, 159, 47, 149, 81, 40},
		.config_T15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T19 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T20 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T22 = {15, 0, 0, 0, 0, 0, 0, 0, 16, 0, 1, 0, 7, 18, 25, 30, 0},
		.config_T23 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T24 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T25 = {3, 0, 200, 50, 64, 31, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T27 = {0, 0, 0, 0, 0, 0, 0},
		.config_T28 = {0, 0, 2, 4, 8, 60},
		.object_crc = {0xDB, 0xBF, 0x60},
		.cable_config = {35, 30, 8, 16},
		.GCAF_level = {20, 24, 28, 40, 63},
		.filter_level = {15, 60, 963, 1008},
	},
	{
		.version = 0x015,
		.abs_x_min = 13,
		.abs_x_max = 1009,
		.abs_y_min = 15,
		.abs_y_max = 960,
		.abs_pressure_min = 0,
		.abs_pressure_max = 255,
		.abs_width_min = 0,
		.abs_width_max = 20,
		.gpio_irq = INCREDIBLEC_GPIO_TP_INT_N,
		.power = incrediblec_atmel_ts_power,
		.config_T6 = {0, 0, 0, 0, 0, 0},
		.config_T7 = {50, 15, 25},
		.config_T8 = {12, 0, 20, 20, 0, 0, 20, 0},
		.config_T9 = {139, 0, 0, 18, 12, 0, 32, 40, 2, 7, 0, 5, 2, 0, 10, 10, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 159, 47, 149, 81},
		.config_T15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T19 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T20 = {7, 0, 0, 0, 0, 0, 0, 30, 20, 4, 15, 5},
		.config_T22 = {7, 0, 0, 25, 0, -25, 255, 4, 50, 0, 1, 10, 15, 20, 25, 30, 4},
		.config_T23 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T24 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T25 = {3, 0, 200, 50, 64, 31, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T27 = {0, 0, 0, 0, 0, 0, 0},
		.config_T28 = {0, 0, 2, 4, 8, 60},
		.object_crc = {0x19, 0x87, 0x7E},
	},
	{
		.version = 0x014,
		.abs_x_min = 13,
		.abs_x_max = 1009,
		.abs_y_min = 15,
		.abs_y_max = 960,
		.abs_pressure_min = 0,
		.abs_pressure_max = 255,
		.abs_width_min = 0,
		.abs_width_max = 20,
		.gpio_irq = INCREDIBLEC_GPIO_TP_INT_N,
		.power = incrediblec_atmel_ts_power,
		.config_T6 = {0, 0, 0, 0, 0, 0},
		.config_T7 = {50, 15, 25},
		.config_T8 = {12, 0, 20, 20, 0, 0, 10, 15},
		.config_T9 = {3, 0, 0, 18, 12, 0, 48, 45, 2, 7, 0, 0, 0, 0, 10, 10, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 47, 143, 81},
		.config_T15 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T19 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T20 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T22 = {5, 0, 0, 25, 0, -25, 255, 4, 50, 0, 1, 10, 15, 20, 25, 30, 4},
		.config_T23 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T24 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T25 = {3, 0, 200, 50, 64, 31, 0, 0, 0, 0, 0, 0, 0, 0},
		.config_T27 = {0, 0, 0, 0, 0, 0, 0},
		.config_T28 = {0, 0, 2, 4, 8, 60},
	}
};
For those who didn't spot the change, it's in config_t9 (highlighted in bold). You can, of course, change the 10 to anything you want (I've only tested with between 2 and 10, though) and that will be set as the maximum number of touches.

I hope this helps someone.
Last edited by tchebb; 19th December 2010 at 07:14 AM.
The Following 8 Users Say Thank You to tchebb For This Useful Post: [ View ]
19th December 2010, 07:09 AM   |  #2  
Senior Member
Flag Columbus
Thanks Meter: 18
 
371 posts
Join Date:Joined: Jun 2010
Donate to Me
More
I have been digging for this forever! THANKS!!!
Last edited by seanzer; 19th December 2010 at 09:52 AM.
19th December 2010, 07:44 AM   |  #3  
Senior Member
Thanks Meter: 31
 
384 posts
Join Date:Joined: Oct 2010
This actually seems quite useful and I wasn't even aware this was possible! Two quick questions if you don't mind - first of all, did you mean that enabling above 5 touch points would cause tracking to degrade, or just using it (having 5 or more fingers on the screen would cause tracking to degrade)? Also, howdy I go about editing this file in the first place? Thanks!
19th December 2010, 07:47 AM   |  #4  
Senior Member
Thanks Meter: 42
 
545 posts
Join Date:Joined: Aug 2010
More
I'm not savvy enough to change it without a .zip flash. However, it'll be nice to see this incorporated into some custom kernels soon
19th December 2010, 08:09 AM   |  #5  
Member
Boston
Thanks Meter: 4
 
79 posts
Join Date:Joined: Oct 2010
More
Quote:
Originally Posted by mikeymop

I'm not savvy enough to change it without a .zip flash. However, it'll be nice to see this incorporated into some custom kernels soon

These are changes applied to the kernel source, so not a file on your phone that is to be edited. Someone would need to make the changes to the source code files and then recompile the kernel (which you could then flash)... perhaps invisiblek can add it to his next kernel release?
19th December 2010, 08:13 AM   |  #6  
OP Recognized Developer
Flag Waltham, MA
Thanks Meter: 215
 
188 posts
Join Date:Joined: Jul 2010
Donate to Me
More
Quote:
Originally Posted by xShin

This actually seems quite useful and I wasn't even aware this was possible! Two quick questions if you don't mind - first of all, did you mean that enabling above 5 touch points would cause tracking to degrade, or just using it (having 5 or more fingers on the screen would cause tracking to degrade)? Also, howdy I go about editing this file in the first place? Thanks!

I haven't done extensive testing, but the tracking at up to 5 points seems to be about the same quality no matter how many you have enabled. As for editing the file, you need to recompile the kernel and flash an update.zip with the new one. I'll patch the stock HTC Sense kernel and post a pre-compiled update.zip tomorrow. If you use a different kernel, you can either download and patch the source yourself, or send a request to the kernel author that this patch be included by default.
19th December 2010, 01:11 PM   |  #8  
Senior Member
Thanks Meter: 20
 
205 posts
Join Date:Joined: Jan 2007
This is cool, but do any programs utilize more than two touch points?
19th December 2010, 03:02 PM   |  #9  
Senior Member
Thanks Meter: 9,453
 
1,883 posts
Join Date:Joined: Oct 2010
Donate to Me
Quote:
Originally Posted by megarek

This is cool, but do any programs utilize more than two touch points?

Exactly this.
19th December 2010, 03:24 PM   |  #10  
djh816's Avatar
Recognized Developer
Thanks Meter: 188
 
507 posts
Join Date:Joined: Jul 2009
Donate to Me
Quote:
Originally Posted by invisiblek

cool, thanks!

does this mean you're going to include in your kern now??

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

Advanced Search
Display Modes