FORUMS
Remove All Ads from XDA
Win Honor 9 Lite

Enable/Disable Stamina Mode with Shell Script

2 posts
Thanks Meter: 11
 
By DarknessFox, Junior Member on 19th February 2014, 02:15 PM
Post Reply Email Thread
Hello people.
First, I must apologize for my bad English. I speak and write not often in English.
So now back to the topic.
I have searched for a way to Stamina mode also be able to control via script, so you can use it for example in combination with Tasker.
Now I have found the solution and wanted to share with you.

The script is just an example of how to use it and can of course be reprogrammed.
The prerequisite is your Smartphone must be rooted.

Script:
Quote:

#!/system/bin/sh
if [ "$USER" != "root" ]; then
su - root -s "$0" && exit;
elif [ "$(content query --uri content://com.sonymobile.superstamina.xperiapowerservice.pro vider/xssm/enabled --projection name=enabled --where "name='0'")" == "Row: 0 enabled=false" ]; then
content update --uri content://com.sonymobile.superstamina.xperiapowerservice.pro vider/xssm/enabled --bind enabled:b:true --where "name='0'";
else
content update --uri content://com.sonymobile.superstamina.xperiapowerservice.pro vider/xssm/enabled --bind enabled:b:false --where "name='0'";
fi;

The Following 10 Users Say Thank You to DarknessFox For This Useful Post: [ View ] Gift DarknessFox Ad-Free
 
 
25th August 2014, 08:03 AM |#2  
Member
Thanks Meter: 15
 
More
Quote:
Originally Posted by DarknessFox

Hello people.
First, I must apologize for my bad English. I speak and write not often in English.
So now back to the topic.
I have searched for a way to Stamina mode also be able to control via script, so you can use it for example in combination with Tasker.
Now I have found the solution and wanted to share with you.

The script is just an example of how to use it and can of course be reprogrammed.
The prerequisite is your Smartphone must be rooted.

Script:

I get this error when trying to execute this on Z1 Compact running 4.4.4:
Code:
[ERROR] Unsupported argument: vider/xssm/enabled
The Following User Says Thank You to peca89 For This Useful Post: [ View ] Gift peca89 Ad-Free
25th August 2014, 08:31 AM |#3  
OP Junior Member
Thanks Meter: 11
 
More
I'm sorry, I have found a mistake in my post. Between pro and vider, must not be a space. So it must be written provider. My Post I have edited.
The Following User Says Thank You to DarknessFox For This Useful Post: [ View ] Gift DarknessFox Ad-Free
25th August 2014, 11:18 PM |#4  
Member
Thanks Meter: 15
 
More
That's more like it! Thanks very much. I feel so stupid for not figuring that out myself :'(

BTW, should I worry about this output when executing?

Code:
root@D5503:/ # /tmp/toggle_stamina.sh
WARNING: linker: app_process has text relocations. This is wasting memory and is a security risk. Please fix.
WARNING: linker: app_process has text relocations. This is wasting memory and is a security risk. Please fix.
WARNING: linker: app_process has text relocations. This is wasting memory and is a security risk. Please fix.
WARNING: linker: app_process has text relocations. This is wasting memory and is a security risk. Please fix.
root@D5503:/ #
Edit: I just figured out that this is caused by xposed and that there is nothing to worry about. Thanks once again.

Sent from my D5503 using XDA Free mobile app
16th September 2014, 05:24 AM |#5  
Senior Member
Thanks Meter: 53
 
More
Hello @DarknessFox , is this script enable both Extended Usage and Extended Standby?
27th March 2015, 10:22 PM |#6  
Senior Member
Thanks Meter: 29
 
More
Quote:
Originally Posted by DarknessFox

Hello people.
First, I must apologize for my bad English. I speak and write not often in English.
So now back to the topic.
I have searched for a way to Stamina mode also be able to control via script, so you can use it for example in combination with Tasker.
Now I have found the solution and wanted to share with you.

The script is just an example of how to use it and can of course be reprogrammed.
The prerequisite is your Smartphone must be rooted.

Script:

Hey can you explain me how to do this.. I am faily new to tasker and shell.. I want to enable stamina mode automatically at 11:00Pm and disable it at 7:00Am. An help would be appreciated.

Thanks
The Following User Says Thank You to sravanz For This Useful Post: [ View ] Gift sravanz Ad-Free
31st March 2015, 10:17 PM |#7  
jaime4272's Avatar
Senior Member
Flag Earth
Thanks Meter: 83
 
More
Can someone tell me why stamina mode won't enable wireless data when I move away from WiFi and how can I fix it thanks
29th April 2015, 09:19 AM |#8  
Senior Member
Thanks Meter: 23
 
More
Fantastic!!! Is this a script to toggle Stamina Mode? How should it be changed to have only the enable or disable mode?
5th June 2015, 08:42 AM |#9  
Senior Member
Thanks Meter: 59
 
More
Quote:
Originally Posted by the gladiator

Fantastic!!! Is this a script to toggle Stamina Mode? How should it be changed to have only the enable or disable mode?

Code:
#!/system/bin/sh

SCR=$(basename $0)
SET=$1

case $SET in
  "on")
    content update --uri content://com.sonymobile.superstamina.xperiapowerservice.provider/xssm/enabled --bind enabled:b:true --where "name='0'";
  ;;
  "off")
    content update --uri content://com.sonymobile.superstamina.xperiapowerservice.provider/xssm/enabled --bind enabled:b:false --where "name='0'";
  ;;                                                                                                                                              
  *)
    echo "USAGE: $SCR <on/off>"
esac
The Following 2 Users Say Thank You to paffo For This Useful Post: [ View ] Gift paffo Ad-Free
5th June 2015, 10:48 AM |#10  
Senior Member
Thanks Meter: 88
 
More
Quote:
Originally Posted by paffo

Code:
#!/system/bin/sh

SCR=$(basename $0)
SET=$1

case $SET in
  "on")
    content update --uri content://com.sonymobile.superstamina.xperiapowerservice.provider/xssm/enabled --bind enabled:b:true --where "name='0'";
  ;;
  "off")
    content update --uri content://com.sonymobile.superstamina.xperiapowerservice.provider/xssm/enabled --bind enabled:b:false --where "name='0'";
  ;;                                                                                                                                              
  *)
    echo "USAGE: $SCR <on/off>"
esac

Can't toggle stamina mode with tasker.
"USAGE: tmp-mksh <on/off>" this is what i am getting as output.
5th June 2015, 10:52 AM |#11  
Senior Member
Thanks Meter: 59
 
More
Quote:
Originally Posted by mnsk

Can't toggle stamina mode with tasker.
"USAGE: tmp-mksh <on/off>" this is what i am getting as output.

You used my proposition for script that need to be run with parameter.
Did you tried in terminal at all ?

USAGE: <scriptname> <on/off>
means
place all code in one file, EX: /system/xbin/staminamode
give execute attrib to this file
run with parameter "on" or "off"
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes