Max brightness - Samsung Galaxy S7 Questions and Answers

Hi.
I come with a problem that I encountered with my Samsung Galaxy S7 G930F. The problem is that when I set the brightness to 100% and lock the phone, after unlocking it, it sets the brightness to the minimum, but the brightness bar remains at 100%. I did some digging in the files and found a file called "max_brightness" in the "/sys/class/backlight/panel/" directory. Sooo... i launched ADB and typed the following commands:
adb shell
su
cat "/sys/class/backlight/panel/max_brightness"
To my surprise, I got "365" value. I tried to change the value in this file to 255 with "echo 255> / sys / class / backlight / panel / max_brightness", but after executing it nothing happens and the value itself remains unchanged.
I think that changing this value can fix this error, unless someone has a better idea, then please give it below, I will gladly try it, because this error irritates me every time i change the brightness and lock my device.
EDIT: I forgot mention, that i use Havoc-OS v3.7.
Regards!

Perhaps you have auto brightness turned on or some other feature that uses phone sensors, regardless of them, the file you're checking has nothing to do with what you're facing.
This file is inside the Kernel, which means it's value is already specified (as you found it to be 365), and you can't normally change it's value, and definitely not permanently with your current steps.
I'll highlight you a few points:
Any file does have permissions, these permissions controls who can do what to/with the file, and there are owners, these are the users who can do what they actually want to the file. So when you can't change a file's value, you probably don't have the write permission.
SELinux can actually prevent you from modifying a lot of stuff, specially these kernel parameters, so you should set enforce to 0 if you want to have a wider range of freedom.
Using init.rc scripts can be quite helpful in your current situation, all you have to do is set permission, and write the value, and it will be applied when you reboot. (don't forget the selinux state)
I don't understand why you tried 255? as far as I know, that's for color range such as RGB and so ... P.S. that 365 value is your Screen's maximum brightness, the maximum it can get, if you lowered it, it'll seem really dim next time you set brightness to max. Your current brightness is in some other file.
The right way to change a value of such a file is by executing:
Code:
su
setenforce 0
chmod 0644 /sys/class/backlight/panel/max_brightness
echo "255" > /sys/class/backlight/panel/max_brightness
You should report a bug to the ROM developer, either by Forum, DM, or Telegram.

Related

[Q] Terminal Command for Persistent Brightness Setting - Rooted Android Milestone

Hi. This is a question for a rooted Droid /Milestone, but should be applicable to other models as well. I'd like to know if there's a command or any other functionality I can use to "lock" the brightness setting so that other applications can't change it.
I know it's possible, because there's an app in the Market called AdjBrightness (looks like the developer posts here, as well) that is capable of locking it, but I don't quite need all the functionality it provides, and I can't work out how to reverse its home row backlight disabling, which means I ALSO have to run LEDs Hack... I'd like to just write something simple for my specific settings to replace both.
I'm trying to create a very short script I can run with Tasker and set to a widget that will accomplish 3 things: Disable the home row backlights, set the brightness to 2/255, and then "lock" that setting so that other apps can't affect it. I want to run Aldiko for reading in pretty much total darkness, and this is the ideal setting for me.
So far, I can get it set properly using the following:
su
echo 2 > /sys/class/leds/lcd-backlight/brightness
echo 0 > /sys/class/leds/button-backlight/brightness
and with Tasker I can run that as a script and set it to a widget, with another widget to complement it that runs:
su
echo 100 > /sys/class/leds/lcd-backlight/brightness
echo 1 > /sys/class/leds/button-backlight/brightness
which reverses the process and sets everything back to normal.
What I need is to figure out how to lock in that "2" brightness setting, which at this time persists only until some other app affects the brightness. When I run Aldkio, its built-in brightness control feature overrides my setting and lights the thing back up too bright.
So, can this be done with a script? I imagine a chown command that temporarily takes ownership of that function could work, but I'm not smart enough to know how, and I've exhausted Google and the forum search. As I mentioned, this thing would always be run with a complimentary script that could later reverse the chown and give it back to whatever process it ought to belong to... I KNOW it's possible because there's at least one app that does it perfectly; the AdjBrightness setting change persists after I open Aldiko, indeed it persists basically forever; you've got to kill the app or reboot to be able to adjust the brightness with any other means.
Can anyone point me in the right direction?
Bump? Still trying to figure this out.
Bump
Still wondering if there's a way to do this.
+ 1 - if you find a way to lock it via command line, do post back, as will i
i am currently using adjbrightness it to control my button backlights on my dell streak
its great as it locks it on for that session. but after reboot have to manually renable
so i have written an execute entry in tasker to control all or just some of the leds for various notifications
but would love a command line way to lock these as adjbrightness does, i cant find out how its doing that!!!
jdb1981 said:
Hi. This is a question for a rooted Droid /Milestone, but should be applicable to other models as well. I'd like to know if there's a command or any other functionality I can use to "lock" the brightness setting so that other applications can't change it.
I know it's possible, because there's an app in the Market called AdjBrightness (looks like the developer posts here, as well) that is capable of locking it, but I don't quite need all the functionality it provides, and I can't work out how to reverse its home row backlight disabling, which means I ALSO have to run LEDs Hack... I'd like to just write something simple for my specific settings to replace both.
I'm trying to create a very short script I can run with Tasker and set to a widget that will accomplish 3 things: Disable the home row backlights, set the brightness to 2/255, and then "lock" that setting so that other apps can't affect it. I want to run Aldiko for reading in pretty much total darkness, and this is the ideal setting for me.
So far, I can get it set properly using the following:
su
echo 2 > /sys/class/leds/lcd-backlight/brightness
echo 0 > /sys/class/leds/button-backlight/brightness
and with Tasker I can run that as a script and set it to a widget, with another widget to complement it that runs:
su
echo 100 > /sys/class/leds/lcd-backlight/brightness
echo 1 > /sys/class/leds/button-backlight/brightness
which reverses the process and sets everything back to normal.
What I need is to figure out how to lock in that "2" brightness setting, which at this time persists only until some other app affects the brightness. When I run Aldkio, its built-in brightness control feature overrides my setting and lights the thing back up too bright.
So, can this be done with a script? I imagine a chown command that temporarily takes ownership of that function could work, but I'm not smart enough to know how, and I've exhausted Google and the forum search. As I mentioned, this thing would always be run with a complimentary script that could later reverse the chown and give it back to whatever process it ought to belong to... I KNOW it's possible because there's at least one app that does it perfectly; the AdjBrightness setting change persists after I open Aldiko, indeed it persists basically forever; you've got to kill the app or reboot to be able to adjust the brightness with any other means.
Can anyone point me in the right direction?
Click to expand...
Click to collapse
In my device adjbrightness app lock the brightness just by changing the permission of "/sys/.. /brightness" file to 444. So even system can't change the brightness value if requested by any other apps. To unlock the brightness permission of "/sys... /brightness" is restored to previous state, 644.
So in terminal the commands can be "for changing brightness to 2 and lock it"
su
echo 2>/sys/class/leds/lcd-backlight/brightness
chmod 444 /sys/class/leds/lcd-backlight/brightness
"for unlock and restore "
su
chmod 644 /sys/class/leds/lcd-backlight/brightness
echo 100> /sys/class/leds/lcd-backlight/brightness
Same goes for button backlight brightness file
But I found it "not suitable" for my device even with adjbrightness. If I lock brightness using adjbrightness after my screen turns off normally or by using power button , I can't turn it on using power button, so I have to open the battery and reboot the device. Same thing happens if I do it using "commands" or script. So "something" should be done so that the permission of ".. /brightness" file is set to 644 before the screen turns off normally or by other means.And after the screen is on the file permission will be 444 again. I think it may be done using tasker but still don't know how.
Hope someone will help.
Thanks.
Hi
I am not sure why, but I can't turn off screen, with "echo 0 >" into brightness.
It seems that there is some minimum brightness somewhere which I need to configure ?
I really struggle with it.
Any idea how to do that ?
Thanks,
Ranchu

[R&D] Settings Screen Brightness API Issue

I am writing an application that changes the brightness, and I noticed that the Skyrocket does not return the proper values.
Using the Settings class if I call:
Settings.System.getInt(resolver,Settings.System.SCREEN_BRIGHTNESS);
25 is returned the first time regardless of the system brightness. If I call it again, then the proper value is returned.
Can you guys confirm or deny this issue? I've tested on another phone and emulator, which work as documented.
wrong thread somehow. wat.
My screen doesn't keep it's brightness settings when I use another program besides the built-in brightness changer in the Settings menu. If I set it low and I lock it, it always comes back up to full brightness after I turn it back on. Weird.
Seems that the T989 t-mo variant has the same issue with CM7's display tweaking utilities. Something in the hardware seems to always make it come back on at a hardcoded predefined brightness.
Hi,
As I recall from poking around the kernel source, there are some routines that intercept the value passed from the ROM and tweak it a bit before actually applying it to the screen.
Take a look at ./drivers/video/msm/lcdc_ld9040.c in the kernel source, IIRC there are some hardcoded values in here that might be resulting in your reading of 25 (I think there is a minimum value of 24 set somewhere in there, been a while since I looked)

[Kernel Module] Backlight: Lower Brightness (Useful at Night)

(dev only for now, you need to know how to install/load a kernel module by hand/write a init.d script for it)
Hi,
I was annoyed by the too bright backlight especially at night. Even the lowest (non-zero) setting was too bright for me (see my thread in general section).
Thanks to irfanbagus BCM-TWEAK which I could easily adapt here's kernel module to lower the lowest brightness. This means that only the former lowest mode is changed to an even lower brightness, the other modes remain the same.
I've attached a kernel module for this incl. source (based on irfanbagus' source, say thanks to him ).
After loading this module you can simply use the system backlight setter to dim the backlight. In case it was already set to lowest brightness, simply increase the brightness and then decrease it again to apply the updated mode.
This doesn't work with GO Launcher's setting widget's backlight setter and probably also not with other 3rd party backlight setters.
If you test it, please report.
More details about backlight/brightness (see aat1401_bl.c in kernel source if you're interested):
- brightness level is a value in [0,255] (most apps map this to [0,100]%)
- in fact there're just about 25 different brightness levels which a stored in a table, each entry has a 'level' and a 'tune_level' value
- the tune_level (>0) determines the brightness: low level low brightness, high level high brightness
- there's a "lowest" level (30) but only the system setter respects this. This level's tune_level is changed by my kernel module to 1 instead of 2
- system's brightness setter allows no level below 30 thus my mod works good with it
- other setters allow levels below 30 and here is the problem:
The responsible module for setting the backlight brightness looks at the level value in [0,255]. If it's below 30 then a default tune_level of 2 is used.
The GO Launcher widget probably simply sets the level to 0.
I don't know a way to change this default tune_level in a already compiled/running kernel.
So if you want to use another setter, make sure to choose level 30 or about 12% because then my updated tune_level will be used. Usually 12% should map to level 30. If not, I can't help you. Use system setter instead.
Btw to switch backlight off (warning, not recommended) you can use the direct way: echo 0 > /sys/class/backlight/aat1401-backlight/brightness
Found a widget which allows custom brightness values and works fine with my mod: Brightness Widget - Backlight!
Tested with this settings: 30,1,150,255
i am using switch pro widget..range from
0% ----> 100%
ronnieryan said:
i am using switch pro widget..range from
0% ----> 100%
Click to expand...
Click to collapse
0% = no backlight?
Anyway, with my mod you'd have the lowest brightness at 12%.
mikstev said:
0% = no backlight?
Anyway, with my mod you'd have the lowest brightness at 12%.
Click to expand...
Click to collapse
yes, 0% no backlight, but its so inconvenient ..10% is better
Interesting, I'll have a look.
Edit: As far as I see this widget doesn't require root. Even if it could disable backlight (I'm not sure if this is possible) its lowest non-zero brightness is higher than with my mod.
how can i use this sir?
nakawanaoki said:
how can i use this sir?
Click to expand...
Click to collapse
1. Copy the .ko file to /system/lib/modules
2. Set the file permissions to 644
3. Install the module via insmod bl_brightness-tweak.ko (you can also use a init.d script for this, you can adapt the one I uploaded in the droidwall thread)
I am not sure why,
but on trying to turn off screen with "echo 0" it is only get darker, but not completely off.
Is there any way to really turn of screen ?
Thank you,
Ranchu

[Help] Tasker & Brightness Script

Writing my first scripts for Tasker & looking for some help while I try to figure this out.
I'm trying to write 2 scripts. One is to increase brightness, and one is to decrease it.
I have tasker, and I have the Screen Filter app (which has a plug in for Tasker).
I'd like to make a shortcut (that I will be calling from yet another app) that will increase brightness from:
Screen Filter 40%, Screen 0
SF 0%, S 0
SF 0%, S 50
SF 0%, S 150
SF 0%, S 255
Then the opposite for decrease.
The idea was to set a variable called %Bright, and use a if-else-else-else-end if that checked the current level of the variable, and set the screen 1 brighter and set the variable to a new value. (ie, check current brightness then increase by 1 level).
Problem is if anything other then my shortcut changed the brightness, Tasker doesn't know about it. (Say if I use Quick Settings)
There any way to get Tasker to check the current state of the brightness (and screen filter)? There a better way to do this inside Tasker?
(btw, I am aware of other apps to control brightness. please don't mention them in this thread)
EDIT: Wrote the script out with no problems assuming variable is set. For now, using variable 1-5 (dimmest to brightest). If variable is not set, or anything else, then both my dim script & my bright script will just set it to 1 and go from there.

[Q] Making permission settings "stick"

I created a simple Python script that brings up a menu to select different brightness levels by way of opening up the /sys/class/leds/backlight/brightness file and writes whatever value that you want to set the level at. An example would be 255 would be the max brightness and of course 1 would be almost no light. I like using this script because it allows me to set the brightness way lower than the stock lowest without use of an app like Screen Filter. There's a couple other scripts I wrote for toggling the keyboard and soft button leds too and I have the same issue with them.
This script will only work if I beforehand goto that specific file in Root Explorer and enable the read and write permissions for Others. Once I reboot the device though, those are always reset to disabled. If I run the script without enabling these of course I'll get a permission denied error.
How would I go about making those settings stick? I'm thinking I might have to incorporate some Java somewhere in the Python to do this but I'm not sure. I haven't learned Java yet
Can anyone give me some advice or some kind of direction? I will greatly appreciate any help and will thank you with hitting the Thanks button
you can write a start-up script that will chmod the file/s when the device is turned on.
chevyowner said:
you can write a start-up script that will chmod the file/s when the device is turned on.
Click to expand...
Click to collapse
Thanks so much for your advice....now I can kill two birds with one stone....not only will I achieve my objective but also learn some about those other scripts you speak of

Categories

Resources