FORUMS

Analysis & Opinion

Top Forum Discussions

[APP]CM/AOKP/AOSP S Pen detection

262 posts
Thanks Meter: 310
 
By tushar9989, Senior Member on 18th May 2013, 06:46 PM
Post Reply Subscribe to Thread Email Thread
https://play.google.com/store/apps/d...tushar.cmspen2
This is an application which allows detection of the S Pen detachment even on AOSP/AOKP/CM based ROMs.
It has only been tested on the Note 2 by me. If it works on your note device please let me know so that I can add it to the list of compatible note devices.

Explanation of how it works:

The android system automatically adds event files for each input device it detects when being installed. These event files are located in /dev/input/eventX where X denotes a particular device. These event files can be read using native C code for which I use an API provided by Radu Motisan which can be found here and also a bit more information about the event files can be found there. So now using this interface I find the event file for the S Pen and then continously read it to see if the value of the S Pen sensor has been changed. Whenever it changes I broadcast the corresponding Intent which was broadcasted by Samsung so that any applications which work based on that Intent can work even on these ROMs without having to change any of their code.

An interesting thing is that this feature is already present in CyanogenMod i.e S-Pen Power saving mode which disables the s pen touch decoder when the s pen is inserted. I fail to understand why they are not doing the same thing that I am doing through my application and save all of us the trouble.
Last edited by tushar9989; 16th April 2015 at 10:33 AM.
The Following 19 Users Say Thank You to tushar9989 For This Useful Post: [ View ]
 
 
19th May 2013, 09:01 AM |#2  
jnr21's Avatar
Senior Member
Flag Helsinki
Thanks Meter: 1,016
 
More
Phone vibrates when i inserted/detached s-pen, so it works? I have note2 lte (n7105) with latest rootbox nightly.

Sent from my GT-N7105 using Tapatalk 4 Beta
19th May 2013, 09:26 AM |#3  
Senior Member
Thanks Meter: 274
 
More
Quote:
Originally Posted by tushar9989

https://www.dropbox.com/s/eebkzugsm7...en%20Addon.apk

Guys this is the beta version of my application which can detect S Pen detection even on CyanogenMod(works for me on JellyBeer Rom).
Please test it out and tell me if it works on your ROM, it mimics the Intent which is broadcast-ed by Samsung when the S Pen is inserted/detached so any applications which use that intent should work fine.

You can use it in conjunction with my application S Pen Helper to mimic page-buddy on CM 10. Here is the playstore link https://play.google.com/store/apps/d...ar.spen_helper

It works well, also Using jellybeer rom. Very good, one thing, how to auto launch a note app? There is the option to launch something, but can't choose what to launch, unless I'm blind.(which could easily be the case)
19th May 2013, 09:51 AM |#4  
tushar9989's Avatar
OP Senior Member
Flag Mumbai
Thanks Meter: 310
 
Donate to Me
More
Quote:
Originally Posted by jnr21

Phone vibrates when i inserted/detached s-pen, so it works? I have note2 lte (n7105) with latest rootbox nightly.

Sent from my GT-N7105 using Tapatalk 4 Beta

If it's vibrating means it's working

Quote:
Originally Posted by bungknees

It works well, also Using jellybeer rom. Very good, one thing, how to auto launch a note app? There is the option to launch something, but can't choose what to launch, unless I'm blind.(which could easily be the case)

I had made spen-helper keeping Samsung based ROMs in mind so it selects s note by default but since it's not there on cm10 so it's blank just click below the enable launch toggle will pop up a dialog to change it. I'll fix it in the next version. Also I suggest not to keep the event monitor running in the background as it drains the battery a lot. I'm looking for a method to fix the battery drain currently.
The Following 2 Users Say Thank You to tushar9989 For This Useful Post: [ View ]
19th May 2013, 10:06 AM |#5  
Senior Member
Thanks Meter: 274
 
More
Quote:
Originally Posted by tushar9989

If it's vibrating means it's working



I had made spen-helper keeping Samsung based ROMs in mind so it selects s note by default but since it's not there on cm10 so it's blank just click below the enable launch toggle will pop up a dialog to change it. I'll fix it in the next version. Also I suggest not to keep the event monitor running in the background as it drains the battery a lot. I'm looking for a method to fix the battery drain currently.

Ok, thanks for the tip. Great work

Edit: just looked at battery now, and holy crap, yes it does drain it. But good start.
Last edited by bungknees; 19th May 2013 at 10:14 AM.
21st May 2013, 09:29 PM |#6  
tushar9989's Avatar
OP Senior Member
Flag Mumbai
Thanks Meter: 310
 
Donate to Me
More
Uploaded to play store and source code to GitHub and also a brief explanation on how it works
The Following User Says Thank You to tushar9989 For This Useful Post: [ View ]
27th May 2013, 06:27 PM |#7  
tushar9989's Avatar
OP Senior Member
Flag Mumbai
Thanks Meter: 310
 
Donate to Me
More
v0.2.1 out
-Bug fixes and optimizations
-Changed app version to reflect beta status
The Following User Says Thank You to tushar9989 For This Useful Post: [ View ]
31st May 2013, 04:12 PM |#8  
Member
Thanks Meter: 18
 
More
app lauch settings
Quote:
Originally Posted by tushar9989

v0.2.1 out
-Bug fixes and optimizations
-Changed app version to reflect beta status

Can't see the "app launch settings" you've mentioned. Did you remove it? The batery drain is visible but i think it's not catastrophic. I wonder why the CM team never got around implementing this because they already have the building blocks...
31st May 2013, 04:58 PM |#9  
tushar9989's Avatar
OP Senior Member
Flag Mumbai
Thanks Meter: 310
 
Donate to Me
More
Quote:
Originally Posted by leonard.pitzu

Can't see the "app launch settings" you've mentioned. Did you remove it? The batery drain is visible but i think it's not catastrophic. I wonder why the CM team never got around implementing this because they already have the building blocks...

The app launch settings are not there in this application. If you want those features you will have to use this application in conjunction with this.
Regarding the battery drain I fixed it in the last version if you are still having battery drain I would suggest increasing the polling value to 1000 which is responsive enough and not at all taxing on the battery
31st May 2013, 09:43 PM |#10  
Member
Thanks Meter: 18
 
More
Quote:
Originally Posted by tushar9989

The app launch settings are not there in this application. If you want those features you will have to use this application in conjunction with this.
Regarding the battery drain I fixed it in the last version if you are still having battery drain I would suggest increasing the polling value to 1000 which is responsive enough and not at all taxing on the battery

Thanks for the update. I already use the app you've pointed at - just thought your app could do the same (my bad...). On the battery side i disabled you app and the s pen helper leaving me with "stock" CM10.1 + a bunch of play store downloaded apps. The battery drain is still there so the good news is that your app works as expected - that is not causing any dramatic power consumption. The the bad side... the battery drain is caused by something else. I've installed wakelock doctor and am waiting to see which is the app causing the mentioned battery drain (~4%/hour - roughly 4 times more than usual).
Thanks for your quick support!
31st May 2013, 09:47 PM |#11  
tushar9989's Avatar
OP Senior Member
Flag Mumbai
Thanks Meter: 310
 
Donate to Me
More
Quote:
Originally Posted by leonard.pitzu

Thanks for the update. I already use the app you've pointed at - just thought your app could do the same (my bad...). On the battery side i disabled you app and the s pen helper leaving me with "stock" CM10.1 + a bunch of play store downloaded apps. The battery drain is still there so the good news is that your app works as expected - that is not causing any dramatic power consumption. The the bad side... the battery drain is caused by something else. I've installed wakelock doctor and am waiting to see which is the app causing the mentioned battery drain (~4%/hour - roughly 4 times more than usual).
Thanks for your quick support!

The battery drain is a problem in most of the CM based ROMs. I use Sentinel ROM which gives much better battery life than any of the other ROMs I tried. Link is in my signature in case you want to try it out.

Read More
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes