Jump to content

  1. 0
  2. 0
  3. 0/5

Rate this Topic

* * * * *
4 votes

TouchPad Android Touchscreen Driver Development (Updated 2012-02-28)

Touchpad touchscreen
  • Please log in to reply

OP Dees_Troy

Dees_Troy

TeamWin

Posted 27 January 2012 - 05:39 PM #1

I'm going to start a thread for further testing of the touchscreen developments that I and others on the CM team have been working on. I feel like we've reached the point where the more obvious stuff has been fixed and anything else that's new will require wider testing before pushing it into the CM repo. Differences in touchscreens, finger sizes, and usage patterns will need to be tested to ensure that any further updates work well in a wide variety of situations.

My source code is available here:
Dees_Troy's GitHub
You can also track the progress of the patches in CM here:
All of these patches have been accepted! All nightlies on/after 2012-02-29 will include these patches:
Patch for hover debounce
Patch to move digitizer power management out of liblights and into the touchscreen driver
Patch for tracking IDs in Gerrit
Power saving patch in Gerrit
Patch for binary to change touchscreen mode in Gerrit
Some thoughts on the touchscreen and development in this link.

Note, you can only install one driver at a time. They're listed newest to oldest. Newer versions will have all of the features found in previous versions unless otherwise noted in the feature list. There's no need to install an older version before installing a newer version. All versions are for CM9 Android 4.0 / ICS unless otherwise noted. All zips should be signed. Install via recovery / CWM just like any other zip. No wiping should be needed.

Download links and changelog:
NOTE: nightlies on/after 2012-02-29 will include all of the improvements found in v15!
Tracking IDs v15 for CM9 2012-02-28:
Bugfixes for hover debounce. The v14 version works fine, but the code wasn't working the way that I intended. This version provides the correct behavior.

Tracking IDs v14 for CM9 2012-02-27:
Changed hover debounce - it now doesn't start the hover debounce unless you hover for 30 cycles (about 0.3 seconds) which should smooth out slow scrolling a little bit. I also moved the power management of the digitizer into ts_srv and out of liblights. Liblights should just be for the screen / notification lights. The CM team originally located the digitizer power management in there in lieu of setting up communications between liblights and ts_srv. We're now able to use the same socket communications to determine when to turn the digitizer on/off as well as open & close the uart.

Tracking IDs v13 for CM9 2012-02-25:
Added a filter to debounce a "hover" after scrolling. If you scroll a little ways then hold your finger still, it will debounce to 2 pixels. This may make scrolling really slowly a little bit jumpy, but it will keep the screen from wiggling around if you hold your finger still after scrolling. This version also includes a newer version of ts_srv_set that can return the touchscreen mode that is currently in use. This will be needed for the new custom settings for the TouchPad that include the ability to change touchscreen modes.

Tracking IDs v12 for CM9 2012-02-16:
No changes to the way touch behaves. Updated the path for the socket to use what I believe it he proper location for a Unix socket. This also marks the unification of the finger and stylus versions of the driver and you can now choose which mode of operation you want on the fly. There is an additional binary included in this zip called ts_srv_set. Run it via adb or terminal emulator like so:
ts_srv_set S
The above command would set the touchscreen thresholds for stylus operation. Doing this:
ts_srv_set F
will set it back to finger mode. The setting will stick between reboots (yes, we're using a settings file of sorts -- a very basic one) but the setting will be wiped in a factory reset. The default setting is finger mode, so if you are a finger user, there is nothing that you need to do. This version also includes the power savings features from v11, of course. Settings for finger then stylus mode are unchanged, but as follows:
TOUCH_INITIAL_THRESHOLD 32 32
TOUCH_CONTINUE_THRESHOLD 26 16
TOUCH_DELAY_THRESHOLD 28 24
TOUCH_DELAY 5 2

If someone with some app development skills (someone who knows Java) wants to write an app or modify CM to change the setting in a GUI, I'll be happy to provide information on how to do so. Otherwise, you can set up something like GScript to make it easier to switch between modes.

Tracking IDs v11 for CM9 2012-02-15:
No changes to the way that touch itself behaves. I have added code to both liblights and the touchscreen driver so that liblights can tell the touchscreen driver when the screen turns off. The touchscreen driver will now close the uart connection that it uses to receive touchscreen data to save a little bit of battery power.

Tracking IDs v10 for CM9 2012-02-13 (Also available for CM7):
Some improvements in CPU utilization due to no longer needing to copy values from array to array. Increased some thresholds to help prevent the double-click issue that some people are reporting. Touch delay threshold is 28, touch delay count is 5 cycles, large area unpress at 22 and touch continue threshold at 26. This should bring this version more in line with the thresholds that we were using in v5. When my stylus comes, I'll start working on stylus operation in a separate branch to prevent work on stylus use from affecting finger use until I'm sure that I can get both types of use working well in the same driver.

Tracking IDs v9 2012-02-10:
Increased threshold for continuing an existing touch back to 20 to prevent some of the issues that users were reporting when lifting a finger off of the screen (and perhaps a few other odd behaviours). Some changes that slightly reduce CPU utilization and other changes to help pass the CM review process. The changes in v8 to help support stylus use somewhat hurt regular finger use and probably didn't help stylus use. I've decided not to work on stylus compatibility again until my stylus arrives.

Tracking IDs v8 2012-02-09:
Changes to the large area filter code to scan diagonal points. Reduced the threshold for continuing an existing touch to 16 to maybe help out stylus users.

Tracking IDs v7 2012-02-09:
Removed a feature that was part of large area filtering that was supposed to improve pinch distances that ended up causing problems with filtering the side of your thumb. Slightly increases minimum pinch distances, but pinch distances and performance are still comparable to webOS. Large area filtering is more accurate and tracks a better line when swiping. It's possible that these changes may also help tracking a straighter line with styluses. Some thresholds were tweaked slightly to work with these new changes.

Tracking IDs v6 2012-02-08:
This version is intended to improve support for styluses. I don't have a stylus, so it's hard for me to test to ensure proper operation. Also, different styluses will perform differently, so even if I had one, that doesn't mean that yours will work well. Describing the changes is going to take a bit, so bear with me. There are now several touch thresholds. First off, any touch that is over a value of 32 will be immediately reported. Any touch with a value over 24 but under 32 will only be reported if we see that touch repeated twice and thus won't be reported right away. This delay is very small as we get touch data 100 times per second. Any touch that has been reported will continue to be reported so long as it stays over a value of 20.

Tracking IDs v5 2012-02-07:
This is a very minor update. Changed touch threshold to 26 as I believe this more closely matches what HP used in webOS. Modified another threshold to improve large are filtering like the side of your thumb. Moved a block of code around to slightly improve CPU utilization when multiple touches are involved. Some code cleanup.

Tracking IDs v4 2012-02-06:
Improvements in a lot of areas, almost too numerous to mention. jyxent is responsible for most of this new code, I just cleaned it up a little bit. It should allow you to pinch closer. It tracks a better line for both small and large area touches. Improvements in CPU utilization. Also improved the impossibly large change filter to check previous distance and direction for better filtering (this is my other contribution). Touch threshold is back to 28 and debounce is now 10 pixels.

Tracking IDs v3 2012-02-04:
Significant reductions in CPU utilization. Many thanks to jyxent for his help in refactoring the tracking ID code! Also changed many of the floating point operations to integer operations. This version also finally makes some use of the tracking ID code. In the video at the bottom of this post, you could still get large touch changes to be reported as a swipe if you had an exra finger touching the screen. In this version, we're checking for large changes in touches for all touches.

Tracking IDs v2 2012-02-03:
Initial attempt at adding tracking IDs to the touchscreen driver. This probably won't improve anything for anyone, but it lays the groundwork for better operations in future versions. We now assign tracking IDs to each touch instead of letting the OS attempt to do it on its own. Tracking ID v1 was only released in IRC and was found to have an issue. Since only a couple of people tested it, I'm not posting it here. Also reduced the maximum touches that we track to 5 because Android doesn't seem to handle more than 5 properly anyway even though we're giving it the right tracking IDs. Increased the threshold for what is considered a valid touch from 28 to 36. This means that the driver is less sensitive. Lower sensitivity should allow you to pinch closer before the pinch counts as a single touch and reduce bouncing on a long press.

Debounce v2 2012-01-31:
Changed the threshold for what is considered a valid touch from 24 to 28.

Debounce v1 2012-01-30:
Added a debouncer to make it easier to long press. This version will report that your finger or thumb is in the same spot until you move at least 2 pixels in any direction. Some people reported difficulties with doing a long press, so I added a debouncer.

Thumb fix 2 2012-01-28:
Decreased thresholds for the large surface area filter to make it more aggressive. This version is more likely to report the side of your thumb as a single touch, but also more likely to report 2 fingers close together as a single touch. I realized after doing some testing on my phone that the first version wasn't being aggressive enough.

Thumb fix (original) 2012-01-27:
Filter for large surface area touches added, but thresholds set high, so not very aggressive at filtering large touches (e.g. the side of your thumb). On previous drivers, scrolling on a webpage with the side of your thumb would sometimes cause the page to zoom instead of scroll.
Minor re-factoring to other functions to make them more efficient.

Touchscreen fix for alpha0.5 (same driver as is in alpha0.6):
Fixed a problem where lighter swipes would sometimes be reported as touches and not swipes.
Lowered the threshold for what is considered a valid touch from 32 to 24.

alpha0.5:
The first thing that I set out to fix was the issue seen in this video:
http://www.youtube.com/watch?v=ZVQ1PXKyHc4

If you simultaneously released with one finger and touched down in another spot with a different finger, the alpha0 driver would report that as a swipe. It was especially annoying if you used a keyboard like Swiftkey Tablet X and used the default gesture actions. A swipe left gesture is used to delete a word, so if you typed quickly on the keyboard, you'd frequently delete whole words. We fixed this with 2 changes:
1) Send a liftoff event if there's no valid touch data found in the touchscreen data buffer.
2) Add a filter to filter out large changes in touches.

alpha0:
Initial starting point for ICS.

A note about styluses: We are not targetting proper operation for styluses. That doesn't mean that we won't take a look, but not all styluses are the same and your stylus may not be compatible with the sensitivity of the TouchPad's touchscreen even if it works well with other devices. You may have to try several different ones before you find one that works well. If you have one that's working well with the newer drivers, feel free to post the make/model, where you bought it, and what driver you used so that others can find one that works well. Our goal is to get the touchscreen working well with fingers first. If you don't agree with that, you are welcome to download the source code and modify the driver to your heart's content.

Special thanks to the CM team for their great work on porting Android to the TouchPad. I could not have created the touchscreen driver myself. I am just modifying the fantastic work of others. All credit should go to them.

Power savings:
NOTE: You should not use this with any driver made on or after 2012-02-15 as the new driver does the same thing only better!
Power Savings v1 2012-02-07 :
I honestly don't really recommend using this as it can cause some compatiblity problems with some apps. This will stop your touchscreen driver when the display is off and restart it when the display turns back on. This does sometimes have a small side effect due to the fact that it recreates the touchscreen input device each time, but it should save a little battery by letting the TouchPad close the uart. If you don't like it & want to go back, use this:
Return to stock

Edited by Dees_Troy, 28 February 2012 - 07:36 PM.

  • 20 Likes

HY-rowi

HY-rowi

Android Lover

  • 110 posts

Posted 27 January 2012 - 08:29 PM #2

definitely the best one so far out of everything since 0.5. no accidental double clicks or anything.

i'm not a big keyboard or terminal user so can't say much about rapid typing, but as far as swipes and such go this definitely has no "what-the..." moment.
  • 0 Likes

CyaFish

CyaFish

Average Android

Posted 28 January 2012 - 11:29 AM #3

A few weeks after buying the Touchpad I bought the Jot Pro stylus (no this is not a plug ;)), and have been wanting to effectively take notes with it on my tablet. But every app in Gingerbread was abysmal for note taking or the general response was poor. After the ICS update I was pleased to be able to use ICS apps for note taking (which worked alot better) but the response was even more terrible than in GB. My stylus stroke was spotty and would jump around and I had to write super slow to get readable notes. However, after flashing your work I was incredibly happy. The response and accuracy are spot on, and I can take notes at full handwriting speed with no issues. The combination of Asus SuperNote, the Jot Pro, and this patch is damn near perfect.

Thanks!

Edited by CyaFish, 28 January 2012 - 11:30 AM.

  • 2 Likes

mars

mars

Android Beginner

  • 13 posts

Posted 28 January 2012 - 04:04 PM #4

since trying this driver im getting random and constant reboots.. how can i go back!
  • 0 Likes

mars

mars

Android Beginner

  • 13 posts

Posted 28 January 2012 - 04:07 PM #5

Im reflashing to CM9 A0.5 via CWM to see if this takes me back
  • 0 Likes

Krunk_Kracker

Krunk_Kracker

Android Lova' Lova'

Posted 28 January 2012 - 05:38 PM #6

since trying this driver im getting random and constant reboots.. how can i go back!


Hopefully you made a nandroid backup and can just flash back to that.

Sent from my DROIDX using Tapatalk
  • 1 Likes
Droid X - Boosted ICS
TouchPad - Classicnerd ICS
Kindle Fire - Classicnerd ICS

maxwintrobe

maxwintrobe

Android Beginner

  • 14 posts

Posted 28 January 2012 - 08:17 PM #7

thumbfix2 works well, bit better than dalingrin's fix i think, no reboot issues here, thanks
  • 0 Likes

ab-ster

ab-ster

Average Android

  • 6 posts

Posted 28 January 2012 - 08:46 PM #8

i downloaded and tested your ts_srv.c. It seems to do the trick. navigating google earth is now very smooth. Thanks.
  • 0 Likes

nang

nang

Member

  • 12 posts

Posted 28 January 2012 - 09:09 PM #9

I been testing out the thumb fix 2. So far I'm liking it. It makes cm9 smoother sort of like iPad 2 smooth. Hopefully it will get even better. But right now I'm just enjoying this one. Thanks keep up the good work.
  • 0 Likes

AndroidON

AndroidON

Member

  • 10 posts

Posted 29 January 2012 - 02:45 AM #10



This is not related to HP touchpad, but Motorola Atrix have same problem.

I saw your github and touchpad's touch driver was completely different from it of Atrix.

Can you please do some mod for Atrix?

Link is Atrix's touch driver source.

https://github.com/A...qtouch_obp_ts.c

Ps. I'm also bought a used HP touchpad and it's comming day after tommorow.

Looking forword to use this one :lol:
  • 0 Likes