LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-16-2022, 12:54 AM   #1
Alfred-Augustus
Member
 
Registered: May 2022
Posts: 91

Rep: Reputation: 7
init with predefined brightness


Hi

I successfully set the screen brightness to 50% with this console command...

Code:
 # echo 2000 > /sys/class/backlight/intel_backlight/brightness.
But I have to do this everytime I boot my laptop, which is several times per day. This is annoying. The default screenbrightness is 100%. And that is very bright, blindingly.

So, I created a script in rc.d, for automatically set the screen brightness...

Code:
# cat /etc/rc.d/rc.set-screen 

#!/bin/sh

echo 2000 > /sys/class/backlight/intel_backlight/brightness


# ls -ld /etc/rc.d/rc.kks 
-rwxr-xr-x 1 root root 71 May 16 13:40 /etc/rc.d/rc.kks
But init does not seem to be executing this file during boot up.

What am I doing wrong?

Thanks!

Last edited by Alfred-Augustus; 05-16-2022 at 01:03 AM.
 
Old 05-16-2022, 01:11 AM   #2
Mark Pettit
Member
 
Registered: Dec 2008
Location: Cape Town, South Africa
Distribution: Slackware 15.0
Posts: 619

Rep: Reputation: 299Reputation: 299Reputation: 299
You need something to actually call your script. Either you can put an explicit call directly in the rc.local cript - or better yet, just add the above logic directly into rc.local.
 
1 members found this post helpful.
Old 05-16-2022, 01:17 AM   #3
elcore
Senior Member
 
Registered: Sep 2014
Distribution: Slackware
Posts: 1,753

Rep: Reputation: Disabled
From rc.M :
Code:
# Start the local setup procedure.
if [ -x /etc/rc.d/rc.local ]; then
  . /etc/rc.d/rc.local
fi
So, at the end of rc.M (or rc.local) add :

Code:
if [ -x /etc/rc.d/rc.whatever ]; then
  . /etc/rc.d/rc.whatever
fi
 
1 members found this post helpful.
Old 05-16-2022, 01:17 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,844

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
From my side:
1. it is overridden by some other command(s) later.
2. it is executed too early.
As far as I know the laptop (hardware) used to remember the brightness and restores it automatically.
 
Old 05-16-2022, 01:20 AM   #5
elcore
Senior Member
 
Registered: Sep 2014
Distribution: Slackware
Posts: 1,753

Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
As far as I know the laptop (hardware) used to remember the brightness and restores it automatically.
I think on one of mine it's saved in CMOS, so if the CMOS battery is drained it's not saved.
 
Old 05-16-2022, 03:49 AM   #6
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
My advice would be to use a custom udev rule to set it, which is what I do. Here's mine, as example...

/etc/udev/rules.d/81-backlight.rules:
Code:
# Set the initial backlight level.

SUBSYSTEM!="backlight", GOTO="backlight_end"
ACTION!="add", GOTO="backlight_end"

# Don't use the intel_backlight if the acpi backlight control is present:
TEST=="/sys/class/backlight/acpi_video0/brightness", GOTO="backlight_acpi"

KERNEL=="intel_backlight", ATTR{brightness}="364"

LABEL="backlight_acpi"
SUBSYSTEM=="backlight", KERNEL=="acpi_video0", ATTR{brightness}="39"

LABEL="backlight_end"
 
1 members found this post helpful.
Old 05-16-2022, 07:55 AM   #7
0XBF
Member
 
Registered: Nov 2018
Distribution: Slackware
Posts: 765

Rep: Reputation: 864Reputation: 864Reputation: 864Reputation: 864Reputation: 864Reputation: 864Reputation: 864
It may be worth looking through your bios settings first, before you go scripting a solution for init. My Dell laptop was always booting at 100% screen brightness by default until I found that menu in the bios and set it to 50% at startup. I believe it also had a setting for the keyboard back-lighting level too.
 
1 members found this post helpful.
Old 05-16-2022, 11:11 AM   #8
Alfred-Augustus
Member
 
Registered: May 2022
Posts: 91

Original Poster
Rep: Reputation: 7
Quote:
Originally Posted by GazL View Post
My advice would be to use a custom udev rule to set it, which is what I do. Here's mine, as example...

/etc/udev/rules.d/81-backlight.rules:
Code:
# Set the initial backlight level.

SUBSYSTEM!="backlight", GOTO="backlight_end"
ACTION!="add", GOTO="backlight_end"

# Don't use the intel_backlight if the acpi backlight control is present:
TEST=="/sys/class/backlight/acpi_video0/brightness", GOTO="backlight_acpi"

KERNEL=="intel_backlight", ATTR{brightness}="364"

LABEL="backlight_acpi"
SUBSYSTEM=="backlight", KERNEL=="acpi_video0", ATTR{brightness}="39"

LABEL="backlight_end"

That is great. It works! 364 is too dim on my Thinkpad. I changed it to 1500.

Last edited by Alfred-Augustus; 05-16-2022 at 11:21 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Change brightness percentage that screen brightness keys increase/decrease MozillaUser3172 Slackware 5 03-24-2020 06:07 PM
Can't adjust brightness with function key and can't adjust brightness after suspend. QuarkDev Linux Deepin 2 03-19-2015 10:46 AM
Mint 15 = black screen (brightness = 0) on start up - have to manually set brightness Netnovice Linux Mint 4 01-16-2014 08:46 PM
[SOLVED] Brightness set to zero: moved to http://www.linuxquestions.org/questions/slackware-14/brightness-set Z0K4 Linux - Laptop and Netbook 5 09-15-2011 10:09 AM
Emacs copy predefined text jrdioko Linux - Software 2 09-11-2005 03:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration