0

I have an ASUS q/s301la running 14.04 and as you may know (seems to not be just my computer), the brightness fn keys don't really work. I can change the brightness in settings or rc.local but the changes don't stick after a restart.

2
  • 1
    Please post your question and answer as Q&A style. Thanks Oct 15, 2014 at 7:18
  • 1
    Woops! Sorry! Newbie here haha. I hope this is better.
    – maxmachine
    Oct 15, 2014 at 7:38

1 Answer 1

1

I didn't have any idea of how to fix those so I thought of a way to workaround it using crontabs!

Here's what I came up with (it's my first script outside of my Linux class... be nice.):

time=(date +%H)
if [$time -ge 2 -a $time -le 11]
then
  echo X > /sys/class/backlight/acpi_video0/brightness
elif [$time -ge 11 -a $time -le 17]
  echo X > /sys/class/backlight/acpi_video0/brightness
else 
  echo X > /sys/class/backlight/acpi_video0/brightness
fi

Insert your desired brightness percentage (e.g. 60 or whatever) instead of X.

So you add this into crontabs (or the system scheduler) by using the bash command crontabs -e in terminal. You format it by adding a new line with: * 0-23 * * * /path/script. The asterisks tell the scheduler how often to run the script and I chose once every hour or 0-23.

Basically what I hope this script does is: figure out what hour it is, save it in a variable $time, then compare it to my if, elseif, else statement, and then change the brightness accordingly in relation to the current hour!

You can also add this same script to /etc/rc.local so it runs at start up!

Hopefully this will help people with battery life, brightness control, resetting brightness at every startup, etc etc!

2
  • Welp... I fugured out this doesn't really work. Can anyone figure out why?
    – maxmachine
    Oct 15, 2014 at 7:44
  • I changed up the code a bit to use >= and <= instead of -ge and -le and && instead of -a. In tests, it seems to work but in practice not so much...
    – maxmachine
    Oct 15, 2014 at 9:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .