Post Reply

Enable Pen Mode - Any pen or pencil works as stylus!

OP AndroPlus

18th February 2014, 09:04 AM   |  #1  
AndroPlus's Avatar
OP Senior Member
Thanks Meter: 982
 
456 posts
Join Date:Joined: Mar 2013
Donate to Me
More
AOKP introduced pen mode for Z1 and I could enable it on stock ROM!
Xperia Z Ultra can use the pen or pencil made of wood or metal as stylus, but Z1's screen also supports it and Sony disabled it for some reason.

root is needed to enable this.

To enable pen mode, there's three methods.
One of them is enough.
● Create init.d script in /system/etc/init.d (requires init.d support):
Code:
#!/system/bin/sh
chown system:system /sys/devices/virtual/input/clearpad/pen
echo 1 > /sys/devices/virtual/input/clearpad/pen
● Add these lines at the bottom of /system/etc/hw_config.sh:
Code:
chown system:system /sys/devices/virtual/input/clearpad/pen
echo 1 > /sys/devices/virtual/input/clearpad/pen
● Use toggle app
I created pen mode enable/disable toggle app with Tasker.
http://d-h.st/mZl

Now you can use anything made of wood, metal or rubber.
I couldn't use a plastic pen, though...

I recommend changing one value in /system/usr/idc/clearpad_pen.idc for more accuracy.
Change
Code:
# Pressure
touch.pressure.scale = 0.2
to
Code:
# Pressure
touch.pressure.scale = 0.1
works for me.

In /sys/devices/virtual/input/clearpad/,
there is "grove" but I could only show circle with pen and I couldn't use with glove.
http://i.imgur.com/RibpIAi.png

Thanks championswimmer for finding this.
Last edited by AndroPlus; 3rd March 2014 at 12:26 AM.
The Following 99 Users Say Thank You to AndroPlus For This Useful Post: [ View ]
18th February 2014, 09:59 AM   |  #2  
ImAnurag's Avatar
Senior Member
Flag New Delhi
Thanks Meter: 392
 
879 posts
Join Date:Joined: Aug 2011
Donate to Me
More
Quote:
Originally Posted by RyokoN

AOKP introduced pen mode for Z1 and I could enable it on stock ROM!
Xperia Z Ultra can use the pen or pencil made of wood or metal as stylus, but Z1's screen also supports it and Sony disabled it for some reason.

To enable pen mode, create init.d script:

Code:
#!/system/bin/sh
chown system:system /sys/devices/virtual/input/clearpad/pen
echo 1 > /sys/devices/virtual/input/clearpad/pen
or add these lines to hw_config.sh:
Code:
chown system:system /sys/devices/virtual/input/clearpad/pen
echo 1 > /sys/devices/virtual/input/clearpad/pen
Now you can use anything made of wood, metal or rubber.
I couldn't use a plastic pen, though...


In /sys/devices/virtual/input/clearpad/,
there is "grove" but I could only show circle with pen and I couldn't use with glove.
http://i.imgur.com/RibpIAi.png

Thanks AOKP for infomation.

where to add the lines in hw_config.sh , at bottom ?

Anyone tried it ?
The Following 2 Users Say Thank You to ImAnurag For This Useful Post: [ View ]
18th February 2014, 10:09 AM   |  #3  
secretfile's Avatar
Senior Member
Flag Nis
Thanks Meter: 129
 
325 posts
Join Date:Joined: Nov 2009
More
Quote:
Originally Posted by ImAnurag

where to add the lines in hw_config.sh , at bottom ?

Anyone tried it ?

I tried in hw and in init.d, but it doesn't work, also clearpad doesn't look like folder when i browse with root explorer it looks like file??
18th February 2014, 10:39 AM   |  #4  
Senior Member
Thanks Meter: 43
 
103 posts
Join Date:Joined: Jul 2010
Changed 0 to 1 in sys/devices/virtual/input/clearpad/pen
Too bad it didn't work with plastic
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2014-02-18-18-36-02.png
Views:	2142
Size:	217.9 KB
ID:	2586269  
18th February 2014, 11:11 AM   |  #5  
AndroPlus's Avatar
OP Senior Member
Thanks Meter: 982
 
456 posts
Join Date:Joined: Mar 2013
Donate to Me
More
Quote:
Originally Posted by ImAnurag

where to add the lines in hw_config.sh , at bottom ?

Anyone tried it ?

Yes, bottom is safe to add.
18th February 2014, 11:18 AM   |  #6  
AndroPlus's Avatar
OP Senior Member
Thanks Meter: 982
 
456 posts
Join Date:Joined: Mar 2013
Donate to Me
More
Quote:
Originally Posted by secretfile

I tried in hw and in init.d, but it doesn't work, also clearpad doesn't look like folder when i browse with root explorer it looks like file??

clearpad folder looks like this:


Please try my toggle app, this will change pen's 0 to 1.
http://d-h.st/5az
The Following 7 Users Say Thank You to AndroPlus For This Useful Post: [ View ]
18th February 2014, 11:51 AM   |  #7  
pemith's Avatar
Senior Member
Flag Kandy
Thanks Meter: 93
 
203 posts
Join Date:Joined: Mar 2013
Donate to Me
More
Quote:
Originally Posted by RyokoN

clearpad folder looks like this:


Please try my toggle app, this will change pen's 0 to 1.
http://d-h.st/5az

it works perfectly mate....thank you
18th February 2014, 12:28 PM   |  #8  
secretfile's Avatar
Senior Member
Flag Nis
Thanks Meter: 129
 
325 posts
Join Date:Joined: Nov 2009
More
It was root explorer that cose problem with folder,
with es explorer i can see inside folder and there is pen file with content 1 but i tried with ball pen and it didn't work,
could this be because of screen protector?

Ok it works now strange there is part of screen where it doesn't detect pen.

OP - good job
Last edited by secretfile; 18th February 2014 at 12:31 PM.
The Following User Says Thank You to secretfile For This Useful Post: [ View ]
18th February 2014, 01:28 PM   |  #9  
Senior Member
Thanks Meter: 12
 
116 posts
Join Date:Joined: Oct 2011
Is a flashable zip possible for stock based roms?

Edit: the apk worked perfect, thanks mate...!

Sent from my C6903 using XDA Premium 4 mobile app
Last edited by yaabaa1986; 18th February 2014 at 01:36 PM.
The Following User Says Thank You to yaabaa1986 For This Useful Post: [ View ]
18th February 2014, 02:25 PM   |  #10  
thanhhii's Avatar
Senior Member
Flag Bảo Lộc
Thanks Meter: 63
 
263 posts
Join Date:Joined: Nov 2012
@RyokoN
I have Changed 0 to 1 in sys/devices/virtual/input/clearpad/pen => needn''t to reboot => WORK
But after reboot NOT WORK and i check the value it back to 0 again?????

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

Advanced Search
Display Modes


Top Threads in Xperia Z1 Android Development by ThreadRank