Disclaimer
Gestures Available
Commits
Walkthrough
First off all I modified detect_sweep2wake function.
It now takes id as parameters as well.
id here is the touch id which is returned when we lift off contact from touch.
Do note that for this device, the id returned when we lift off contact from touch is 255, it will be different for different devices.
What this new detect_sweep2wake fn does is, it tests whether the id returned is that id (touch id which is returned when we lift off contact from touch) and the touch count is greater than a specific number or not.
The specific touch count is used to detect continuous touches (swipes).
If true, it calls for gesture detection function, if true, returns true, if false returns false.
If false, it dumps co-ordinates. Co-ordinates are dumped to 2 variables (x,y) and previous data is stored in (x_prev,y_prev). The first values of touch (the touch co-ordinates on first touch) is stored separately as well.
Then direction_vector_calc is called, which tests the nature of co-ordinates with respect to the previous one.
At times, there maybe cases that a co-ordinate differs from its previous co-ordinate by 2 directions. This functions take care of that too.
The readings are stored in an array an then tested by gesture detection logic.
The working of gesture_detection is explained in the extended description of this commit.
If swipe matches any gesture, it returns corresponding value, else returns 0.
About toggling, I created separate files for each gesture. Also, to simplify things, I had added a master switch for these gestures.
I also made an app for this to control these toggles - Gesture Control 1.4
Credits
- First off all, thanks to showp1984 for his original sweep2wake, based on which, this has been made.
- I am a newbie in linux kernel programming, I did spend considerable amount of time, working with others to know about how touch input works. In many places, code will be useless, or there may be better way of implementation. Based on my understanding, I coded this.
- This was originally made for a specific device, so I will try to explain wherever possible, so that it becomes easier for someone to implement in case they are interested.
- This post does not show how to add hooks in touch panel driver and display driver.
Gestures Available
- Swipe Left
- Swipe Right
- Swipe Up
- Swipe Down
- Swipe Forward Diagonally
- Swipe Backward Diagonally
- Draw 'L'
- Draw 'V'
Commits
- Initial Commit - https://github.com/corphish/android_...0b18741ac75f24 (Please read the extended description, as I have explained there what I have done)
- Fixes - https://github.com/corphish/android_...d1e7815a375677
Walkthrough
First off all I modified detect_sweep2wake function.
It now takes id as parameters as well.
id here is the touch id which is returned when we lift off contact from touch.
Do note that for this device, the id returned when we lift off contact from touch is 255, it will be different for different devices.
What this new detect_sweep2wake fn does is, it tests whether the id returned is that id (touch id which is returned when we lift off contact from touch) and the touch count is greater than a specific number or not.
The specific touch count is used to detect continuous touches (swipes).
If true, it calls for gesture detection function, if true, returns true, if false returns false.
If false, it dumps co-ordinates. Co-ordinates are dumped to 2 variables (x,y) and previous data is stored in (x_prev,y_prev). The first values of touch (the touch co-ordinates on first touch) is stored separately as well.
Then direction_vector_calc is called, which tests the nature of co-ordinates with respect to the previous one.
At times, there maybe cases that a co-ordinate differs from its previous co-ordinate by 2 directions. This functions take care of that too.
The readings are stored in an array an then tested by gesture detection logic.
The working of gesture_detection is explained in the extended description of this commit.
If swipe matches any gesture, it returns corresponding value, else returns 0.
About toggling, I created separate files for each gesture. Also, to simplify things, I had added a master switch for these gestures.
I also made an app for this to control these toggles - Gesture Control 1.4
Credits
- showp1984 - Without his works, this is just nothing.
- thewisenerd - It is for this guy, I know what I know about touch panels.