How to switch between options in `/sys/class/backlight` to solve brightness problem?The brightness of laptop...

Why do I get two different answers for this counting problem?

intersection of two sorted vectors in C++

SSH "lag" in LAN on some machines, mixed distros

1960's book about a plague that kills all white people

Neighboring nodes in the network

Withdrawals from HSA

What's the point of deactivating Num Lock on login screens?

Does casting Light, or a similar spell, have any effect when the caster is swallowed by a monster?

Arrow those variables!

Will google still index a page if I use a $_SESSION variable?

Can one be a co-translator of a book, if he does not know the language that the book is translated into?

Where does SFDX store details about scratch orgs?

Can a rocket refuel on Mars from water?

Emailing HOD to enhance faculty application

How to say in German "enjoying home comforts"

Why is consensus so controversial in Britain?

What's the difference between 'rename' and 'mv'?

How can saying a song's name be a copyright violation?

Why are electrically insulating heatsinks so rare? Is it just cost?

Today is the Center

In a Spin are Both Wings Stalled?

What exploit are these user agents trying to use?

Watching something be written to a file live with tail

Reserved de-dupe rules



How to switch between options in `/sys/class/backlight` to solve brightness problem?


The brightness of laptop screen cannot be adjusted with either the buttons or the slider. EditBrightness Buttons not working in 18.04Lowering screen max brightness with Ubuntu 18.04Xubuntu 18.04: make Fn brightness keys work with /sys/class/backlight/nv_backlight/Ubuntu 18.04 Cannot change display brightness or wake from Sleep on ASUS ROG laptopBrightness won't change on Ubuntu 16.04 Macbook Air 13.3Brightness on laptop MSI GT72VR in Ubuntu 18.04 with NVIDIA GTX 1060 Mobile doesn't workUnable to change the screen brightnessBrightness control missing when using Nvidia drivers but re-appears with X.OrgNVIDIA display issue with brightness control and video playback2 folders in Sys/Class/Backlight?Brightness control increments brightness by 4 instead of 1Brightness stuck at 100% on an Acer Aspire 5742ZBrightness fn key adjustment problemsi can not edit file even after entered root passwordUbuntu brightness max_levelBrightness function key : very slow responsenvidia backlight brightness problemUnable to set screen brightness - xubuntu 16.04Cannot adjust Brightness 16.04






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







2















OS : Ubuntu - 18.04 LTS



I have 2 symbolic links in /sys/class/backlight/ directory.



acpi_video0 -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0/
nv_backlight -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/nv_backlight/


The brightness hotkeys change the value of acpi_video0/brightness. But that doesn't actually change the display's brightness.



But, manually changing the value ofnv_backlight/brightness actually change the display's brightness.



So, linking the hotkeys to nv_backlight instead of acpi_video0 will solve my problem, but I don't know how to do it.



Edit: The pop-up slider progress bar appears on the screen on the operation of the Fn keys for brightness(hotkeys).



Edit:





  1. Input:



    cat /sys/class/backlight/nv_backlight/max_brightness


    Output:



    100



  2. Input:



    cat /sys/class/backlight/nv_backlight/actual_brightness


    Output(this value changes automatically to the same value, I manually gave into /sys/class/backlight/nv_backlight/brightness):



    10



  3. Input:



    cat /sys/class/backlight/acpi_video0/max_brightness


    Output:



    15











share|improve this question

























  • When you operate the Fn keys for bright up/down does the pop up slider progress bar display on screen?

    – WinEunuuchs2Unix
    Jun 11 '18 at 22:34











  • Did you try acpi_backlight=vendor in the answer below? Did it work?

    – WinEunuuchs2Unix
    Jun 12 '18 at 22:48











  • No, when I do acpi_backlisht=vendor, the acpi_video0 option goes away and a new option sony comes in and the hotkeys reflect changes in sony/brightness, with no actual display brightness change. The nv_backlight option remains though and the manual changes to it still give me the actual change in brightness.

    – boobalan
    Jun 13 '18 at 4:55













  • OK. It's too late tonight but tomorrow night I'll start writing a script that will take changes to acpi_video0 and pump the equivalent percentage into nVidieo backlight.

    – WinEunuuchs2Unix
    Jun 13 '18 at 4:58











  • Thanks, WinEunuuchs2Unix. I tried redirecting the symbolic link. But it gives me an unauthorized operation error.

    – boobalan
    Jun 13 '18 at 5:07


















2















OS : Ubuntu - 18.04 LTS



I have 2 symbolic links in /sys/class/backlight/ directory.



acpi_video0 -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0/
nv_backlight -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/nv_backlight/


The brightness hotkeys change the value of acpi_video0/brightness. But that doesn't actually change the display's brightness.



But, manually changing the value ofnv_backlight/brightness actually change the display's brightness.



So, linking the hotkeys to nv_backlight instead of acpi_video0 will solve my problem, but I don't know how to do it.



Edit: The pop-up slider progress bar appears on the screen on the operation of the Fn keys for brightness(hotkeys).



Edit:





  1. Input:



    cat /sys/class/backlight/nv_backlight/max_brightness


    Output:



    100



  2. Input:



    cat /sys/class/backlight/nv_backlight/actual_brightness


    Output(this value changes automatically to the same value, I manually gave into /sys/class/backlight/nv_backlight/brightness):



    10



  3. Input:



    cat /sys/class/backlight/acpi_video0/max_brightness


    Output:



    15











share|improve this question

























  • When you operate the Fn keys for bright up/down does the pop up slider progress bar display on screen?

    – WinEunuuchs2Unix
    Jun 11 '18 at 22:34











  • Did you try acpi_backlight=vendor in the answer below? Did it work?

    – WinEunuuchs2Unix
    Jun 12 '18 at 22:48











  • No, when I do acpi_backlisht=vendor, the acpi_video0 option goes away and a new option sony comes in and the hotkeys reflect changes in sony/brightness, with no actual display brightness change. The nv_backlight option remains though and the manual changes to it still give me the actual change in brightness.

    – boobalan
    Jun 13 '18 at 4:55













  • OK. It's too late tonight but tomorrow night I'll start writing a script that will take changes to acpi_video0 and pump the equivalent percentage into nVidieo backlight.

    – WinEunuuchs2Unix
    Jun 13 '18 at 4:58











  • Thanks, WinEunuuchs2Unix. I tried redirecting the symbolic link. But it gives me an unauthorized operation error.

    – boobalan
    Jun 13 '18 at 5:07














2












2








2


1






OS : Ubuntu - 18.04 LTS



I have 2 symbolic links in /sys/class/backlight/ directory.



acpi_video0 -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0/
nv_backlight -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/nv_backlight/


The brightness hotkeys change the value of acpi_video0/brightness. But that doesn't actually change the display's brightness.



But, manually changing the value ofnv_backlight/brightness actually change the display's brightness.



So, linking the hotkeys to nv_backlight instead of acpi_video0 will solve my problem, but I don't know how to do it.



Edit: The pop-up slider progress bar appears on the screen on the operation of the Fn keys for brightness(hotkeys).



Edit:





  1. Input:



    cat /sys/class/backlight/nv_backlight/max_brightness


    Output:



    100



  2. Input:



    cat /sys/class/backlight/nv_backlight/actual_brightness


    Output(this value changes automatically to the same value, I manually gave into /sys/class/backlight/nv_backlight/brightness):



    10



  3. Input:



    cat /sys/class/backlight/acpi_video0/max_brightness


    Output:



    15











share|improve this question
















OS : Ubuntu - 18.04 LTS



I have 2 symbolic links in /sys/class/backlight/ directory.



acpi_video0 -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0/
nv_backlight -> ../../devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/nv_backlight/


The brightness hotkeys change the value of acpi_video0/brightness. But that doesn't actually change the display's brightness.



But, manually changing the value ofnv_backlight/brightness actually change the display's brightness.



So, linking the hotkeys to nv_backlight instead of acpi_video0 will solve my problem, but I don't know how to do it.



Edit: The pop-up slider progress bar appears on the screen on the operation of the Fn keys for brightness(hotkeys).



Edit:





  1. Input:



    cat /sys/class/backlight/nv_backlight/max_brightness


    Output:



    100



  2. Input:



    cat /sys/class/backlight/nv_backlight/actual_brightness


    Output(this value changes automatically to the same value, I manually gave into /sys/class/backlight/nv_backlight/brightness):



    10



  3. Input:



    cat /sys/class/backlight/acpi_video0/max_brightness


    Output:



    15








brightness acpi






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 14 '18 at 11:40







boobalan

















asked Jun 11 '18 at 13:44









boobalanboobalan

1135




1135













  • When you operate the Fn keys for bright up/down does the pop up slider progress bar display on screen?

    – WinEunuuchs2Unix
    Jun 11 '18 at 22:34











  • Did you try acpi_backlight=vendor in the answer below? Did it work?

    – WinEunuuchs2Unix
    Jun 12 '18 at 22:48











  • No, when I do acpi_backlisht=vendor, the acpi_video0 option goes away and a new option sony comes in and the hotkeys reflect changes in sony/brightness, with no actual display brightness change. The nv_backlight option remains though and the manual changes to it still give me the actual change in brightness.

    – boobalan
    Jun 13 '18 at 4:55













  • OK. It's too late tonight but tomorrow night I'll start writing a script that will take changes to acpi_video0 and pump the equivalent percentage into nVidieo backlight.

    – WinEunuuchs2Unix
    Jun 13 '18 at 4:58











  • Thanks, WinEunuuchs2Unix. I tried redirecting the symbolic link. But it gives me an unauthorized operation error.

    – boobalan
    Jun 13 '18 at 5:07



















  • When you operate the Fn keys for bright up/down does the pop up slider progress bar display on screen?

    – WinEunuuchs2Unix
    Jun 11 '18 at 22:34











  • Did you try acpi_backlight=vendor in the answer below? Did it work?

    – WinEunuuchs2Unix
    Jun 12 '18 at 22:48











  • No, when I do acpi_backlisht=vendor, the acpi_video0 option goes away and a new option sony comes in and the hotkeys reflect changes in sony/brightness, with no actual display brightness change. The nv_backlight option remains though and the manual changes to it still give me the actual change in brightness.

    – boobalan
    Jun 13 '18 at 4:55













  • OK. It's too late tonight but tomorrow night I'll start writing a script that will take changes to acpi_video0 and pump the equivalent percentage into nVidieo backlight.

    – WinEunuuchs2Unix
    Jun 13 '18 at 4:58











  • Thanks, WinEunuuchs2Unix. I tried redirecting the symbolic link. But it gives me an unauthorized operation error.

    – boobalan
    Jun 13 '18 at 5:07

















When you operate the Fn keys for bright up/down does the pop up slider progress bar display on screen?

– WinEunuuchs2Unix
Jun 11 '18 at 22:34





When you operate the Fn keys for bright up/down does the pop up slider progress bar display on screen?

– WinEunuuchs2Unix
Jun 11 '18 at 22:34













Did you try acpi_backlight=vendor in the answer below? Did it work?

– WinEunuuchs2Unix
Jun 12 '18 at 22:48





Did you try acpi_backlight=vendor in the answer below? Did it work?

– WinEunuuchs2Unix
Jun 12 '18 at 22:48













No, when I do acpi_backlisht=vendor, the acpi_video0 option goes away and a new option sony comes in and the hotkeys reflect changes in sony/brightness, with no actual display brightness change. The nv_backlight option remains though and the manual changes to it still give me the actual change in brightness.

– boobalan
Jun 13 '18 at 4:55







No, when I do acpi_backlisht=vendor, the acpi_video0 option goes away and a new option sony comes in and the hotkeys reflect changes in sony/brightness, with no actual display brightness change. The nv_backlight option remains though and the manual changes to it still give me the actual change in brightness.

– boobalan
Jun 13 '18 at 4:55















OK. It's too late tonight but tomorrow night I'll start writing a script that will take changes to acpi_video0 and pump the equivalent percentage into nVidieo backlight.

– WinEunuuchs2Unix
Jun 13 '18 at 4:58





OK. It's too late tonight but tomorrow night I'll start writing a script that will take changes to acpi_video0 and pump the equivalent percentage into nVidieo backlight.

– WinEunuuchs2Unix
Jun 13 '18 at 4:58













Thanks, WinEunuuchs2Unix. I tried redirecting the symbolic link. But it gives me an unauthorized operation error.

– boobalan
Jun 13 '18 at 5:07





Thanks, WinEunuuchs2Unix. I tried redirecting the symbolic link. But it gives me an unauthorized operation error.

– boobalan
Jun 13 '18 at 5:07










1 Answer
1






active

oldest

votes


















2














Bash script redirect-brightness



Your problem is function keys to increase/decrease brightness are updating /sys/class/backlight/acpi_video0/brightness instead of /sys/class/backlight/nv_backlight/brightness



The original request was to intercept the function keys and use them to control the nv_backlight driver. The problem with this is:




  • Tricky udev scripts

  • No pop-up notification slider displaying brightness without complicated Python scripting.


The solution is to use inotify to monitor changes to acpi_video0. Then calculate the brightness percentage and apply that same percentage to nv_backlight.



In the bash script below you need to set:



WatchDriver="/sys/class/backlight/acpi_video0/brightness"
PatchDriver="/sys/class/backlight/nv_backlight/brightness"


Place the script in /usr/local/bin and make it executable using:



chmod a+x /usr/local/bin/redirect-brightness


First run the script from the command line using



redirect-brightness -l


If there is a problem check the log file using:



cat /tmp/redirect-brightness.log


If all works well add redirect-brightness to your startup applications.




redirect-brightness bash script



#!/bin/bash

# NAME: redirect-brightness
# PATH: /usr/local/bin
# DESC: Redirect to correct driver when Ubuntu is adjusting the wrong
# /sys/class/DRIVER_NAME/brightness

# DATE: June 13, 2018. Modified June 14, 2018.

# NOTE: Written for Ubuntu question:
# https://askubuntu.com/q/1045624/307523

WatchDriver="/sys/class/backlight/intel_backlight"
PatchDriver="/sys/class/backlight/intel_backlight"

# Must be running as sudo
if [[ $(id -u) != 0 ]]; then
echo >&2 "Root access required. Use: 'sudo redirect-brightness'"
exit 1
fi

# inotifywait required
type inotifywait >/dev/null 2>&1 ||
{ echo >&2 "'inotifywait' required but it's not installed. Aborting.";
echo >&2 "Use 'sudo apt install inotify-tools' to install it.'";
exit 1; }

# Was right watch driver directory name setup correctly?
if [[ ! -d $WatchDriver ]]; then
echo >&2 "Watch directory: '$WatchDriver'";
echo >&2 "does not exist. Did you spell it correctly? Aborting.'";
exit 1;
fi

# Was right patch driver directory name setup correctly?
if [[ ! -d $PatchDriver ]]; then
echo >&2 "Redirect to directory: '$PatchDriver'";
echo >&2 "does not exist. Did you spell it correctly? Aborting.'";
exit 1;
fi

# Get maximum brightness values
WatchMax=$(cat $WatchDriver/max_brightness)
PatchMax=$(cat $PatchDriver/max_brightness)

# PARM: 1="-l" or "--log-file" then write each step to log file.
fLogFile=false
if [[ $1 == "-l" ]] || [[ $1 == "--log-file" ]]; then
fLogFile=true
LogFile=/tmp/redirect-brightness.log
echo redirect-brightness LOG FILE > $LogFile
echo WatchMax: $WatchMax PatchMax: $PatchMax >> $LogFile
fi

SetBrightness () {
# Calculate watch current percentage
WatchAct=$(cat $WatchDriver/actual_brightness)
WatchPer=$(( WatchAct * 100 / WatchMax ))
[[ $fLogFile == true ]] && echo WatchAct: $WatchAct WatchPer: $WatchPer >> $LogFile
# Reverse engineer patch brightness to set
PatchAct=$(( PatchMax * WatchPer / 100 ))
echo $PatchAct | sudo tee $PatchDriver/brightness
[[ $fLogFile == true ]] && echo PatchAct: $PatchAct >> $LogFile
}

# When machine boots, set brightness to last saved value
SetBrightness

# Wait forever for user to press Fn keys adjusting brightness up/down.
while (true); do
inotifywait --event modify $WatchDriver/actual_brightness
[[ $fLogFile == true ]] &&
echo "Processing modify event in $WatchDriver/actual_brightness" >> $LogFile
SetBrightness
done




Original Answer June 11, 2018.



Work In Progress Answer



There are many nVidia users with similar problems in Ubuntu 18.04:




  • Brightness on laptop MSI GT72VR in Ubuntu 18.04 with NVIDIA GTX 1060 Mobile doesn't work

  • computer doesnt wake from suspension and couldnt change the brightness

  • Brightness control missing when using Nvidia drivers but re-appears with X.Org

  • Xubuntu 18.04: make Fn brightness keys work with /sys/class/backlight/nv_backlight/

  • How to alter backlight driver in lubuntu

  • Brightness on laptop MSI GT72VR in Ubuntu 18.04 with NVIDIA GTX 1060 Mobile doesn't work

  • NVIDIA display issue with brightness control and video playback

  • Unable to change the screen brightness

  • The brightness of laptop screen cannot be adjusted with either the buttons or the slider. Edit




Before writing a script



I can write a script to mimic changes to /acpi_video and populate /nv_backlight but before I do try this:




  • Edit /etc/default/grub.

  • Find quiet splash

  • Add behind splash: acpi_backlight=vendor

  • Save the file

  • Run sudo update-grub


According to this answer it should work for you: Xubuntu 18.04: make Fn brightness keys work with /sys/class/backlight/nv_backlight/





Wayland



Brightness doesn't work under Wayland. Make sure you aren't using it. See: The brightness of laptop screen cannot be adjusted with either the buttons or the slider. Edit






share|improve this answer


























  • The script does the work. But there is a small bug in SetBrightness (). It should be PatchAct=$(( PatchMax * WatchPer / 100 )). Thanks to the entire support.

    – boobalan
    Jun 14 '18 at 12:07






  • 1





    Unfortunately in mobile for next 10 hours. I'll test and revise tonight. Feel free to add new comments in the meantime.

    – WinEunuuchs2Unix
    Jun 14 '18 at 12:15











  • @boobalan You were right about the need to swap the watched percentage and 100 variables. I also corrected typos with nv_video (s/b nv_backlight) and extra /brightness in /brightness/brightness. If you are happy remember to click the grey check mark next to the answer. This will give others confidence to try out the script for themselves. It was fun developing this script. Thanks!

    – WinEunuuchs2Unix
    Jun 14 '18 at 23:06











  • If the script is run manually it does work. But if it is added to the startup applications, it doesn't work. I guess there is a problem with giving sudo permissions to startup applications. For your information, I gave redirect-brightness as the application command.

    – boobalan
    Jun 15 '18 at 6:31











  • There are many ways to call during startup. One is with cron. Create the file /etc/cron.d/backlight containing line 1: SHELL=/bin/sh line 2: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin line 3: @reboot root /usr/local/bin/redirect-brightness

    – WinEunuuchs2Unix
    Jun 15 '18 at 10:33












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1045624%2fhow-to-switch-between-options-in-sys-class-backlight-to-solve-brightness-prob%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Bash script redirect-brightness



Your problem is function keys to increase/decrease brightness are updating /sys/class/backlight/acpi_video0/brightness instead of /sys/class/backlight/nv_backlight/brightness



The original request was to intercept the function keys and use them to control the nv_backlight driver. The problem with this is:




  • Tricky udev scripts

  • No pop-up notification slider displaying brightness without complicated Python scripting.


The solution is to use inotify to monitor changes to acpi_video0. Then calculate the brightness percentage and apply that same percentage to nv_backlight.



In the bash script below you need to set:



WatchDriver="/sys/class/backlight/acpi_video0/brightness"
PatchDriver="/sys/class/backlight/nv_backlight/brightness"


Place the script in /usr/local/bin and make it executable using:



chmod a+x /usr/local/bin/redirect-brightness


First run the script from the command line using



redirect-brightness -l


If there is a problem check the log file using:



cat /tmp/redirect-brightness.log


If all works well add redirect-brightness to your startup applications.




redirect-brightness bash script



#!/bin/bash

# NAME: redirect-brightness
# PATH: /usr/local/bin
# DESC: Redirect to correct driver when Ubuntu is adjusting the wrong
# /sys/class/DRIVER_NAME/brightness

# DATE: June 13, 2018. Modified June 14, 2018.

# NOTE: Written for Ubuntu question:
# https://askubuntu.com/q/1045624/307523

WatchDriver="/sys/class/backlight/intel_backlight"
PatchDriver="/sys/class/backlight/intel_backlight"

# Must be running as sudo
if [[ $(id -u) != 0 ]]; then
echo >&2 "Root access required. Use: 'sudo redirect-brightness'"
exit 1
fi

# inotifywait required
type inotifywait >/dev/null 2>&1 ||
{ echo >&2 "'inotifywait' required but it's not installed. Aborting.";
echo >&2 "Use 'sudo apt install inotify-tools' to install it.'";
exit 1; }

# Was right watch driver directory name setup correctly?
if [[ ! -d $WatchDriver ]]; then
echo >&2 "Watch directory: '$WatchDriver'";
echo >&2 "does not exist. Did you spell it correctly? Aborting.'";
exit 1;
fi

# Was right patch driver directory name setup correctly?
if [[ ! -d $PatchDriver ]]; then
echo >&2 "Redirect to directory: '$PatchDriver'";
echo >&2 "does not exist. Did you spell it correctly? Aborting.'";
exit 1;
fi

# Get maximum brightness values
WatchMax=$(cat $WatchDriver/max_brightness)
PatchMax=$(cat $PatchDriver/max_brightness)

# PARM: 1="-l" or "--log-file" then write each step to log file.
fLogFile=false
if [[ $1 == "-l" ]] || [[ $1 == "--log-file" ]]; then
fLogFile=true
LogFile=/tmp/redirect-brightness.log
echo redirect-brightness LOG FILE > $LogFile
echo WatchMax: $WatchMax PatchMax: $PatchMax >> $LogFile
fi

SetBrightness () {
# Calculate watch current percentage
WatchAct=$(cat $WatchDriver/actual_brightness)
WatchPer=$(( WatchAct * 100 / WatchMax ))
[[ $fLogFile == true ]] && echo WatchAct: $WatchAct WatchPer: $WatchPer >> $LogFile
# Reverse engineer patch brightness to set
PatchAct=$(( PatchMax * WatchPer / 100 ))
echo $PatchAct | sudo tee $PatchDriver/brightness
[[ $fLogFile == true ]] && echo PatchAct: $PatchAct >> $LogFile
}

# When machine boots, set brightness to last saved value
SetBrightness

# Wait forever for user to press Fn keys adjusting brightness up/down.
while (true); do
inotifywait --event modify $WatchDriver/actual_brightness
[[ $fLogFile == true ]] &&
echo "Processing modify event in $WatchDriver/actual_brightness" >> $LogFile
SetBrightness
done




Original Answer June 11, 2018.



Work In Progress Answer



There are many nVidia users with similar problems in Ubuntu 18.04:




  • Brightness on laptop MSI GT72VR in Ubuntu 18.04 with NVIDIA GTX 1060 Mobile doesn't work

  • computer doesnt wake from suspension and couldnt change the brightness

  • Brightness control missing when using Nvidia drivers but re-appears with X.Org

  • Xubuntu 18.04: make Fn brightness keys work with /sys/class/backlight/nv_backlight/

  • How to alter backlight driver in lubuntu

  • Brightness on laptop MSI GT72VR in Ubuntu 18.04 with NVIDIA GTX 1060 Mobile doesn't work

  • NVIDIA display issue with brightness control and video playback

  • Unable to change the screen brightness

  • The brightness of laptop screen cannot be adjusted with either the buttons or the slider. Edit




Before writing a script



I can write a script to mimic changes to /acpi_video and populate /nv_backlight but before I do try this:




  • Edit /etc/default/grub.

  • Find quiet splash

  • Add behind splash: acpi_backlight=vendor

  • Save the file

  • Run sudo update-grub


According to this answer it should work for you: Xubuntu 18.04: make Fn brightness keys work with /sys/class/backlight/nv_backlight/





Wayland



Brightness doesn't work under Wayland. Make sure you aren't using it. See: The brightness of laptop screen cannot be adjusted with either the buttons or the slider. Edit






share|improve this answer


























  • The script does the work. But there is a small bug in SetBrightness (). It should be PatchAct=$(( PatchMax * WatchPer / 100 )). Thanks to the entire support.

    – boobalan
    Jun 14 '18 at 12:07






  • 1





    Unfortunately in mobile for next 10 hours. I'll test and revise tonight. Feel free to add new comments in the meantime.

    – WinEunuuchs2Unix
    Jun 14 '18 at 12:15











  • @boobalan You were right about the need to swap the watched percentage and 100 variables. I also corrected typos with nv_video (s/b nv_backlight) and extra /brightness in /brightness/brightness. If you are happy remember to click the grey check mark next to the answer. This will give others confidence to try out the script for themselves. It was fun developing this script. Thanks!

    – WinEunuuchs2Unix
    Jun 14 '18 at 23:06











  • If the script is run manually it does work. But if it is added to the startup applications, it doesn't work. I guess there is a problem with giving sudo permissions to startup applications. For your information, I gave redirect-brightness as the application command.

    – boobalan
    Jun 15 '18 at 6:31











  • There are many ways to call during startup. One is with cron. Create the file /etc/cron.d/backlight containing line 1: SHELL=/bin/sh line 2: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin line 3: @reboot root /usr/local/bin/redirect-brightness

    – WinEunuuchs2Unix
    Jun 15 '18 at 10:33
















2














Bash script redirect-brightness



Your problem is function keys to increase/decrease brightness are updating /sys/class/backlight/acpi_video0/brightness instead of /sys/class/backlight/nv_backlight/brightness



The original request was to intercept the function keys and use them to control the nv_backlight driver. The problem with this is:




  • Tricky udev scripts

  • No pop-up notification slider displaying brightness without complicated Python scripting.


The solution is to use inotify to monitor changes to acpi_video0. Then calculate the brightness percentage and apply that same percentage to nv_backlight.



In the bash script below you need to set:



WatchDriver="/sys/class/backlight/acpi_video0/brightness"
PatchDriver="/sys/class/backlight/nv_backlight/brightness"


Place the script in /usr/local/bin and make it executable using:



chmod a+x /usr/local/bin/redirect-brightness


First run the script from the command line using



redirect-brightness -l


If there is a problem check the log file using:



cat /tmp/redirect-brightness.log


If all works well add redirect-brightness to your startup applications.




redirect-brightness bash script



#!/bin/bash

# NAME: redirect-brightness
# PATH: /usr/local/bin
# DESC: Redirect to correct driver when Ubuntu is adjusting the wrong
# /sys/class/DRIVER_NAME/brightness

# DATE: June 13, 2018. Modified June 14, 2018.

# NOTE: Written for Ubuntu question:
# https://askubuntu.com/q/1045624/307523

WatchDriver="/sys/class/backlight/intel_backlight"
PatchDriver="/sys/class/backlight/intel_backlight"

# Must be running as sudo
if [[ $(id -u) != 0 ]]; then
echo >&2 "Root access required. Use: 'sudo redirect-brightness'"
exit 1
fi

# inotifywait required
type inotifywait >/dev/null 2>&1 ||
{ echo >&2 "'inotifywait' required but it's not installed. Aborting.";
echo >&2 "Use 'sudo apt install inotify-tools' to install it.'";
exit 1; }

# Was right watch driver directory name setup correctly?
if [[ ! -d $WatchDriver ]]; then
echo >&2 "Watch directory: '$WatchDriver'";
echo >&2 "does not exist. Did you spell it correctly? Aborting.'";
exit 1;
fi

# Was right patch driver directory name setup correctly?
if [[ ! -d $PatchDriver ]]; then
echo >&2 "Redirect to directory: '$PatchDriver'";
echo >&2 "does not exist. Did you spell it correctly? Aborting.'";
exit 1;
fi

# Get maximum brightness values
WatchMax=$(cat $WatchDriver/max_brightness)
PatchMax=$(cat $PatchDriver/max_brightness)

# PARM: 1="-l" or "--log-file" then write each step to log file.
fLogFile=false
if [[ $1 == "-l" ]] || [[ $1 == "--log-file" ]]; then
fLogFile=true
LogFile=/tmp/redirect-brightness.log
echo redirect-brightness LOG FILE > $LogFile
echo WatchMax: $WatchMax PatchMax: $PatchMax >> $LogFile
fi

SetBrightness () {
# Calculate watch current percentage
WatchAct=$(cat $WatchDriver/actual_brightness)
WatchPer=$(( WatchAct * 100 / WatchMax ))
[[ $fLogFile == true ]] && echo WatchAct: $WatchAct WatchPer: $WatchPer >> $LogFile
# Reverse engineer patch brightness to set
PatchAct=$(( PatchMax * WatchPer / 100 ))
echo $PatchAct | sudo tee $PatchDriver/brightness
[[ $fLogFile == true ]] && echo PatchAct: $PatchAct >> $LogFile
}

# When machine boots, set brightness to last saved value
SetBrightness

# Wait forever for user to press Fn keys adjusting brightness up/down.
while (true); do
inotifywait --event modify $WatchDriver/actual_brightness
[[ $fLogFile == true ]] &&
echo "Processing modify event in $WatchDriver/actual_brightness" >> $LogFile
SetBrightness
done




Original Answer June 11, 2018.



Work In Progress Answer



There are many nVidia users with similar problems in Ubuntu 18.04:




  • Brightness on laptop MSI GT72VR in Ubuntu 18.04 with NVIDIA GTX 1060 Mobile doesn't work

  • computer doesnt wake from suspension and couldnt change the brightness

  • Brightness control missing when using Nvidia drivers but re-appears with X.Org

  • Xubuntu 18.04: make Fn brightness keys work with /sys/class/backlight/nv_backlight/

  • How to alter backlight driver in lubuntu

  • Brightness on laptop MSI GT72VR in Ubuntu 18.04 with NVIDIA GTX 1060 Mobile doesn't work

  • NVIDIA display issue with brightness control and video playback

  • Unable to change the screen brightness

  • The brightness of laptop screen cannot be adjusted with either the buttons or the slider. Edit




Before writing a script



I can write a script to mimic changes to /acpi_video and populate /nv_backlight but before I do try this:




  • Edit /etc/default/grub.

  • Find quiet splash

  • Add behind splash: acpi_backlight=vendor

  • Save the file

  • Run sudo update-grub


According to this answer it should work for you: Xubuntu 18.04: make Fn brightness keys work with /sys/class/backlight/nv_backlight/





Wayland



Brightness doesn't work under Wayland. Make sure you aren't using it. See: The brightness of laptop screen cannot be adjusted with either the buttons or the slider. Edit






share|improve this answer


























  • The script does the work. But there is a small bug in SetBrightness (). It should be PatchAct=$(( PatchMax * WatchPer / 100 )). Thanks to the entire support.

    – boobalan
    Jun 14 '18 at 12:07






  • 1





    Unfortunately in mobile for next 10 hours. I'll test and revise tonight. Feel free to add new comments in the meantime.

    – WinEunuuchs2Unix
    Jun 14 '18 at 12:15











  • @boobalan You were right about the need to swap the watched percentage and 100 variables. I also corrected typos with nv_video (s/b nv_backlight) and extra /brightness in /brightness/brightness. If you are happy remember to click the grey check mark next to the answer. This will give others confidence to try out the script for themselves. It was fun developing this script. Thanks!

    – WinEunuuchs2Unix
    Jun 14 '18 at 23:06











  • If the script is run manually it does work. But if it is added to the startup applications, it doesn't work. I guess there is a problem with giving sudo permissions to startup applications. For your information, I gave redirect-brightness as the application command.

    – boobalan
    Jun 15 '18 at 6:31











  • There are many ways to call during startup. One is with cron. Create the file /etc/cron.d/backlight containing line 1: SHELL=/bin/sh line 2: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin line 3: @reboot root /usr/local/bin/redirect-brightness

    – WinEunuuchs2Unix
    Jun 15 '18 at 10:33














2












2








2







Bash script redirect-brightness



Your problem is function keys to increase/decrease brightness are updating /sys/class/backlight/acpi_video0/brightness instead of /sys/class/backlight/nv_backlight/brightness



The original request was to intercept the function keys and use them to control the nv_backlight driver. The problem with this is:




  • Tricky udev scripts

  • No pop-up notification slider displaying brightness without complicated Python scripting.


The solution is to use inotify to monitor changes to acpi_video0. Then calculate the brightness percentage and apply that same percentage to nv_backlight.



In the bash script below you need to set:



WatchDriver="/sys/class/backlight/acpi_video0/brightness"
PatchDriver="/sys/class/backlight/nv_backlight/brightness"


Place the script in /usr/local/bin and make it executable using:



chmod a+x /usr/local/bin/redirect-brightness


First run the script from the command line using



redirect-brightness -l


If there is a problem check the log file using:



cat /tmp/redirect-brightness.log


If all works well add redirect-brightness to your startup applications.




redirect-brightness bash script



#!/bin/bash

# NAME: redirect-brightness
# PATH: /usr/local/bin
# DESC: Redirect to correct driver when Ubuntu is adjusting the wrong
# /sys/class/DRIVER_NAME/brightness

# DATE: June 13, 2018. Modified June 14, 2018.

# NOTE: Written for Ubuntu question:
# https://askubuntu.com/q/1045624/307523

WatchDriver="/sys/class/backlight/intel_backlight"
PatchDriver="/sys/class/backlight/intel_backlight"

# Must be running as sudo
if [[ $(id -u) != 0 ]]; then
echo >&2 "Root access required. Use: 'sudo redirect-brightness'"
exit 1
fi

# inotifywait required
type inotifywait >/dev/null 2>&1 ||
{ echo >&2 "'inotifywait' required but it's not installed. Aborting.";
echo >&2 "Use 'sudo apt install inotify-tools' to install it.'";
exit 1; }

# Was right watch driver directory name setup correctly?
if [[ ! -d $WatchDriver ]]; then
echo >&2 "Watch directory: '$WatchDriver'";
echo >&2 "does not exist. Did you spell it correctly? Aborting.'";
exit 1;
fi

# Was right patch driver directory name setup correctly?
if [[ ! -d $PatchDriver ]]; then
echo >&2 "Redirect to directory: '$PatchDriver'";
echo >&2 "does not exist. Did you spell it correctly? Aborting.'";
exit 1;
fi

# Get maximum brightness values
WatchMax=$(cat $WatchDriver/max_brightness)
PatchMax=$(cat $PatchDriver/max_brightness)

# PARM: 1="-l" or "--log-file" then write each step to log file.
fLogFile=false
if [[ $1 == "-l" ]] || [[ $1 == "--log-file" ]]; then
fLogFile=true
LogFile=/tmp/redirect-brightness.log
echo redirect-brightness LOG FILE > $LogFile
echo WatchMax: $WatchMax PatchMax: $PatchMax >> $LogFile
fi

SetBrightness () {
# Calculate watch current percentage
WatchAct=$(cat $WatchDriver/actual_brightness)
WatchPer=$(( WatchAct * 100 / WatchMax ))
[[ $fLogFile == true ]] && echo WatchAct: $WatchAct WatchPer: $WatchPer >> $LogFile
# Reverse engineer patch brightness to set
PatchAct=$(( PatchMax * WatchPer / 100 ))
echo $PatchAct | sudo tee $PatchDriver/brightness
[[ $fLogFile == true ]] && echo PatchAct: $PatchAct >> $LogFile
}

# When machine boots, set brightness to last saved value
SetBrightness

# Wait forever for user to press Fn keys adjusting brightness up/down.
while (true); do
inotifywait --event modify $WatchDriver/actual_brightness
[[ $fLogFile == true ]] &&
echo "Processing modify event in $WatchDriver/actual_brightness" >> $LogFile
SetBrightness
done




Original Answer June 11, 2018.



Work In Progress Answer



There are many nVidia users with similar problems in Ubuntu 18.04:




  • Brightness on laptop MSI GT72VR in Ubuntu 18.04 with NVIDIA GTX 1060 Mobile doesn't work

  • computer doesnt wake from suspension and couldnt change the brightness

  • Brightness control missing when using Nvidia drivers but re-appears with X.Org

  • Xubuntu 18.04: make Fn brightness keys work with /sys/class/backlight/nv_backlight/

  • How to alter backlight driver in lubuntu

  • Brightness on laptop MSI GT72VR in Ubuntu 18.04 with NVIDIA GTX 1060 Mobile doesn't work

  • NVIDIA display issue with brightness control and video playback

  • Unable to change the screen brightness

  • The brightness of laptop screen cannot be adjusted with either the buttons or the slider. Edit




Before writing a script



I can write a script to mimic changes to /acpi_video and populate /nv_backlight but before I do try this:




  • Edit /etc/default/grub.

  • Find quiet splash

  • Add behind splash: acpi_backlight=vendor

  • Save the file

  • Run sudo update-grub


According to this answer it should work for you: Xubuntu 18.04: make Fn brightness keys work with /sys/class/backlight/nv_backlight/





Wayland



Brightness doesn't work under Wayland. Make sure you aren't using it. See: The brightness of laptop screen cannot be adjusted with either the buttons or the slider. Edit






share|improve this answer















Bash script redirect-brightness



Your problem is function keys to increase/decrease brightness are updating /sys/class/backlight/acpi_video0/brightness instead of /sys/class/backlight/nv_backlight/brightness



The original request was to intercept the function keys and use them to control the nv_backlight driver. The problem with this is:




  • Tricky udev scripts

  • No pop-up notification slider displaying brightness without complicated Python scripting.


The solution is to use inotify to monitor changes to acpi_video0. Then calculate the brightness percentage and apply that same percentage to nv_backlight.



In the bash script below you need to set:



WatchDriver="/sys/class/backlight/acpi_video0/brightness"
PatchDriver="/sys/class/backlight/nv_backlight/brightness"


Place the script in /usr/local/bin and make it executable using:



chmod a+x /usr/local/bin/redirect-brightness


First run the script from the command line using



redirect-brightness -l


If there is a problem check the log file using:



cat /tmp/redirect-brightness.log


If all works well add redirect-brightness to your startup applications.




redirect-brightness bash script



#!/bin/bash

# NAME: redirect-brightness
# PATH: /usr/local/bin
# DESC: Redirect to correct driver when Ubuntu is adjusting the wrong
# /sys/class/DRIVER_NAME/brightness

# DATE: June 13, 2018. Modified June 14, 2018.

# NOTE: Written for Ubuntu question:
# https://askubuntu.com/q/1045624/307523

WatchDriver="/sys/class/backlight/intel_backlight"
PatchDriver="/sys/class/backlight/intel_backlight"

# Must be running as sudo
if [[ $(id -u) != 0 ]]; then
echo >&2 "Root access required. Use: 'sudo redirect-brightness'"
exit 1
fi

# inotifywait required
type inotifywait >/dev/null 2>&1 ||
{ echo >&2 "'inotifywait' required but it's not installed. Aborting.";
echo >&2 "Use 'sudo apt install inotify-tools' to install it.'";
exit 1; }

# Was right watch driver directory name setup correctly?
if [[ ! -d $WatchDriver ]]; then
echo >&2 "Watch directory: '$WatchDriver'";
echo >&2 "does not exist. Did you spell it correctly? Aborting.'";
exit 1;
fi

# Was right patch driver directory name setup correctly?
if [[ ! -d $PatchDriver ]]; then
echo >&2 "Redirect to directory: '$PatchDriver'";
echo >&2 "does not exist. Did you spell it correctly? Aborting.'";
exit 1;
fi

# Get maximum brightness values
WatchMax=$(cat $WatchDriver/max_brightness)
PatchMax=$(cat $PatchDriver/max_brightness)

# PARM: 1="-l" or "--log-file" then write each step to log file.
fLogFile=false
if [[ $1 == "-l" ]] || [[ $1 == "--log-file" ]]; then
fLogFile=true
LogFile=/tmp/redirect-brightness.log
echo redirect-brightness LOG FILE > $LogFile
echo WatchMax: $WatchMax PatchMax: $PatchMax >> $LogFile
fi

SetBrightness () {
# Calculate watch current percentage
WatchAct=$(cat $WatchDriver/actual_brightness)
WatchPer=$(( WatchAct * 100 / WatchMax ))
[[ $fLogFile == true ]] && echo WatchAct: $WatchAct WatchPer: $WatchPer >> $LogFile
# Reverse engineer patch brightness to set
PatchAct=$(( PatchMax * WatchPer / 100 ))
echo $PatchAct | sudo tee $PatchDriver/brightness
[[ $fLogFile == true ]] && echo PatchAct: $PatchAct >> $LogFile
}

# When machine boots, set brightness to last saved value
SetBrightness

# Wait forever for user to press Fn keys adjusting brightness up/down.
while (true); do
inotifywait --event modify $WatchDriver/actual_brightness
[[ $fLogFile == true ]] &&
echo "Processing modify event in $WatchDriver/actual_brightness" >> $LogFile
SetBrightness
done




Original Answer June 11, 2018.



Work In Progress Answer



There are many nVidia users with similar problems in Ubuntu 18.04:




  • Brightness on laptop MSI GT72VR in Ubuntu 18.04 with NVIDIA GTX 1060 Mobile doesn't work

  • computer doesnt wake from suspension and couldnt change the brightness

  • Brightness control missing when using Nvidia drivers but re-appears with X.Org

  • Xubuntu 18.04: make Fn brightness keys work with /sys/class/backlight/nv_backlight/

  • How to alter backlight driver in lubuntu

  • Brightness on laptop MSI GT72VR in Ubuntu 18.04 with NVIDIA GTX 1060 Mobile doesn't work

  • NVIDIA display issue with brightness control and video playback

  • Unable to change the screen brightness

  • The brightness of laptop screen cannot be adjusted with either the buttons or the slider. Edit




Before writing a script



I can write a script to mimic changes to /acpi_video and populate /nv_backlight but before I do try this:




  • Edit /etc/default/grub.

  • Find quiet splash

  • Add behind splash: acpi_backlight=vendor

  • Save the file

  • Run sudo update-grub


According to this answer it should work for you: Xubuntu 18.04: make Fn brightness keys work with /sys/class/backlight/nv_backlight/





Wayland



Brightness doesn't work under Wayland. Make sure you aren't using it. See: The brightness of laptop screen cannot be adjusted with either the buttons or the slider. Edit







share|improve this answer














share|improve this answer



share|improve this answer








edited 9 mins ago

























answered Jun 12 '18 at 0:19









WinEunuuchs2UnixWinEunuuchs2Unix

47.3k1191183




47.3k1191183













  • The script does the work. But there is a small bug in SetBrightness (). It should be PatchAct=$(( PatchMax * WatchPer / 100 )). Thanks to the entire support.

    – boobalan
    Jun 14 '18 at 12:07






  • 1





    Unfortunately in mobile for next 10 hours. I'll test and revise tonight. Feel free to add new comments in the meantime.

    – WinEunuuchs2Unix
    Jun 14 '18 at 12:15











  • @boobalan You were right about the need to swap the watched percentage and 100 variables. I also corrected typos with nv_video (s/b nv_backlight) and extra /brightness in /brightness/brightness. If you are happy remember to click the grey check mark next to the answer. This will give others confidence to try out the script for themselves. It was fun developing this script. Thanks!

    – WinEunuuchs2Unix
    Jun 14 '18 at 23:06











  • If the script is run manually it does work. But if it is added to the startup applications, it doesn't work. I guess there is a problem with giving sudo permissions to startup applications. For your information, I gave redirect-brightness as the application command.

    – boobalan
    Jun 15 '18 at 6:31











  • There are many ways to call during startup. One is with cron. Create the file /etc/cron.d/backlight containing line 1: SHELL=/bin/sh line 2: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin line 3: @reboot root /usr/local/bin/redirect-brightness

    – WinEunuuchs2Unix
    Jun 15 '18 at 10:33



















  • The script does the work. But there is a small bug in SetBrightness (). It should be PatchAct=$(( PatchMax * WatchPer / 100 )). Thanks to the entire support.

    – boobalan
    Jun 14 '18 at 12:07






  • 1





    Unfortunately in mobile for next 10 hours. I'll test and revise tonight. Feel free to add new comments in the meantime.

    – WinEunuuchs2Unix
    Jun 14 '18 at 12:15











  • @boobalan You were right about the need to swap the watched percentage and 100 variables. I also corrected typos with nv_video (s/b nv_backlight) and extra /brightness in /brightness/brightness. If you are happy remember to click the grey check mark next to the answer. This will give others confidence to try out the script for themselves. It was fun developing this script. Thanks!

    – WinEunuuchs2Unix
    Jun 14 '18 at 23:06











  • If the script is run manually it does work. But if it is added to the startup applications, it doesn't work. I guess there is a problem with giving sudo permissions to startup applications. For your information, I gave redirect-brightness as the application command.

    – boobalan
    Jun 15 '18 at 6:31











  • There are many ways to call during startup. One is with cron. Create the file /etc/cron.d/backlight containing line 1: SHELL=/bin/sh line 2: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin line 3: @reboot root /usr/local/bin/redirect-brightness

    – WinEunuuchs2Unix
    Jun 15 '18 at 10:33

















The script does the work. But there is a small bug in SetBrightness (). It should be PatchAct=$(( PatchMax * WatchPer / 100 )). Thanks to the entire support.

– boobalan
Jun 14 '18 at 12:07





The script does the work. But there is a small bug in SetBrightness (). It should be PatchAct=$(( PatchMax * WatchPer / 100 )). Thanks to the entire support.

– boobalan
Jun 14 '18 at 12:07




1




1





Unfortunately in mobile for next 10 hours. I'll test and revise tonight. Feel free to add new comments in the meantime.

– WinEunuuchs2Unix
Jun 14 '18 at 12:15





Unfortunately in mobile for next 10 hours. I'll test and revise tonight. Feel free to add new comments in the meantime.

– WinEunuuchs2Unix
Jun 14 '18 at 12:15













@boobalan You were right about the need to swap the watched percentage and 100 variables. I also corrected typos with nv_video (s/b nv_backlight) and extra /brightness in /brightness/brightness. If you are happy remember to click the grey check mark next to the answer. This will give others confidence to try out the script for themselves. It was fun developing this script. Thanks!

– WinEunuuchs2Unix
Jun 14 '18 at 23:06





@boobalan You were right about the need to swap the watched percentage and 100 variables. I also corrected typos with nv_video (s/b nv_backlight) and extra /brightness in /brightness/brightness. If you are happy remember to click the grey check mark next to the answer. This will give others confidence to try out the script for themselves. It was fun developing this script. Thanks!

– WinEunuuchs2Unix
Jun 14 '18 at 23:06













If the script is run manually it does work. But if it is added to the startup applications, it doesn't work. I guess there is a problem with giving sudo permissions to startup applications. For your information, I gave redirect-brightness as the application command.

– boobalan
Jun 15 '18 at 6:31





If the script is run manually it does work. But if it is added to the startup applications, it doesn't work. I guess there is a problem with giving sudo permissions to startup applications. For your information, I gave redirect-brightness as the application command.

– boobalan
Jun 15 '18 at 6:31













There are many ways to call during startup. One is with cron. Create the file /etc/cron.d/backlight containing line 1: SHELL=/bin/sh line 2: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin line 3: @reboot root /usr/local/bin/redirect-brightness

– WinEunuuchs2Unix
Jun 15 '18 at 10:33





There are many ways to call during startup. One is with cron. Create the file /etc/cron.d/backlight containing line 1: SHELL=/bin/sh line 2: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin line 3: @reboot root /usr/local/bin/redirect-brightness

– WinEunuuchs2Unix
Jun 15 '18 at 10:33


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1045624%2fhow-to-switch-between-options-in-sys-class-backlight-to-solve-brightness-prob%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

List of shipwrecks in 1808...

Is there a lightweight tool to crop images quickly?Cropping Images using Command Line Tools OnlyHow to crop...

Unit packagekit.service is masked Announcing the arrival of Valued Associate #679: Cesar...