You are not logged in.

#1 2022-08-15 08:17:33

Juhayer Al Wasif
Member
Registered: 2022-08-15
Posts: 1

Brightness control not working

Brightness control is not working in my Acer Aspire-4752 laptop. I have looked into the backlight arch wiki but from there I was only able to control backlight through light command.
Otherwise brightness does not work. Also I have added those recommend lines for backlight control

Offline

#2 2022-08-15 23:57:48

Neutron17
Member
Registered: 2022-08-15
Posts: 1

Re: Brightness control not working

Using backlight
GRAPHICS_CARD_NAME is probably the only one, so you can autocomplete it, ex: amdgpu_bl1
This is the max brightness

cat /sys/class/backlight/<GRAPHICS_CARD_NAME>/max_brightness

And this the current brightness level:

cat /sys/class/backlight/<GRAPHICS_CARD_NAME>/brightness

You can change the brightness with:

echo "num" | sudo tee /sys/class/backlight/<GRAPHICS_CARD_NAME>/brightness

Example shell program
With this in mind you can write a simple shell script like:

 #!/bin/sh

# no value
if [ "$#" -ne 1 ]; then
        echo "Usage: $0 <brightness level>" >&2
        exit 1
fi

# GRAPHICS_CARD_NAME
dir=(/sys/class/backlight/*)
max_brightness="255"

# read max_brightness from file
while read line; do
        max_brightness="$line"
done < "$dir/max_brightness"

# argument more than max
if [ $max_brightness -lt "$1" ]; then
        echo "Too high number, max brightness is $max_brightness"
        exit 2
fi
 # filename
 brightness="$dir/brightness"
 
 # finally write to file
 echo "$1" | sudo tee $brightness

Let's name it bright.sh
Then make it executable with:

chmod +x bright.sh

Then you can run it like:

./bright 1

or

./bright 100

Last edited by Neutron17 (2022-08-16 00:21:46)

Offline

Board footer

Powered by FluxBB