[Solved] To stop auto max brightness on booting

Post here if you are a new Porteus member and you're looking for some help.
meet
Black ninja
Black ninja
Posts: 88
Joined: 31 Mar 2020, 04:37
Distribution: Porteus 4.0

[Solved] To stop auto max brightness on booting

Post#1 by meet » 07 Apr 2020, 02:27

Hello,

I have Porteus 5 with changes saved using the .bat file method.

However, the brightness level is not saved across boots. Every time I boot, the brightness is increased to max.

Is there a way to load the same brightness that was set last time I logged in?

Also, same question for Wifi switch, bluetooth switch, num lock, etc.

Solution:
Solution provided by Rava
It won't save the brightness across the boots, but will revert the brightness to a set level every time you login.
Last edited by meet on 11 Apr 2020, 03:33, edited 1 time in total.

User avatar
Ed_P
Contributor
Contributor
Posts: 8359
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

To stop auto max brightness on booting

Post#2 by Ed_P » 07 Apr 2020, 03:14

meet wrote:
07 Apr 2020, 02:27
I have Porteus 5 with changes saved using the .bat file method.
Describe your .bat file method. Who wrote it, how is it run, when is it run. Post the contents of the file also would be helpful.
Ed

meet
Black ninja
Black ninja
Posts: 88
Joined: 31 Mar 2020, 04:37
Distribution: Porteus 4.0

To stop auto max brightness on booting

Post#3 by meet » 08 Apr 2020, 04:17

Ed_P wrote:
07 Apr 2020, 03:14
meet wrote:
07 Apr 2020, 02:27
I have Porteus 5 with changes saved using the .bat file method.
Describe your .bat file method. Who wrote it, how is it run, when is it run. Post the contents of the file also would be helpful.
Well, I made it. Based on the suggestions on this forum and the instructions that were given in Porteus documentation.

How it is run and when it is run? I dunno. I never open the file. Porteus OS would be using it I guess. As the files that I create and settings that I change (like theme, etc) are saved across reboots.

Only the things that I mentioned in the question are not saved.

User avatar
Ed_P
Contributor
Contributor
Posts: 8359
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

To stop auto max brightness on booting

Post#4 by Ed_P » 08 Apr 2020, 05:28

1. A .bat file is a DOS command script. This is Linux.

2. A save changes file is a .dat file. porteussave.dat

3. The .dat file is created by Porteus in the /changes directory and used after the 1st reboot.

4. If only some things are saved implies your .dat file is full.

5. How big is your .dat file?

:)
Ed

meet
Black ninja
Black ninja
Posts: 88
Joined: 31 Mar 2020, 04:37
Distribution: Porteus 4.0

To stop auto max brightness on booting

Post#5 by meet » 09 Apr 2020, 09:31

Ed_P wrote:
08 Apr 2020, 05:28
1. A .bat file is a DOS command script. This is Linux.
Oh sorry. My mistake in typing.
It is .dat file yes.

Changes are saved properly. dat file size is 1.5 GB as per properties of that file from linux.

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

To stop auto max brightness on booting

Post#6 by Rava » 10 Apr 2020, 22:13

I presume you speak about a notebook or laptop here.

I wrote myself a script that can change the brightness from the CLI. You need to be root to change it.

Code: Select all

# setscreenbrightness.sh 
/sys/class/backlight/acpi_video0/brightness is set to 0
As you can see, when started without parameter it just tells you what level the screen brightness currently is set to.
And it also tells you which file to change.

The change is quite easy. The allowed range differs from system to system, with my notebook the allowed range is from 0 to 7, so there are 8 levels.
0 is the less bright and 7 the brightest.

The number for the brightest can likely differ for your system.

To change is simply do this:

Code: Select all

echo  0 > /sys/class/backlight/acpi_video0/brightness
to set it to 0.

Then make sure the above file is saved in your .dat file. Reboot and it should work.

If it does not, edit the /etc/rc.d/rc.local to add the above line. Again save /etc/rc.d/rc.local into your .dat file. reboot.

Please report back here if my tips have been helpful so that others know they worked, which I hope they will.

In my system, when the brightness level is set, the PC remembers that by itself, but I presume that also differs from system to system.
Cheers!
Yours Rava

meet
Black ninja
Black ninja
Posts: 88
Joined: 31 Mar 2020, 04:37
Distribution: Porteus 4.0

To stop auto max brightness on booting

Post#7 by meet » 11 Apr 2020, 03:31

Rava wrote:
10 Apr 2020, 22:13
I presume you speak about a notebook or laptop here.

I wrote myself a script that can change the brightness from the CLI. You need to be root to change it.

Code: Select all

# setscreenbrightness.sh 
/sys/class/backlight/acpi_video0/brightness is set to 0
As you can see, when started without parameter it just tells you what level the screen brightness currently is set to.
And it also tells you which file to change.

The change is quite easy. The allowed range differs from system to system, with my notebook the allowed range is from 0 to 7, so there are 8 levels.
0 is the less bright and 7 the brightest.

The number for the brightest can likely differ for your system.

To change is simply do this:

Code: Select all

echo  0 > /sys/class/backlight/acpi_video0/brightness
to set it to 0.

Then make sure the above file is saved in your .dat file. Reboot and it should work.

If it does not, edit the /etc/rc.d/rc.local to add the above line. Again save /etc/rc.d/rc.local into your .dat file. reboot.

Please report back here if my tips have been helpful so that others know they worked, which I hope they will.

In my system, when the brightness level is set, the PC remembers that by itself, but I presume that also differs from system to system.
Hey Thanks for the complete response.

This was not working in Porteus 5. But now I am using Porteus 4 with KDE. Here the system settings have the option to set the brightness for three different categories - plugged in, on battery, and low battery. I have set the brightness level in all three cases and it reverts the brightness level to that every time I log in.

Your scripts as I see, will also revert the brightness to the set parameter for each boot.

This works. Though, I was looking for a way to "save" the brightness level across sessions, so that brightness set in one session is set again when I log on the next time. (Not the linux session, session in general sense).

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

[Solved] To stop auto max brightness on booting

Post#8 by Rava » 11 Apr 2020, 04:40

meet wrote:
11 Apr 2020, 03:31
Your scripts as I see, will also revert the brightness to the set parameter for each boot.

This works. Though, I was looking for a way to "save" the brightness level across sessions, so that brightness set in one session is set again when I log on the next time. (Not the linux session, session in general sense).
When you want one setting globally, /etc/rc.d/rc.local is your file and

Code: Select all

echo  0 > /sys/class/backlight/acpi_video0/brightness
what you need to put into it.
When you need more fine tuning you have to create setup files like /etc/rc.d/rc.local but for each session its own, I would have no clue how do create such since I never needed it, but in Linux, thus can be done.
Then edit such setup file and instead of echo 0 use the number you need.

For your convenience here is the code of my script. make sure it is only executable by root since the normal user cannot access it anyway.

Code: Select all

#!/bin/sh
# set screen brightness level or get it without parameter
# Known bug: no sanity check if $1 is valid, not even if $1 is numerical! - user will get an error like "line 12: echo: write error: Invalid argument"
if [ $UID -ne 0 ]; then
    echo "You need to be root to run $0"
    exit 1
fi
if [ "$#" = "0" ]; then
	echo /sys/class/backlight/acpi_video0/brightness is set to $(cat /sys/class/backlight/acpi_video0/brightness)
else
	echo  $1 > /sys/class/backlight/acpi_video0/brightness
fi
Save the above as root as /usr/local/bin/setscreenbrightness.sh and do, also as root,

Code: Select all

chmod 0744 /usr/local/bin/setscreenbrightness.sh 
Cheers!
Yours Rava

Post Reply