Does anyone know how to increase the torch power? Like z1-z2-z3 years ago?
DELETED - misread
Kianush said:
I havent heard of that and touch sensitivity is really good but I think you can increase it b enabling glove mode.
Click to expand...
Click to collapse
toRch not toUch :laugh:
gabed90 said:
Does anyone know how to increase the torch power? Like z1-z2-z3 years ago?
Click to expand...
Click to collapse
I haven't figured out how to increase the stock torch brightness the same way I could on the Z3c, but I found an okay workaround to override it temporarily. On the stock MM ROM I'm running, the brightness is controlled by two files: "/sys/class/leds/led:torch_0/brightness" and "/sys/class/leds/led:torch_1/brightness". You can edit these to any number (don't burn out your led....I haven't tried anything above 1000), then toggle on the torch by changing "/sys/class/leds/led:switch/brightness" to "1". The torch can then be turned off by changing "/sys/class/leds/led:switch/brightness" to "0". The stock flashlight brightness is "12", which is really dim, but "90" has been a good brightness for me so far.
I wrote a script (attached) which toggles the torch on and off with a "90" brightness. It has to be run with su (root).
Code:
#!/system/bin/sh
toggle=$(cat /sys/class/leds/led:switch/brightness)
if [ "$toggle" = "0" ];then
echo 90 > /sys/class/leds/led:torch_0/brightness
echo 90 > /sys/class/leds/led:torch_1/brightness
echo 1 > /sys/class/leds/led:switch/brightness
echo "on"
else
echo 0 > /sys/class/leds/led:torch_0/brightness
echo 0 > /sys/class/leds/led:torch_1/brightness
echo 0 > /sys/class/leds/led:switch/brightness
echo "off"
fi
Also I used Script Manager to set up a home screen widget to run this script, so I have a "bright torch" toggle on my home screen. Maybe someone could make this into an app so this solution wouldn't be quite as clunky.
Hi! Does it work? How can I install it?
I tried to do the widget, but when I start it , Permission denied appears.
I have rooted device, and I gave SM manager root permissions...
mains75 said:
I tried to do the widget, but when I start it , Permission denied appears.
I have rooted device, and I gave SM manager root permissions...
Click to expand...
Click to collapse
Do you have the "Su" toggle turned on for that script in SM Manager? It's in the top bar when you setup the script.
Yes I have..
After some attempts It worked... Thankyou
I wonder why if I edit the 2 files manually, system resets their value after you turn on the torch with other apps...
dog77k said:
I wrote a script (attached) which toggles the torch on and off with a "90" brightness. It has to be run with su (root).
Code:
#!/system/bin/sh
toggle=$(cat /sys/class/leds/led:switch/brightness)
if [ "$toggle" = "0" ];then
echo 90 > /sys/class/leds/led:torch_0/brightness
echo 90 > /sys/class/leds/led:torch_1/brightness
echo 1 > /sys/class/leds/led:switch/brightness
echo "on"
else
echo 0 > /sys/class/leds/led:torch_0/brightness
echo 0 > /sys/class/leds/led:torch_1/brightness
echo 0 > /sys/class/leds/led:switch/brightness
echo "off"
fi
Also I used Script Manager to set up a home screen widget to run this script, so I have a "bright torch" toggle on my home screen. Maybe someone could make this into an app so this solution wouldn't be quite as clunky.
Click to expand...
Click to collapse
Thank you - your script works well!
A minor issue is that when you run the script thru the widget shortcut, it pulls open the Script Manager app. Do you know any way to avoid this? Maybe an additional line in the script that kills the current app?
Thanks again.
Longhorn Android said:
Thank you - your script works well!
A minor issue is that when you run the script thru the widget shortcut, it pulls open the Script Manager app. Do you know any way to avoid this? Maybe an additional line in the script that kills the current app?
Thanks again.
Click to expand...
Click to collapse
Good idea. Add this line to end of the script and it will close Script Manager.
Code:
killall os.tools.scriptmanager
dog77k said:
Good idea. Add this line to end of the script and it will close Script Manager.
Code:
killall os.tools.scriptmanager
Click to expand...
Click to collapse
Thanks - that works perfectly.
xz1 compact
I tried to run this script on Sony XZ1 compact, but when running ScriptManager writes "No such file or directory". What am I doing wrong? ROOT mean. The path on the system and similar files exist. I turn on the SU button at startup. Help please.
dog77k said:
I haven't figured out how to increase the stock torch brightness the same way I could on the Z3c, but I found an okay workaround to override it temporarily. On the stock MM ROM I'm running, the brightness is controlled by two files: "/sys/class/leds/led:torch_0/brightness" and "/sys/class/leds/led:torch_1/brightness". You can edit these to any number (don't burn out your led....I haven't tried anything above 1000), then toggle on the torch by changing "/sys/class/leds/led:switch/brightness" to "1". The torch can then be turned off by changing "/sys/class/leds/led:switch/brightness" to "0". The stock flashlight brightness is "12", which is really dim, but "90" has been a good brightness for me so far.
I wrote a script (attached) which toggles the torch on and off with a "90" brightness. It has to be run with su (root).
Code:
#!/system/bin/sh
toggle=$(cat /sys/class/leds/led:switch/brightness)
if [ "$toggle" = "0" ];then
echo 90 > /sys/class/leds/led:torch_0/brightness
echo 90 > /sys/class/leds/led:torch_1/brightness
echo 1 > /sys/class/leds/led:switch/brightness
echo "on"
else
echo 0 > /sys/class/leds/led:torch_0/brightness
echo 0 > /sys/class/leds/led:torch_1/brightness
echo 0 > /sys/class/leds/led:switch/brightness
echo "off"
fi
Also I used Script Manager to set up a home screen widget to run this script, so I have a "bright torch" toggle on my home screen. Maybe someone could make this into an app so this solution wouldn't be quite as clunky.
Click to expand...
Click to collapse
Thanks for the guide, now I successfully edited my config, and I can use godly torch app to control light intensity.
Meh, get this little bugger.
Far brighter than any smartphone with easy charging. I wuv my copy
MicroStream® USB | Rechargeable LED Pocket Flashlight | Streamlight®
#!/system/bin/sh
toggle=$(cat /sys/class/leds/led:switch_0/brightness)
if [ "$toggle" = "0" ];then
echo 90 > /sys/class/leds/led:torch_0/brightness
echo 90 > /sys/class/leds/led:torch_1/brightness
echo 1 > /sys/class/leds/led:switch_0/brightness
echo "on"
else
echo 0 > /sys/class/leds/led:torch_0/brightness
echo 0 > /sys/class/leds/led:torch_1/brightness
echo 0 > /sys/class/leds/led:switch_0/brightness
echo "off"
fi
Click to expand...
Click to collapse
i edit name folder switch to worck for xz3 i tested for me is worck good and plzz i need mehtod before edit in rom like defaut
Meh... bear in mind the led current was sinked at that level for a reason.
Although it goes much higher with the camera, it's only briefly.
Running it full time like that may exceed it's heat sinking capabilities and prematurely burn it out.
Everything happens for a reason... and it probably wasn't to keep you in the dark
plz i need methode for edit firmware or system for adjust torch
script worck for me for xperia xz3 by change switch to switch_0 and i need methode for set auto by sysytem
Related
It seems like this is a constant issue among most of us. Here are some workarounds and/or fixes. We could use this thread to discuss auto-brightness and whatnot:
Guhrasoh said:
If it isn't working edit /system/etc/hw_config.sh and change this line:
Code:
echo i2c > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/mode # i2c, pwm, i2c_pwm, als, pwm_als, i2c_pwm_als, i2_als
into this:
Code:
echo i2c[B]_als[/B] > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/mode # i2c, pwm, i2c_pwm, als, pwm_als, i2c_pwm_als, i2_als
It's working here, do you have the latest version of it?
Click to expand...
Click to collapse
porio said:
AFAIU, the brightness controlling chip or driver in our X8 has three modes. als, if enabled, reads the light sensor and sets the brightness according to it. In other words, is a hardware based auto brightness. i2c and pwm are the other two modes, for direct brightness control but I don't understand the difference between them. If two or three modes are enabled, the output (brightness) is a mixture of all.
So, if you set something like als_pwm or i2c_als or i2c_als_pwm, you will have auto-brightness even if you don't set it in your device; it will work like in a hardware layer (so to speak). The best setting for me is to enable i2c_als_pwm and set the brightness to something like 40 or 50%. For some reason it didn't work well in GDX 006 but in 007 is working OK. It also help if you set the line
Code:
echo 512 > /sys/devices... ...0036/als::avg-t # 32,....
The lower the value, more flicker you will have. 512 seems to be reasonable.
BTW I this I learned this here: http://www.national.com/pf/LM/LM3530.html#Overview
The pdf datasheet has lots of info.
Regards
Click to expand...
Click to collapse
Some useful settings if you don't want to edit the lines:
mr-tical said:
Code:
0 25
2000 35
4000 40
5500 50
7000 60
8500 70
10100 80
20100 90
30100 100
40100 120
50100 150
60100 180
70100 210
80100 240
90100 255
102000 255
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
With these levels i think display lighting and dimming is smoother, but i got one more guestion - how can i force to read faster the light value form sensor for guicker adjusting the display changing display levels, i mean, if he can do it faster?
Click to expand...
Click to collapse
Ok, so this is hw_config.sh sensor configuration for X8 (one of the most decent ones), I believe it was enhanced by the user alfasamsung.
Code:
# lm3530 LMU configuration
echo linear > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/br::mapping # linear exp
echo 32768 > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/br::rate::up # 8, 1024, 2048, 4096, 8192, 16384, 32768, 65538
echo 32768 > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/br::rate::down # 8, 1024, 2048, 4096, 8192, 16384, 32768, 65538
echo 250 > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/br::limit # 0 - 255
echo 12.0 > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/br::fsc # 5.0, 8.5, 12.0, 15.5, 19.0, 22.5, 26.0, 29.5
echo 4,16,64,250 > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/curve::borders
echo 47,75,114,164,226 > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/curve::targets
echo high-z > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/als::r1 # high-z, 9360, 5560 .. 677.6 (see chip mnual)
echo high-z > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/als::r2 # high-z, 9360, 5560 .. 677.6 (see chip mnual)
echo [COLOR="Red"]1024[/COLOR] > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/als::avg-t # 32, 63, 128, 256, 512, 1024, 2048, 4096
echo i2c_pwm > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/mode # i2c, pwm, i2c_pwm, als, pwm_als, i2c_pwm_als, i2_als
what are the suggestions, besides changing the number in red to 512???
what if we try changing the last line to:
Code:
echo [B][COLOR="Green"]i2c_pwm_als[/COLOR][/B] > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/mode # i2c, pwm, i2c_pwm, als, pwm_als, i2c_pwm_als, i2_als
When i used i2c_pwm_als my phone become unstable. Its hard to wake it up and causes reboot. I dont know with others.
What about CyanogenMOD settings ->Display - > Automatic Backlight?
There a lot settings to play with there..
Dare-Devil Inside said:
What about CyanogenMOD settings ->Display - > Automatic Backlight?
There a lot settings to play with there..
Click to expand...
Click to collapse
It will not work
Sent from X8 using XDA Premium app and running GingerDX
This is my understanding of the values and how it works.
We have two modes to choose from in hw_config.sh :/sys/devices/platform/i2c-adapter/i2c-0/0-0036/mode
i2c or i2c_als.i2c just enables the sensor and i2c_als means that the sensor controlls the brightness in automatic mode(hardware layer)
In cm roms I recomend using i2c mode and let the framework controll the brightness.Only problem here is that we have to set the values in the framework.The standard setting is not for the x8 sensor,they are way of.We need to go to cm setting>display>Aut. backlight>tick use custom and allow light decrease>edit levels and put in somethin like this(see pictures)
Back too the values in hw_config:
i2c mode:
-br::rate::up and down -how long it takes to change the light from one step to anoter.this is a value in ms.high value the light will change slow.low value it goes fast
- br::fsc -this is the max current the screen can use. higer value will give brighter screen at max value.
i2c_als mode:
-br::limit -this is max brightness
-curve::borders -these are the borders in your light curve
-curve::targets -targets for the light curve.Here you sett the lovest and higest brightness values (in a curve)
-als::avg-t -how often the sensor updates the screen in mseconds.It sets the screen to the average value in this time period.Has no inpact on i2c mode.
This is my current config:
Code:
echo linear > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/br::mapping # linear exp
echo [B]8192[/B] > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/br::rate::up # 8, 1024, 2048, 4096, 8192, 16384, 32768, 65538
echo [B]65538[/B] > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/br::rate::down # 8, 1024, 2048, 4096, 8192, 16384, 32768, 65538
echo 250 > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/br::limit # 0 - 255
echo [B]19.0[/B] > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/br::fsc # 5.0, 8.5, 12.0, 15.5, 19.0, 22.5, 26.0, 29.5
echo 30,70,110,150 > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/curve::borders
echo 10,75,120,164,254 > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/curve::targets
echo high-z > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/als::r1 # high-z, 9360, 5560 .. 677.6 (see chip mnual)
echo high-z > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/als::r2 # high-z, 9360, 5560 .. 677.6 (see chip mnual)
echo 1024 > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/als::avg-t # 32, 63, 128, 256, 512, 1024, 2048, 4096
echo [B]i2c[/B] > /sys/devices/platform/i2c-adapter/i2c-0/0-0036/mode # i2c, pwm, i2c_pwm, als, pwm_als, i2c_pwm_als, i2_als
with the correct settings in cm settings this works great.
You can check that your sensor works by going to cm settings.........edit other levels and there you see the value of the sensor in the top.
Puh this was a long post
Forgot the pwm mode:this is for external input.
Rom builders please change the array in the framework-res.> res\values\arrays.
Update: Added a very nice picture trying to explain borders and targets in i2c_als mode
@alfsamsung , i applied this change in attached hw_config.sh and replace it
i think it shold be true but again AutoBrightness works wrongly
please if you can take a look on it ,thanks
EDIT : guys u can use the attached hw_config.sh for GingerDX v007
alfsamsung confirmed it and it works well
EDIT 2 : here for GDX 007
X1111 said:
@alfsamsung , i applied this change in attached hw_config.sh and replace it
i think it shold be true but again AutoBrightness works wrongly
please if you can take a look on it ,thanks
Click to expand...
Click to collapse
The hw_config.sh looks good. Did you edit the settings in cmSettings>Automatic backlight? Do you see any values in the Edit other leves.. when you put the phone under some light?
alfsamsung said:
The hw_config.sh looks good. Did you edit the settings in cmSettings>Automatic backlight? Do you see any values in the Edit other leves.. when you put the phone under some light?
Click to expand...
Click to collapse
no ,do i this setting like this picture you mean ? or what setting must i change please ?
thanks for response
X1111 said:
no ,do i this setting like this picture you mean ?
thanks for response
Click to expand...
Click to collapse
Yes.Just change the values on the left side to something similiar with the picture.Play with the values to you get it to your liking.
alfsamsung said:
Yes.Just change the values on the left side to something similiar with the picture.Play with the values to you get it to your liking.
Click to expand...
Click to collapse
oh ,seems work ,thanks man
and how many levels need to have for best setting ?
EDIT : what amounts must be in screen column ? i cant change them similar to the picture
X1111 said:
oh ,seems work ,thanks man
and how many levels need to have for best setting ?
Click to expand...
Click to collapse
Don't know.Again you need to play with these settings and find what you like.I have 14.To many the backlight will change to often.There is a problem with the levels on the right side.You can't enter a value under 20.I had to rebuild the framework to get my settings.
@alfsamsung, how do you change the value of screen on CM automatic backlight settings ???
Ps: on that screen of configurations of custom levels, My screen on the top of page shows disabled.
biscoitu said:
@alfsamsung, how do you change the value of screen on CM automatic backlight settings ???
Ps: on that screen of configurations of custom levels, My screen on the top of page shows disabled.
Click to expand...
Click to collapse
for change the value of screen you must change from bottom
change the lowest to 255
X1111 said:
for change the value of screen you must change from bottom
change the lowest to 255
Click to expand...
Click to collapse
hmmm, I will try it , let´s have fun with this features
biscoitu said:
hmmm, I will try it , let´s have fun with this features
Click to expand...
Click to collapse
i adjust it according the pic and light sensor is working much better than befor
all thanks refers to alfsamsung
biscoitu said:
@alfsamsung, how do you change the value of screen on CM automatic backlight settings ???
Ps: on that screen of configurations of custom levels, My screen on the top of page shows disabled.
Click to expand...
Click to collapse
If the value is disabled you need to turn on automatic brightness in the android screen settings. Or if you are on i2c_als mode you need to change hw_config to i2c
I got it working, but I´m confused . It lights up when in light, but it doesn´t return to the original bright when I cover the sensor . There it shows that is filtering, but my screen stills brighter :/
Edit: I´m already enabled and trying set many values there. Only one information at the cm settings menu, what do you put on Reset Threshold, Window Lenght and Sample Interval??
biscoitu said:
I got it working, but I´m confuse . It lights up when in light, but it doesn´t return to the original bright when I cover the sensor . There it shows that is filtering, but my screen stills brighter :/
Click to expand...
Click to collapse
You need to enable allow light decrease.One screen back from the values
alfsamsung ,
i tested it at sunshine and brightness went into 255 ,and then at darkness it went into lowest value
but it seems increasing acts better than decreasing...
This is a hacky fix but it is a fix.
It gives you a backlight that will go from dim to full bright without the need for any other apps running. It's not uber configurable like dedicated apps as it's limited by hardware but it requires 0 ram, 0 runtime and 0 battery
Append the following to hw_config.sh. The sleep is a hack but a viable one - hw_config is fired up by one of the rc files as a oneshot service so it should be OK to extend it's operation
If you prefer you could just make a standalone script with everything after the sleep command (make sure you have the dev= assignment from hw_setup too!) and fire it off with a script executer of your choice
Code:
#this sleep ensures that the system is up and done [email protected] with light levels before setup
sleep 30
#select als group for backlight
echo 1 > $dev/leds/lcd-backlight1/als_group
echo 1 > $dev/leds/lcd-backlight2/als_group
#set both to max. brightness - als will lower
echo 255 > $dev/leds/lcd-backlight1/brightness
echo 255 > $dev/leds/lcd-backlight2/brightness
#set custom als curve
echo 7,1,48,72,24,255,0 > $dev/als_group1
#set custom filter frequency
echo 1000 > $dev/als_filter_down_speed_mHz
echo 1000 > $dev/als_filter_up_speed_mHz
#turn on hardware als
echo 1 > $dev/als_on
Notes
Make sure you have completely uninstalled any other light controllers - Velis in particular wreaks havoc even when disabled - it still receives the screen on intent and resets the brightness which results in a black display - guess how I know ....
Make sure you have disabled auto brightness control in the standard Sony settings and set the slider to full bright for good measure
I use nobootanimation so my phone boots a bit quicker than some. It might be that sleep 30 isn't long enough for an animated startup
Best thing is probably to create a setup script and run that to satisfy yourself the hack works. Then add it to hw_config and increase the delay if it doesn't work!
If you want to know more about the als setup check HERE or read the AS3677 datasheet.
Sadly I wasn't able to find out how the ALS curves are loaded into the current system, hence the direct hardware poking
There's some useful debug capability built into the sysfs
cat $dev/debug to see light sensor outputs and calculated backlight settings
cat als_group1 to read back the curve settings complete with a graph showing the response curve
A software guy could probably easily make an apk that hooked to the SCREEN_ON intent to program all this (and have a nice gui to show/edit the curve) but I'm a hardware engineer so that ain't me!
It's easier to just use Lux. Thanks anyway.
pakatsui said:
It's easier to just use Lux. Thanks anyway.
Click to expand...
Click to collapse
LUX, YAB or other brightness app will don`t work correct on all my Xperias. Only with "system brightness settings" active in the background this apps will change the brightness in realtime. When i close the systemsettings brightness will change no longer or with some luck once when unlocking.
so i will test this Hack, hope it helps to become a wide range in realtime.
heross said:
LUX, YAB or other brightness app will don`t work correct on all my Xperias. Only with "system brightness settings" active in the background this apps will change the brightness in realtime. When i close the systemsettings brightness will change no longer or with some luck once when unlocking.
so i will test this Hack, hope it helps to become a wide range in realtime.
Click to expand...
Click to collapse
Lux works fine. I'm using it now.
Sent from my Xperia SP using xda premium
Hello t_o_f,
today i have made test this fix in Car navigation from sunlight to the moon. awesome. this is the best fix i have always seen for xperia autobrightness. :good::laugh::good: ten points from germany.
the best, lowest brightness it is configurable with the Stock slider!
Call me daft. I disabled auto brightness, jacked the brightness to high, and have no other brightness apps installed. I appended the above to /etc/hw_config.sh and rebooted.
auto brightness didn't work. It was still jacked up to high so I enabled it and tested, still not working. Did I do something wrong? I'm on 254 rooted.
Hi there
Just got GS5, ultra power saving mode is sweet however is there a way to automatically turn it on at a certain % of remaining battery (e.g. at 10% it turns on)
ALL help and advice welcome
It only takes one finger swipe and touch to activate it. Don't be too lazy now.
Sent from my SM-G900F using Tapatalk
Simone said:
It only takes one finger swipe and touch to activate it. Don't be too lazy now.
Sent from my SM-G900F using Tapatalk
Click to expand...
Click to collapse
The reason I ask is that if I leave my phone out overnight after a night out etc I don't want to wake up in the morning to a dead battery. Instead having it auto switch will be life saving ..ha :good:
I'm not 100% sure but I'm assuming you could probably create a Tasker profile to trigger UPSM at a specific battery percentage.
I have very little experience with Tasker though so someone correct me if I'm wrong.
Sent from my SM-G900W8 using Tapatalk
1742
msavic6 said:
I'm not 100% sure but I'm assuming you could probably create a Tasker profile to trigger UPSM at a specific battery percentage.
I have very little experience with Tasker though so someone correct me if I'm wrong.
Sent from my SM-G900W8 using Tapatalk
Click to expand...
Click to collapse
Hi there
Thanks v much for the info/ idea. I'll look into it, do I need to root my gs5 for tasker??
anyone else have knowledge activating upsm at a certain battery %.
Thanks
Unfortunately, Tasker has no possibilty to enable UPSM
The Tasker has possibility to lunch external script or application, but the problem is that there is no script which can start UPSM.
Is somebody found a way to do it? May-be another ways?
Somebody on reddit has been working with Tasker to do this. I can't post the link since I haven't posted more than 10 times, so do a google search for "Figured out how to activate Ultra power saver mode" reddit and tasker. It should come up.
I've tried it and had some success with it, but having some issues with the second tap command to activate. Seems like I had to up the timeout to something like 15 seconds.
Good luck.
Yes! You can
Using tasker of course
1. You have to put U.power saving somewhere on the visible part of Notification panel - pic 1
2. Create profile - State - Power - Battery level - (from 0 to 10 for example) - pic 2
3. Create new task: - pic 3
1. Display - Status Bar - Expanded
2. Script - Run Shell - Command - input tap x y (where x y are coordinates of the buttons you want to tap), check Use Root option
3. Script - Run Shell - Command - input tap x y (button OK on the UPSM menu), check Use Root option - pic 4
In my case x=972 y=226 and
x=790 y=1600
You have to check your x and y coordinates by turning Show pointer location in Developer options
And now you will have Ultra Power Saving Mode when your battery reaches 10 %
I would like this feature as well.. makes sense to me. I mean if the camera can stop the flash from working on low battery then enabling UPSM at low battery should be an option
nice but ...
This is really nice solution to automatically enable UPSM but one remark ... screen has to be turned on and screen locker must be unlocked ... so is we are already watching on phone why shouldn't we just manually start UPSM ?
Do you have any idea how to enable UPSM fully automatically ? without even touching phone ? my idea is to forget about power problems and every time when my phone will reach 5% it will automatically turn on UPSM completely without me.
ciechom said:
This is really nice solution to automatically enable UPSM but one remark ... screen has to be turned on and screen locker must be unlocked ... so is we are already watching on phone why shouldn't we just manually start UPSM ?
Do you have any idea how to enable UPSM fully automatically ? without even touching phone ? my idea is to forget about power problems and every time when my phone will reach 5% it will automatically turn on UPSM completely without me.
Click to expand...
Click to collapse
ROOT REQUIRED
Try this :
this will unlock and run UltraPowerMode at the specified time (00:50)
On shell code :
Code:
mount -o rw,remount /system ; mv /data/system/gesture.key /data/system/oldgesture.key ; input keyevent 26 ; input swipe 71 500 636 500 ; mv /data/system/oldgesture.key /data/system/gesture.key ; mount -o ro,remount /system ; am start -n com.android.settings/.Settings\$UltraPowerSavingModeActivity ; input tap 670 103 ; input tap 520 1150
#change ro(readonly) to rw(read/write) and add the remount option
mount -o rw,remount /system
#Unlock device-- 1-PATTERN
mv /data/system/gesture.key /data/system/oldgesture.key
OR
#Unlock device-- 2-PIN LOCK
mv /data/system/password.key /data/system/oldpassword.key
#wakeup device
input keyevent 26 ; input swipe 71 500 636 500
#turn on original lock pattern
mv /data/system/oldgesture.key /data/system/gesture.key
OR
#turn on original lock PIN CODE
mv /data/system/oldpassword.key /data/system/password.key
#remount with the original readonly.
mount -o ro,remount /system
#start ultra power save menu
am start -n com.android.settings/.Settings\$UltraPowerSavingModeActivity
#command to touch the buttons
input tap 670 103 ; input tap 520 1150
flaviofire said:
Try this :
. . .
Click to expand...
Click to collapse
I will try it for sure thx mate
But one more question. I own Galaxy Alpha and I'm using finger to unlock my phone.
Which file shoud I move to Unlock device ? is it /data/system/fingerprintpassword.key ?
And can you please explain a little bit more what this will do:
"input keyevent 26 ; input swipe 71 500 636 500"
does those numbers 71 500 636 500 are important ? I'm wondering because it might differ in different phones
Thank you :thumbup: I'm looking for this.
This is good but can we do it so it starts at a specific battery level instead of time?
Thanks.
No idea how to do it that is why I asked.
flaviofire said:
ROOT REQUIRED
Try this :
this will unlock and run UltraPowerMode at the specified time (00:50)
On shell code :
Code:
mount -o rw,remount /system ; mv /data/system/gesture.key /data/system/oldgesture.key ; input keyevent 26 ; input swipe 71 500 636 500 ; mv /data/system/oldgesture.key /data/system/gesture.key ; mount -o ro,remount /system ; am start -n com.android.settings/.Settings\$UltraPowerSavingModeActivity ; input tap 670 103 ; input tap 520 1150
#change ro(readonly) to rw(read/write) and add the remount option
mount -o rw,remount /system
#Unlock device-- 1-PATTERN
mv /data/system/gesture.key /data/system/oldgesture.key
OR
#Unlock device-- 2-PIN LOCK
mv /data/system/password.key /data/system/oldpassword.key
#wakeup device
input keyevent 26 ; input swipe 71 500 636 500
#turn on original lock pattern
mv /data/system/oldgesture.key /data/system/gesture.key
OR
#turn on original lock PIN CODE
mv /data/system/oldpassword.key /data/system/password.key
#remount with the original readonly.
mount -o ro,remount /system
#start ultra power save menu
am start -n com.android.settings/.Settings\$UltraPowerSavingModeActivity
#command to touch the buttons
input tap 670 103 ; input tap 520 1150
Click to expand...
Click to collapse
Thanks for posting. Status bar -> set expanded does not work on my lollipop latest firmware phone. I figured out the XY in developer mode and tested my script, steps 2 and 3 are working, but step 1 seems to no longer work for lollipop. Do you have another method for getting the new taskbar to come down?
ivankolev said:
Yes! You can
Using tasker of course
1. You have to put U.power saving somewhere on the visible part of Notification panel - pic 1
2. Create profile - State - Power - Battery level - (from 0 to 10 for example) - pic 2
3. Create new task: - pic 3
1. Display - Status Bar - Expanded
2. Script - Run Shell - Command - input tap x y (where x y are coordinates of the buttons you want to tap), check Use Root option
3. Script - Run Shell - Command - input tap x y (button OK on the UPSM menu), check Use Root option - pic 4
In my case x=972 y=226 and
x=790 y=1600
You have to check your x and y coordinates by turning Show pointer location in Developer options
And now you will have Ultra Power Saving Mode when your battery reaches 10 %
Click to expand...
Click to collapse
:good:
Thanks for the post. Hopefully Tasker is working on adding UPSM in a future update.
rickneworleansla said:
:good:
Thanks for the post. Hopefully Tasker is working on adding UPSM in a future update.
Click to expand...
Click to collapse
If you´re rooted. Install secure settings plugin it works with Tasker
I solved the problem
Open quick settings and then use AutoInput to click ultra saving mode and ok (or whatever the prompt). Make sure to include wait tasks to pause for sufficient time so everything have chance to happen.
I'm struggling to build up a Tasker routine to automate the USB Audio setup with one screen tap.
To do that I need a method for emulating screen taps (like for "off" and "host" and "close" in the USB Mode Utility, for example). I've already discovered that Eclair lacks the shell command "input tap x y". That would have been the easy route.
I'm not sure about "sendevent" and I'm even less sure about the syntax. Every resource I look at seems written for people who already know the answer. The typical syntax seems to be something like
sendevent /dev/input/event2 x x x
I can see in the root directory that there is a dev folder and in that an input folder. In there are listed 5 things:
21:14 event0
21:14 event1
21:14 event2
21:14 mice
21:14 mouse0
Does anyone know if "sendevent" is a valid shell command in Eclair and, if so, the functions of the events listed above?
Edit: well, I have a partial answer. Running an adb shell getevent I found the following:
event2 = zForce Touchscreen
event1 = gpio-keys [hardware, I assume?)
event0 = TWL4030 Keypad
It said it could not find a driver version for mice or mouse0 because it was not a typewriter (duh).
So it looks like event2 is what I need to deal with. Now if I only understood how. I know I need the screen coordinates where the touch is to be emulated
and I have an app for that.
As much as I love UsbMode, you don't need it.
For a script, you are better off just doing what it does yourself.
Code:
echo host > /sys/devices/platform/musb_hdrc/mode
echo peripheral > /sys/devices/platform/musb_hdrc/mode
echo 0 > /sys/devices/platform/bq24073/force_current
echo 500000 > /sys/devices/platform/bq24073/force_current
Renate NST said:
As much as I love UsbMode, you don't need it.
For a script, you are better off just doing what it does yourself.
Code:
echo host > /sys/devices/platform/musb_hdrc/mode
echo peripheral > /sys/devices/platform/musb_hdrc/mode
echo 0 > /sys/devices/platform/bq24073/force_current
echo 500000 > /sys/devices/platform/bq24073/force_current
Click to expand...
Click to collapse
Wow, and I was so excited because I figured out how to use sendevent w/Tasker to "press" the OFF button in the USB Mode Utility app today!
I really appreciate your response, Renate, so please bear with my lack of Android understanding. I can see that the first line is equivalent to tapping "host" (at least I hope that's what it is...). The the second is how to get back to normal mode.
By extension I am guessing that the third line is equivalent to "off" while the last line is equivalent to "auto". Right so far?
Now the most important question: so is "echo" a shell command I can use? I looked it up and it appears to be, just want to check before I try typing that into Tasker (not that it's half as bad as 8 sendevents to "touch" the screen one time!).
And one last question: is there a similar command equivalent to the "beep" of AudioCTRL (i.e., to kickstart the audio)
Edit: oh, wait, this is it, isn't it: kill -9 19409 [that being the PID of mediaserver on my NST]
Thanks for your help!
Woo-Hoo!!
The shell commands from Renate work great in a simple toggle Task. I just need to work on a few wait times and it's a done deal. One-touch USB Audio!
One question: the command "echo 500000 > /sys/devices/platform/bq24073/force_current" leaves the Max. current setting at 500 mA rather than "Auto". I'm guessing since there is nothing attached to the USB port anyway when you're all done that this is OK?
@nmyshkin
Values are 0, 100000, 500000, 1500000, auto for off, 100mA, 500mA, 1.5A, auto
Renate NST said:
@nmyshkin
Values are 0, 100000, 500000, 1500000, auto for off, 100mA, 500mA, 1.5A, auto
Click to expand...
Click to collapse
Perfect! Thanks so much. I've got a little widget on my homescreen now that does the work behind the scenes! Still struggling with a shortcut that I could customize a little.
I looked at the App Creator for Tasker but see that it requires Android 2.3. I wonder if created apps would therefore be for 2.3 or up? If not, I'd install it on my Nook Tablet running CM 10.2, make an app and export it. That would be cool.
Edit: both completed. Tasker widget here, stand-alone apps here.
Digging up an old thread here, but I'm trying to figure out a way to use an 'input tap' type event for my nook touch. I've got everything set up for a digital picture frame that can dynamically load images but the only slideshow viewer that I found to work doesn't start automatically, it loads on a file location menu first and I need to manually start the slideshow with a button press. Is there an 'input tap' equivalent that will work with the nook?
Figured it out. The adb shell command getevent will return a series of commands when you touch the screen (make sure it is a simple touch and not multiple points). Use these results (converting your numbers from hex to dec) as the command, in my case the correct sequence was:
sendevent /dev/input/event2 3 0 509
sendevent /dev/input/event2 3 1 58
sendevent /dev/input/event2 1 330 1
sendevent /dev/input/event2 0 0 0
sendevent /dev/input/event2 1 330 0
sendevent /dev/input/event2 0 0 0
Obviously it will be different for you, but the general sequence is x coordinate, y coordinate, touch screen, blank, release touch, blank.
And it works (i'm using a series of tasker adb shell commands)!
I don't know which viewer you are using (or even anything about them), but I'll be that it can take a path as data in the actuating Intent.
Then you'd only need something like:
Code:
am start -n com.neatoh.viewer/.Viewer -e Path /MyPhotos
No, these are all hypothetical values.
so, I was googling around a bit, a few days ago, and found out you can control the torch (and other leds) from the command line, or a bash script.
Prerequisites
root (magisk or superSU)
FX file manager or Termux
Text editor
Instructions
Create a file in a directory of your choice with a '.sh' extension
Add the following code to the file:
Code:
su -c 'echo 255 > /sys/class/leds/torch/brightness'
Run the shell script in termux (cd to the directory and run it) or run it using FX, it will ask for root access if you haven't already granted it
Your torch is now on!
To turn it off create another file with
Code:
su -c 'echo 0 > /sys/class/leds/torch/brightness'
in it
Tested on an Honor 9 and P10+
If you have dual tone flash, yo may find different values cause either led to come on, for me, '255' is the yellow flash and '1' is the white flash
For a bit more messing around, cd to the '/sys/class/leds' directory, you will see a few more directories for other LEDs on your device, controlling them is exactly the same as the torch!
Works for me, thanks a bunch dude
EDIT: on honor 7x/Huawei mate se
Thank you so much for this but I found in my own experience, and from comments I saw where this has been shared, that a bash script perhaps wasn't the most effective to have to run each time so I thought of implementing this to Tasker, create a "pseudo toggle" and allocate it to a quick setting tile. The algorithm is:
Code:
If flashlightStatus = TRUE then
Run shell command: su -c 'echo 0 /sys/class/leds/torch/brightness'
Set variable flashlightStatus to FALSE
Else
Run shell command: su -c 'echo 3 /sys/class/leds/torch/brightness'
Set variable flashlightStatus to TRUE
End If
I set it up this way because if you've never set the variable before (or if it clears on reboot or something) then it won't equal true and would still enable. Also, when I set the brightness to 255 the torch had a slight yellow tint so upon further reading, despite that 255 should be full brightness, apparently max brightness is 3 and is a white light (this seems to disable automatically after around 750ms however). Hope this will help those who are still without a torch on treble GSIs.
P.S. I also set up a quick profile that if the flashlight status variable = true then to wait 750ms and check if still true then change to false and turn off the torch; this would reset to compensate for the OS turning the torch off automatically but Tasker still thinking it was on. I'm not sure how necessary this is or whether it's overkill or not.
beejkitsune said:
Thank you so much for this but I found in my own experience, and from comments I saw where this has been shared, that a bash script perhaps wasn't the most effective to have to run each time so I thought of implementing this to Tasker, create a "pseudo toggle" and allocate it to a quick setting tile. The algorithm is:
Code:
If flashlightStatus = TRUE then
Run shell command: su -c 'echo 0 /sys/class/leds/torch/brightness'
Set variable flashlightStatus to FALSE
Else
Run shell command: su -c 'echo 3 /sys/class/leds/torch/brightness'
Set variable flashlightStatus to TRUE
End If
I set it up this way because if you've never set the variable before (or if it clears on reboot or something) then it won't equal true and would still enable. Also, when I set the brightness to 255 the torch had a slight yellow tint so upon further reading, despite that 255 should be full brightness, apparently max brightness is 3 and is a white light (this seems to disable automatically after around 750ms however). Hope this will help those who are still without a torch on treble GSIs.
P.S. I also set up a quick profile that if the flashlight status variable = true then to wait 750ms and check if still true then change to false and turn off the torch; this would reset to compensate for the OS turning the torch off automatically but Tasker still thinking it was on. I'm not sure how necessary this is or whether it's overkill or not.
Click to expand...
Click to collapse
mind if i improve this?
Code:
su -c 'if grep -q 1 /sys/class/leds/torch/brightness; then echo 0 > /sys/class/leds/torch/brightness; else echo 1 > /sys/class/leds/torch/brightness; fi'
-- obviously you can change the 1 to whatever you want
that is the code i'm using, prevents the use of an unnecessary variable, so is faster, and will use less resources, plus its pretty much fail safe, since it reads the current state of the torch to determine if its on or off, so if something else sets it to a state it still works, if something else set you variable externally then the torch becomes messed up until a reboot.
plus, im assuming that variable is a tasker thing? not everyone will use tasker, so eliminating the variable all together makes it work on any app that can add custom quick settings tiles
ambitiousButRubbish said:
mind if i improve this?
Code:
su -c 'if grep -q 1 /sys/class/leds/torch/brightness; then echo 0 > /sys/class/leds/torch/brightness; else echo 1 > /sys/class/leds/torch/brightness; fi'
-- obviously you can change the 1 to whatever you want
that is the code i'm using, prevents the use of an unnecessary variable, so is faster, and will use less resources, plus its pretty much fail safe, since it reads the current state of the torch to determine if its on or off, so if something else sets it to a state it still works, if something else set you variable externally then the torch becomes messed up until a reboot.
plus, im assuming that variable is a tasker thing? not everyone will use tasker, so eliminating the variable all together makes it work on any app that can add custom quick settings tiles
Click to expand...
Click to collapse
Yes, the variable is a Tasker thing so I'm glad there is a solution that wouldn't rely on it. Thanks for the upgrade and I've already switched out my Tasker profile for this. Doesn't seem any quicker or anything but more simple!