Lenovo ThinkPad X1 Yoga OLED Brightness












9















I'm running 16.04 on my X1 Yoga OLED.



I can't change the brightness of the screen at all, it seems to be on maximum brightness all the time. I've tried:





  • Fn+F5/F6


  • xbacklight -set 50(and 100, and 0, and 20, ...)/xbacklight -dec 10


I'm using GNOME Shell in Xorg.



Hopefully useful list of software and versions, tell me in the comments if you need more.



gnome-shell 3.18.5-0ubuntu0.1
tlp 0.9-1~xenial
tp-smapi 0.41-1









share|improve this question


















  • 1





    I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

    – user240891
    Apr 14 '17 at 19:42
















9















I'm running 16.04 on my X1 Yoga OLED.



I can't change the brightness of the screen at all, it seems to be on maximum brightness all the time. I've tried:





  • Fn+F5/F6


  • xbacklight -set 50(and 100, and 0, and 20, ...)/xbacklight -dec 10


I'm using GNOME Shell in Xorg.



Hopefully useful list of software and versions, tell me in the comments if you need more.



gnome-shell 3.18.5-0ubuntu0.1
tlp 0.9-1~xenial
tp-smapi 0.41-1









share|improve this question


















  • 1





    I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

    – user240891
    Apr 14 '17 at 19:42














9












9








9


6






I'm running 16.04 on my X1 Yoga OLED.



I can't change the brightness of the screen at all, it seems to be on maximum brightness all the time. I've tried:





  • Fn+F5/F6


  • xbacklight -set 50(and 100, and 0, and 20, ...)/xbacklight -dec 10


I'm using GNOME Shell in Xorg.



Hopefully useful list of software and versions, tell me in the comments if you need more.



gnome-shell 3.18.5-0ubuntu0.1
tlp 0.9-1~xenial
tp-smapi 0.41-1









share|improve this question














I'm running 16.04 on my X1 Yoga OLED.



I can't change the brightness of the screen at all, it seems to be on maximum brightness all the time. I've tried:





  • Fn+F5/F6


  • xbacklight -set 50(and 100, and 0, and 20, ...)/xbacklight -dec 10


I'm using GNOME Shell in Xorg.



Hopefully useful list of software and versions, tell me in the comments if you need more.



gnome-shell 3.18.5-0ubuntu0.1
tlp 0.9-1~xenial
tp-smapi 0.41-1






intel-graphics lenovo brightness thinkpad acpi






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 14 '16 at 18:31









joarjoar

337417




337417








  • 1





    I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

    – user240891
    Apr 14 '17 at 19:42














  • 1





    I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

    – user240891
    Apr 14 '17 at 19:42








1




1





I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

– user240891
Apr 14 '17 at 19:42





I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

– user240891
Apr 14 '17 at 19:42










5 Answers
5






active

oldest

votes


















6














There is no backlight with an OLED screen. So the normal methods do not work.
Adjust screen brightness by way of:



xrandr --output eDP1 --brightness .5  # dim to half 

xrandr --output eDP1 --brightness 1 # no dimming


the number can be anything between 0 and 1






share|improve this answer


























  • This is correct. I wonder if GNOME/driver maintainers have tackled the user interface issue of "I expect my screen to dim when I press the SUN_ICON MINUS_SIGN key." yet, and if and when it'll arrive in 16.04.

    – joar
    Nov 15 '16 at 12:05











  • I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

    – user240891
    Mar 29 '17 at 19:46








  • 1





    I just installed a new Linux Distribution and had to look up my own answer, so I found your comment. If your device is called differently, then just enter xrandr by itself. It will, among other things, output the device-name. Mine is called now: eDP-1 for example.

    – P.Meyer
    Aug 6 '17 at 17:03





















9














I've been looking for a way to run the xrandr command when pressing the brightness buttons. I created custom acpi events for that (more info on that here: https://help.ubuntu.com/community/LaptopSpecialKeys ). This is still a hack and no proper solution, but it works for me:



I created three files, /etc/acpi/events/yoga-brightness-up:



event=video/brightnessup BRTUP 00000086
action=/etc/acpi/yoga-brightness.sh up


and
/etc/acpi/events/yoga-brightness-down:



event=video/brightnessdown BRTDN 00000087
action=/etc/acpi/yoga-brightness.sh down


and finally /etc/acpi/yoga-brightness.sh:



#!/bin/sh

# Where the backlight brightness is stored
BR_DIR="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/"


test -d "$BR_DIR" || exit 0

MIN=0
MAX=$(cat "$BR_DIR/max_brightness")
VAL=$(cat "$BR_DIR/brightness")

if [ "$1" = down ]; then
VAL=$((VAL-71))
else
VAL=$((VAL+71))
fi

if [ "$VAL" -lt $MIN ]; then
VAL=$MIN
elif [ "$VAL" -gt $MAX ]; then
VAL=$MAX
fi

PERCENT=`echo "$VAL / $MAX" | bc -l`

export XAUTHORITY=/home/ivo/.Xauthority # CHANGE "ivo" TO YOUR USER
export DISPLAY=:0.0

echo "xrandr --output eDP-1 --brightness $PERCENT" > /tmp/yoga-brightness.log
xrandr --output eDP-1 --brightness $PERCENT

echo $VAL > "$BR_DIR/brightness"


which is heavily inspired by the file asus-keyboard-backlight.sh
and the information on https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/660901 for the xrandr root-access problem.



Don't forget to restart acpi by typing



sudo service acpid reload


I hope, this helps ;-)






share|improve this answer


























  • I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

    – user240891
    Apr 14 '17 at 19:42






  • 1





    I got this to work, but had to specify "eDP1" instead of "eDP-1". Also, it's worth mentioning that you need to do "chmod a+rx /etc/acpi/yoga-brightness.sh". Thanks!

    – Dan Christensen
    May 26 '17 at 22:05





















2














Smooth Brightness Control





(Update: I've uploaded the provision script to automate this to Github.)



This script is based on the workaround by Ivo Blöchliger. I'd hate for my expensive laptop to look cheap, so I need a smooth transition between brightness values to compete with my non-linux colleagues.



This is created for and tested on Linux Mint 18.3 and Ubuntu 16.04.3 on a Lenovo ThinkPad X1 Yoga (2nd Gen) with OLED panel.



/etc/acpi/events/oled-brightness-up (644):



event=video/brightnessup BRTUP 00000086
action=/etc/acpi/oled-brightness.sh up


/etc/acpi/events/oled-brightness-down (644):



event=video/brightnessdown BRTDN 00000087
action=/etc/acpi/oled-brightness.sh down


/etc/acpi/oled-brightness.sh (755):



#!/bin/bash
# Smooth brightness control
# Change "redsandro" in the line below to your username
export XAUTHORITY=/home/redsandro/.Xauthority
export DISPLAY=:0.0

OLED_BR=`xrandr --verbose | grep -i brightness | cut -f2 -d ' '`
CURR=`LC_ALL=C /usr/bin/printf "%.*f" 1 $OLED_BR`

MIN=0
MAX=1.2

if [ "$1" == "up" ]; then
VAL=`echo "scale=1; $CURR+0.1" | bc`
else
VAL=`echo "scale=1; $CURR-0.1" | bc`
fi

if (( `echo "$VAL < $MIN" | bc -l` )); then
VAL=$MIN
elif (( `echo "$VAL > $MAX" | bc -l` )); then
VAL=$MAX
else
if [ "$1" == "up" ]; then
for I in {1..10..1}; do xrandr --output eDP1 --brightness `echo "scale=2; $I/100+$CURR" | bc` 2>&1 >/dev/null | logger -t oled-brightness; done
else
for I in {1..10..1}; do xrandr --output eDP1 --brightness `echo "scale=2; $CURR-$I/100" | bc` 2>&1 >/dev/null | logger -t oled-brightness; done
fi
fi

# Set Intel backlight to fake value
# to sync OSD brightness indicator to actual brightness
INTEL_PANEL="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/"
if [ -d "$INTEL_PANEL" ]; then
PERCENT=`echo "scale=4; $VAL/$MAX" | bc -l`
INTEL_MAX=$(cat "$INTEL_PANEL/max_brightness")
INTEL_BRIGHTNESS=`echo "scale=4; $PERCENT*$INTEL_MAX" | bc -l`
INTEL_BRIGHTNESS=`LC_ALL=C /usr/bin/printf "%.*f" 0 $INTEL_BRIGHTNESS`
echo $INTEL_BRIGHTNESS > "$INTEL_PANEL/brightness"
fi


Remove any previous brightness handlers, and finally, do sudo service acpid reload






share|improve this answer





















  • 1





    You're doing the lord's work, thank you.

    – Naftuli Kay
    Dec 21 '17 at 3:52











  • I updated the script above to be a multi user capable and handle GDM xauthority location gist.github.com/jackinloadup/c98682416f0363b9a6c6d4daf13c6c32

    – user9221
    Apr 1 '18 at 5:28





















1














I did a similar thing to the above in Ubuntu MATE 17.04:





  1. cat $MYDIR/scrbr.property = 0.5 (scrbr = screen-brightness)

  2. Created a script scrbr.sh:


```



#!/bin/bash

ACTION=$1

PROP_FILE=$MYDIR/scrbr.property
BRIGHT=$(cat $PROP_FILE)

if [[ "$ACTION" == "--up" ]]; then
SYM="+"
elif [[ "$ACTION" == "--down" ]]; then
SYM="-"
fi

BRIGHT=$(echo "$BRIGHT $SYM 0.1" | bc)

# Not less than 0
[[ $BRIGHT == -* ]] && BRIGHT=0

echo $BRIGHT > $PROP_FILE

xrandr --output eDP-1 --brightness $BRIGHT



  1. Remap keys WinKey + Up to scrbr.sh --up, and same for --down.


  2. Profit.







share|improve this answer































    1














    I needed a few tweaks to make @Redsandro solution work on my ubuntu 18.10 install.



    Specifically, the Xauth root workaround doesn't work (thanks for mentioning that @Ivo B!) as the .Xauthority file no longer exists.



    Using



    $ xauth info



    We see that the file is now at
    /run/user/1000/gdm/Xauthority



    Therefore we change the relevant line to



    export XAUTHORITY=/run/user/1000/gdm/Xauthority



    Additionally, I also had to change eDP1 to eDP-1.



    In total this led to changes on three lines.





    Additional notes



    In order to debug, I used



    rui@chaiX1YG2:/var/log$ $ tail -f /var/log/syslog | grep oled-br



    e.g. for the two respective errors I found



    Jan 16 13:03:01 chaiX1YG2 oled-brightness: Can't open display :0.0
    Jan 16 13:03:01 chaiX1YG2 oled-brightness: No protocol specified


    Jan 16 13:23:46 chaiX1YG2 oled-brightness: warning: output eDP1 not found; ignoring
    Jan 16 13:23:46 chaiX1YG2 oled-brightness: xrandr: Need crtc to set gamma on.


    NOTE also, this solution does not work in wayland! As xrandr does not work on wayland. So make sure when you log in, you choose xorg, not wayland),



    (A bit unfortunate as for me, firefox touch events only works in Wayland, so I have to choose between the brightness vs firefox touchscroll. Not sure why that is yet).



    (This answer would have been a comment but I lack credits.)






    share|improve this answer































      5 Answers
      5






      active

      oldest

      votes








      5 Answers
      5






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      6














      There is no backlight with an OLED screen. So the normal methods do not work.
      Adjust screen brightness by way of:



      xrandr --output eDP1 --brightness .5  # dim to half 

      xrandr --output eDP1 --brightness 1 # no dimming


      the number can be anything between 0 and 1






      share|improve this answer


























      • This is correct. I wonder if GNOME/driver maintainers have tackled the user interface issue of "I expect my screen to dim when I press the SUN_ICON MINUS_SIGN key." yet, and if and when it'll arrive in 16.04.

        – joar
        Nov 15 '16 at 12:05











      • I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

        – user240891
        Mar 29 '17 at 19:46








      • 1





        I just installed a new Linux Distribution and had to look up my own answer, so I found your comment. If your device is called differently, then just enter xrandr by itself. It will, among other things, output the device-name. Mine is called now: eDP-1 for example.

        – P.Meyer
        Aug 6 '17 at 17:03


















      6














      There is no backlight with an OLED screen. So the normal methods do not work.
      Adjust screen brightness by way of:



      xrandr --output eDP1 --brightness .5  # dim to half 

      xrandr --output eDP1 --brightness 1 # no dimming


      the number can be anything between 0 and 1






      share|improve this answer


























      • This is correct. I wonder if GNOME/driver maintainers have tackled the user interface issue of "I expect my screen to dim when I press the SUN_ICON MINUS_SIGN key." yet, and if and when it'll arrive in 16.04.

        – joar
        Nov 15 '16 at 12:05











      • I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

        – user240891
        Mar 29 '17 at 19:46








      • 1





        I just installed a new Linux Distribution and had to look up my own answer, so I found your comment. If your device is called differently, then just enter xrandr by itself. It will, among other things, output the device-name. Mine is called now: eDP-1 for example.

        – P.Meyer
        Aug 6 '17 at 17:03
















      6












      6








      6







      There is no backlight with an OLED screen. So the normal methods do not work.
      Adjust screen brightness by way of:



      xrandr --output eDP1 --brightness .5  # dim to half 

      xrandr --output eDP1 --brightness 1 # no dimming


      the number can be anything between 0 and 1






      share|improve this answer















      There is no backlight with an OLED screen. So the normal methods do not work.
      Adjust screen brightness by way of:



      xrandr --output eDP1 --brightness .5  # dim to half 

      xrandr --output eDP1 --brightness 1 # no dimming


      the number can be anything between 0 and 1







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jun 21 '17 at 13:47









      Ravexina

      32.1k1482112




      32.1k1482112










      answered Nov 15 '16 at 9:50









      P.MeyerP.Meyer

      10112




      10112













      • This is correct. I wonder if GNOME/driver maintainers have tackled the user interface issue of "I expect my screen to dim when I press the SUN_ICON MINUS_SIGN key." yet, and if and when it'll arrive in 16.04.

        – joar
        Nov 15 '16 at 12:05











      • I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

        – user240891
        Mar 29 '17 at 19:46








      • 1





        I just installed a new Linux Distribution and had to look up my own answer, so I found your comment. If your device is called differently, then just enter xrandr by itself. It will, among other things, output the device-name. Mine is called now: eDP-1 for example.

        – P.Meyer
        Aug 6 '17 at 17:03





















      • This is correct. I wonder if GNOME/driver maintainers have tackled the user interface issue of "I expect my screen to dim when I press the SUN_ICON MINUS_SIGN key." yet, and if and when it'll arrive in 16.04.

        – joar
        Nov 15 '16 at 12:05











      • I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

        – user240891
        Mar 29 '17 at 19:46








      • 1





        I just installed a new Linux Distribution and had to look up my own answer, so I found your comment. If your device is called differently, then just enter xrandr by itself. It will, among other things, output the device-name. Mine is called now: eDP-1 for example.

        – P.Meyer
        Aug 6 '17 at 17:03



















      This is correct. I wonder if GNOME/driver maintainers have tackled the user interface issue of "I expect my screen to dim when I press the SUN_ICON MINUS_SIGN key." yet, and if and when it'll arrive in 16.04.

      – joar
      Nov 15 '16 at 12:05





      This is correct. I wonder if GNOME/driver maintainers have tackled the user interface issue of "I expect my screen to dim when I press the SUN_ICON MINUS_SIGN key." yet, and if and when it'll arrive in 16.04.

      – joar
      Nov 15 '16 at 12:05













      I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

      – user240891
      Mar 29 '17 at 19:46







      I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

      – user240891
      Mar 29 '17 at 19:46






      1




      1





      I just installed a new Linux Distribution and had to look up my own answer, so I found your comment. If your device is called differently, then just enter xrandr by itself. It will, among other things, output the device-name. Mine is called now: eDP-1 for example.

      – P.Meyer
      Aug 6 '17 at 17:03







      I just installed a new Linux Distribution and had to look up my own answer, so I found your comment. If your device is called differently, then just enter xrandr by itself. It will, among other things, output the device-name. Mine is called now: eDP-1 for example.

      – P.Meyer
      Aug 6 '17 at 17:03















      9














      I've been looking for a way to run the xrandr command when pressing the brightness buttons. I created custom acpi events for that (more info on that here: https://help.ubuntu.com/community/LaptopSpecialKeys ). This is still a hack and no proper solution, but it works for me:



      I created three files, /etc/acpi/events/yoga-brightness-up:



      event=video/brightnessup BRTUP 00000086
      action=/etc/acpi/yoga-brightness.sh up


      and
      /etc/acpi/events/yoga-brightness-down:



      event=video/brightnessdown BRTDN 00000087
      action=/etc/acpi/yoga-brightness.sh down


      and finally /etc/acpi/yoga-brightness.sh:



      #!/bin/sh

      # Where the backlight brightness is stored
      BR_DIR="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/"


      test -d "$BR_DIR" || exit 0

      MIN=0
      MAX=$(cat "$BR_DIR/max_brightness")
      VAL=$(cat "$BR_DIR/brightness")

      if [ "$1" = down ]; then
      VAL=$((VAL-71))
      else
      VAL=$((VAL+71))
      fi

      if [ "$VAL" -lt $MIN ]; then
      VAL=$MIN
      elif [ "$VAL" -gt $MAX ]; then
      VAL=$MAX
      fi

      PERCENT=`echo "$VAL / $MAX" | bc -l`

      export XAUTHORITY=/home/ivo/.Xauthority # CHANGE "ivo" TO YOUR USER
      export DISPLAY=:0.0

      echo "xrandr --output eDP-1 --brightness $PERCENT" > /tmp/yoga-brightness.log
      xrandr --output eDP-1 --brightness $PERCENT

      echo $VAL > "$BR_DIR/brightness"


      which is heavily inspired by the file asus-keyboard-backlight.sh
      and the information on https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/660901 for the xrandr root-access problem.



      Don't forget to restart acpi by typing



      sudo service acpid reload


      I hope, this helps ;-)






      share|improve this answer


























      • I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

        – user240891
        Apr 14 '17 at 19:42






      • 1





        I got this to work, but had to specify "eDP1" instead of "eDP-1". Also, it's worth mentioning that you need to do "chmod a+rx /etc/acpi/yoga-brightness.sh". Thanks!

        – Dan Christensen
        May 26 '17 at 22:05


















      9














      I've been looking for a way to run the xrandr command when pressing the brightness buttons. I created custom acpi events for that (more info on that here: https://help.ubuntu.com/community/LaptopSpecialKeys ). This is still a hack and no proper solution, but it works for me:



      I created three files, /etc/acpi/events/yoga-brightness-up:



      event=video/brightnessup BRTUP 00000086
      action=/etc/acpi/yoga-brightness.sh up


      and
      /etc/acpi/events/yoga-brightness-down:



      event=video/brightnessdown BRTDN 00000087
      action=/etc/acpi/yoga-brightness.sh down


      and finally /etc/acpi/yoga-brightness.sh:



      #!/bin/sh

      # Where the backlight brightness is stored
      BR_DIR="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/"


      test -d "$BR_DIR" || exit 0

      MIN=0
      MAX=$(cat "$BR_DIR/max_brightness")
      VAL=$(cat "$BR_DIR/brightness")

      if [ "$1" = down ]; then
      VAL=$((VAL-71))
      else
      VAL=$((VAL+71))
      fi

      if [ "$VAL" -lt $MIN ]; then
      VAL=$MIN
      elif [ "$VAL" -gt $MAX ]; then
      VAL=$MAX
      fi

      PERCENT=`echo "$VAL / $MAX" | bc -l`

      export XAUTHORITY=/home/ivo/.Xauthority # CHANGE "ivo" TO YOUR USER
      export DISPLAY=:0.0

      echo "xrandr --output eDP-1 --brightness $PERCENT" > /tmp/yoga-brightness.log
      xrandr --output eDP-1 --brightness $PERCENT

      echo $VAL > "$BR_DIR/brightness"


      which is heavily inspired by the file asus-keyboard-backlight.sh
      and the information on https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/660901 for the xrandr root-access problem.



      Don't forget to restart acpi by typing



      sudo service acpid reload


      I hope, this helps ;-)






      share|improve this answer


























      • I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

        – user240891
        Apr 14 '17 at 19:42






      • 1





        I got this to work, but had to specify "eDP1" instead of "eDP-1". Also, it's worth mentioning that you need to do "chmod a+rx /etc/acpi/yoga-brightness.sh". Thanks!

        – Dan Christensen
        May 26 '17 at 22:05
















      9












      9








      9







      I've been looking for a way to run the xrandr command when pressing the brightness buttons. I created custom acpi events for that (more info on that here: https://help.ubuntu.com/community/LaptopSpecialKeys ). This is still a hack and no proper solution, but it works for me:



      I created three files, /etc/acpi/events/yoga-brightness-up:



      event=video/brightnessup BRTUP 00000086
      action=/etc/acpi/yoga-brightness.sh up


      and
      /etc/acpi/events/yoga-brightness-down:



      event=video/brightnessdown BRTDN 00000087
      action=/etc/acpi/yoga-brightness.sh down


      and finally /etc/acpi/yoga-brightness.sh:



      #!/bin/sh

      # Where the backlight brightness is stored
      BR_DIR="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/"


      test -d "$BR_DIR" || exit 0

      MIN=0
      MAX=$(cat "$BR_DIR/max_brightness")
      VAL=$(cat "$BR_DIR/brightness")

      if [ "$1" = down ]; then
      VAL=$((VAL-71))
      else
      VAL=$((VAL+71))
      fi

      if [ "$VAL" -lt $MIN ]; then
      VAL=$MIN
      elif [ "$VAL" -gt $MAX ]; then
      VAL=$MAX
      fi

      PERCENT=`echo "$VAL / $MAX" | bc -l`

      export XAUTHORITY=/home/ivo/.Xauthority # CHANGE "ivo" TO YOUR USER
      export DISPLAY=:0.0

      echo "xrandr --output eDP-1 --brightness $PERCENT" > /tmp/yoga-brightness.log
      xrandr --output eDP-1 --brightness $PERCENT

      echo $VAL > "$BR_DIR/brightness"


      which is heavily inspired by the file asus-keyboard-backlight.sh
      and the information on https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/660901 for the xrandr root-access problem.



      Don't forget to restart acpi by typing



      sudo service acpid reload


      I hope, this helps ;-)






      share|improve this answer















      I've been looking for a way to run the xrandr command when pressing the brightness buttons. I created custom acpi events for that (more info on that here: https://help.ubuntu.com/community/LaptopSpecialKeys ). This is still a hack and no proper solution, but it works for me:



      I created three files, /etc/acpi/events/yoga-brightness-up:



      event=video/brightnessup BRTUP 00000086
      action=/etc/acpi/yoga-brightness.sh up


      and
      /etc/acpi/events/yoga-brightness-down:



      event=video/brightnessdown BRTDN 00000087
      action=/etc/acpi/yoga-brightness.sh down


      and finally /etc/acpi/yoga-brightness.sh:



      #!/bin/sh

      # Where the backlight brightness is stored
      BR_DIR="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/"


      test -d "$BR_DIR" || exit 0

      MIN=0
      MAX=$(cat "$BR_DIR/max_brightness")
      VAL=$(cat "$BR_DIR/brightness")

      if [ "$1" = down ]; then
      VAL=$((VAL-71))
      else
      VAL=$((VAL+71))
      fi

      if [ "$VAL" -lt $MIN ]; then
      VAL=$MIN
      elif [ "$VAL" -gt $MAX ]; then
      VAL=$MAX
      fi

      PERCENT=`echo "$VAL / $MAX" | bc -l`

      export XAUTHORITY=/home/ivo/.Xauthority # CHANGE "ivo" TO YOUR USER
      export DISPLAY=:0.0

      echo "xrandr --output eDP-1 --brightness $PERCENT" > /tmp/yoga-brightness.log
      xrandr --output eDP-1 --brightness $PERCENT

      echo $VAL > "$BR_DIR/brightness"


      which is heavily inspired by the file asus-keyboard-backlight.sh
      and the information on https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/660901 for the xrandr root-access problem.



      Don't forget to restart acpi by typing



      sudo service acpid reload


      I hope, this helps ;-)







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Dec 21 '16 at 14:13









      Elder Geek

      26.7k953127




      26.7k953127










      answered Dec 20 '16 at 7:39









      Ivo BlöchligerIvo Blöchliger

      9112




      9112













      • I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

        – user240891
        Apr 14 '17 at 19:42






      • 1





        I got this to work, but had to specify "eDP1" instead of "eDP-1". Also, it's worth mentioning that you need to do "chmod a+rx /etc/acpi/yoga-brightness.sh". Thanks!

        – Dan Christensen
        May 26 '17 at 22:05





















      • I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

        – user240891
        Apr 14 '17 at 19:42






      • 1





        I got this to work, but had to specify "eDP1" instead of "eDP-1". Also, it's worth mentioning that you need to do "chmod a+rx /etc/acpi/yoga-brightness.sh". Thanks!

        – Dan Christensen
        May 26 '17 at 22:05



















      I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

      – user240891
      Apr 14 '17 at 19:42





      I have the same laptop and the same problem, tried this method but I get: xrandr --output eDP1 --brightness .5 warning: output eDP1 not found; ignoring xrandr: Need crtc to set gamma on.

      – user240891
      Apr 14 '17 at 19:42




      1




      1





      I got this to work, but had to specify "eDP1" instead of "eDP-1". Also, it's worth mentioning that you need to do "chmod a+rx /etc/acpi/yoga-brightness.sh". Thanks!

      – Dan Christensen
      May 26 '17 at 22:05







      I got this to work, but had to specify "eDP1" instead of "eDP-1". Also, it's worth mentioning that you need to do "chmod a+rx /etc/acpi/yoga-brightness.sh". Thanks!

      – Dan Christensen
      May 26 '17 at 22:05













      2














      Smooth Brightness Control





      (Update: I've uploaded the provision script to automate this to Github.)



      This script is based on the workaround by Ivo Blöchliger. I'd hate for my expensive laptop to look cheap, so I need a smooth transition between brightness values to compete with my non-linux colleagues.



      This is created for and tested on Linux Mint 18.3 and Ubuntu 16.04.3 on a Lenovo ThinkPad X1 Yoga (2nd Gen) with OLED panel.



      /etc/acpi/events/oled-brightness-up (644):



      event=video/brightnessup BRTUP 00000086
      action=/etc/acpi/oled-brightness.sh up


      /etc/acpi/events/oled-brightness-down (644):



      event=video/brightnessdown BRTDN 00000087
      action=/etc/acpi/oled-brightness.sh down


      /etc/acpi/oled-brightness.sh (755):



      #!/bin/bash
      # Smooth brightness control
      # Change "redsandro" in the line below to your username
      export XAUTHORITY=/home/redsandro/.Xauthority
      export DISPLAY=:0.0

      OLED_BR=`xrandr --verbose | grep -i brightness | cut -f2 -d ' '`
      CURR=`LC_ALL=C /usr/bin/printf "%.*f" 1 $OLED_BR`

      MIN=0
      MAX=1.2

      if [ "$1" == "up" ]; then
      VAL=`echo "scale=1; $CURR+0.1" | bc`
      else
      VAL=`echo "scale=1; $CURR-0.1" | bc`
      fi

      if (( `echo "$VAL < $MIN" | bc -l` )); then
      VAL=$MIN
      elif (( `echo "$VAL > $MAX" | bc -l` )); then
      VAL=$MAX
      else
      if [ "$1" == "up" ]; then
      for I in {1..10..1}; do xrandr --output eDP1 --brightness `echo "scale=2; $I/100+$CURR" | bc` 2>&1 >/dev/null | logger -t oled-brightness; done
      else
      for I in {1..10..1}; do xrandr --output eDP1 --brightness `echo "scale=2; $CURR-$I/100" | bc` 2>&1 >/dev/null | logger -t oled-brightness; done
      fi
      fi

      # Set Intel backlight to fake value
      # to sync OSD brightness indicator to actual brightness
      INTEL_PANEL="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/"
      if [ -d "$INTEL_PANEL" ]; then
      PERCENT=`echo "scale=4; $VAL/$MAX" | bc -l`
      INTEL_MAX=$(cat "$INTEL_PANEL/max_brightness")
      INTEL_BRIGHTNESS=`echo "scale=4; $PERCENT*$INTEL_MAX" | bc -l`
      INTEL_BRIGHTNESS=`LC_ALL=C /usr/bin/printf "%.*f" 0 $INTEL_BRIGHTNESS`
      echo $INTEL_BRIGHTNESS > "$INTEL_PANEL/brightness"
      fi


      Remove any previous brightness handlers, and finally, do sudo service acpid reload






      share|improve this answer





















      • 1





        You're doing the lord's work, thank you.

        – Naftuli Kay
        Dec 21 '17 at 3:52











      • I updated the script above to be a multi user capable and handle GDM xauthority location gist.github.com/jackinloadup/c98682416f0363b9a6c6d4daf13c6c32

        – user9221
        Apr 1 '18 at 5:28


















      2














      Smooth Brightness Control





      (Update: I've uploaded the provision script to automate this to Github.)



      This script is based on the workaround by Ivo Blöchliger. I'd hate for my expensive laptop to look cheap, so I need a smooth transition between brightness values to compete with my non-linux colleagues.



      This is created for and tested on Linux Mint 18.3 and Ubuntu 16.04.3 on a Lenovo ThinkPad X1 Yoga (2nd Gen) with OLED panel.



      /etc/acpi/events/oled-brightness-up (644):



      event=video/brightnessup BRTUP 00000086
      action=/etc/acpi/oled-brightness.sh up


      /etc/acpi/events/oled-brightness-down (644):



      event=video/brightnessdown BRTDN 00000087
      action=/etc/acpi/oled-brightness.sh down


      /etc/acpi/oled-brightness.sh (755):



      #!/bin/bash
      # Smooth brightness control
      # Change "redsandro" in the line below to your username
      export XAUTHORITY=/home/redsandro/.Xauthority
      export DISPLAY=:0.0

      OLED_BR=`xrandr --verbose | grep -i brightness | cut -f2 -d ' '`
      CURR=`LC_ALL=C /usr/bin/printf "%.*f" 1 $OLED_BR`

      MIN=0
      MAX=1.2

      if [ "$1" == "up" ]; then
      VAL=`echo "scale=1; $CURR+0.1" | bc`
      else
      VAL=`echo "scale=1; $CURR-0.1" | bc`
      fi

      if (( `echo "$VAL < $MIN" | bc -l` )); then
      VAL=$MIN
      elif (( `echo "$VAL > $MAX" | bc -l` )); then
      VAL=$MAX
      else
      if [ "$1" == "up" ]; then
      for I in {1..10..1}; do xrandr --output eDP1 --brightness `echo "scale=2; $I/100+$CURR" | bc` 2>&1 >/dev/null | logger -t oled-brightness; done
      else
      for I in {1..10..1}; do xrandr --output eDP1 --brightness `echo "scale=2; $CURR-$I/100" | bc` 2>&1 >/dev/null | logger -t oled-brightness; done
      fi
      fi

      # Set Intel backlight to fake value
      # to sync OSD brightness indicator to actual brightness
      INTEL_PANEL="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/"
      if [ -d "$INTEL_PANEL" ]; then
      PERCENT=`echo "scale=4; $VAL/$MAX" | bc -l`
      INTEL_MAX=$(cat "$INTEL_PANEL/max_brightness")
      INTEL_BRIGHTNESS=`echo "scale=4; $PERCENT*$INTEL_MAX" | bc -l`
      INTEL_BRIGHTNESS=`LC_ALL=C /usr/bin/printf "%.*f" 0 $INTEL_BRIGHTNESS`
      echo $INTEL_BRIGHTNESS > "$INTEL_PANEL/brightness"
      fi


      Remove any previous brightness handlers, and finally, do sudo service acpid reload






      share|improve this answer





















      • 1





        You're doing the lord's work, thank you.

        – Naftuli Kay
        Dec 21 '17 at 3:52











      • I updated the script above to be a multi user capable and handle GDM xauthority location gist.github.com/jackinloadup/c98682416f0363b9a6c6d4daf13c6c32

        – user9221
        Apr 1 '18 at 5:28
















      2












      2








      2







      Smooth Brightness Control





      (Update: I've uploaded the provision script to automate this to Github.)



      This script is based on the workaround by Ivo Blöchliger. I'd hate for my expensive laptop to look cheap, so I need a smooth transition between brightness values to compete with my non-linux colleagues.



      This is created for and tested on Linux Mint 18.3 and Ubuntu 16.04.3 on a Lenovo ThinkPad X1 Yoga (2nd Gen) with OLED panel.



      /etc/acpi/events/oled-brightness-up (644):



      event=video/brightnessup BRTUP 00000086
      action=/etc/acpi/oled-brightness.sh up


      /etc/acpi/events/oled-brightness-down (644):



      event=video/brightnessdown BRTDN 00000087
      action=/etc/acpi/oled-brightness.sh down


      /etc/acpi/oled-brightness.sh (755):



      #!/bin/bash
      # Smooth brightness control
      # Change "redsandro" in the line below to your username
      export XAUTHORITY=/home/redsandro/.Xauthority
      export DISPLAY=:0.0

      OLED_BR=`xrandr --verbose | grep -i brightness | cut -f2 -d ' '`
      CURR=`LC_ALL=C /usr/bin/printf "%.*f" 1 $OLED_BR`

      MIN=0
      MAX=1.2

      if [ "$1" == "up" ]; then
      VAL=`echo "scale=1; $CURR+0.1" | bc`
      else
      VAL=`echo "scale=1; $CURR-0.1" | bc`
      fi

      if (( `echo "$VAL < $MIN" | bc -l` )); then
      VAL=$MIN
      elif (( `echo "$VAL > $MAX" | bc -l` )); then
      VAL=$MAX
      else
      if [ "$1" == "up" ]; then
      for I in {1..10..1}; do xrandr --output eDP1 --brightness `echo "scale=2; $I/100+$CURR" | bc` 2>&1 >/dev/null | logger -t oled-brightness; done
      else
      for I in {1..10..1}; do xrandr --output eDP1 --brightness `echo "scale=2; $CURR-$I/100" | bc` 2>&1 >/dev/null | logger -t oled-brightness; done
      fi
      fi

      # Set Intel backlight to fake value
      # to sync OSD brightness indicator to actual brightness
      INTEL_PANEL="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/"
      if [ -d "$INTEL_PANEL" ]; then
      PERCENT=`echo "scale=4; $VAL/$MAX" | bc -l`
      INTEL_MAX=$(cat "$INTEL_PANEL/max_brightness")
      INTEL_BRIGHTNESS=`echo "scale=4; $PERCENT*$INTEL_MAX" | bc -l`
      INTEL_BRIGHTNESS=`LC_ALL=C /usr/bin/printf "%.*f" 0 $INTEL_BRIGHTNESS`
      echo $INTEL_BRIGHTNESS > "$INTEL_PANEL/brightness"
      fi


      Remove any previous brightness handlers, and finally, do sudo service acpid reload






      share|improve this answer















      Smooth Brightness Control





      (Update: I've uploaded the provision script to automate this to Github.)



      This script is based on the workaround by Ivo Blöchliger. I'd hate for my expensive laptop to look cheap, so I need a smooth transition between brightness values to compete with my non-linux colleagues.



      This is created for and tested on Linux Mint 18.3 and Ubuntu 16.04.3 on a Lenovo ThinkPad X1 Yoga (2nd Gen) with OLED panel.



      /etc/acpi/events/oled-brightness-up (644):



      event=video/brightnessup BRTUP 00000086
      action=/etc/acpi/oled-brightness.sh up


      /etc/acpi/events/oled-brightness-down (644):



      event=video/brightnessdown BRTDN 00000087
      action=/etc/acpi/oled-brightness.sh down


      /etc/acpi/oled-brightness.sh (755):



      #!/bin/bash
      # Smooth brightness control
      # Change "redsandro" in the line below to your username
      export XAUTHORITY=/home/redsandro/.Xauthority
      export DISPLAY=:0.0

      OLED_BR=`xrandr --verbose | grep -i brightness | cut -f2 -d ' '`
      CURR=`LC_ALL=C /usr/bin/printf "%.*f" 1 $OLED_BR`

      MIN=0
      MAX=1.2

      if [ "$1" == "up" ]; then
      VAL=`echo "scale=1; $CURR+0.1" | bc`
      else
      VAL=`echo "scale=1; $CURR-0.1" | bc`
      fi

      if (( `echo "$VAL < $MIN" | bc -l` )); then
      VAL=$MIN
      elif (( `echo "$VAL > $MAX" | bc -l` )); then
      VAL=$MAX
      else
      if [ "$1" == "up" ]; then
      for I in {1..10..1}; do xrandr --output eDP1 --brightness `echo "scale=2; $I/100+$CURR" | bc` 2>&1 >/dev/null | logger -t oled-brightness; done
      else
      for I in {1..10..1}; do xrandr --output eDP1 --brightness `echo "scale=2; $CURR-$I/100" | bc` 2>&1 >/dev/null | logger -t oled-brightness; done
      fi
      fi

      # Set Intel backlight to fake value
      # to sync OSD brightness indicator to actual brightness
      INTEL_PANEL="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight/"
      if [ -d "$INTEL_PANEL" ]; then
      PERCENT=`echo "scale=4; $VAL/$MAX" | bc -l`
      INTEL_MAX=$(cat "$INTEL_PANEL/max_brightness")
      INTEL_BRIGHTNESS=`echo "scale=4; $PERCENT*$INTEL_MAX" | bc -l`
      INTEL_BRIGHTNESS=`LC_ALL=C /usr/bin/printf "%.*f" 0 $INTEL_BRIGHTNESS`
      echo $INTEL_BRIGHTNESS > "$INTEL_PANEL/brightness"
      fi


      Remove any previous brightness handlers, and finally, do sudo service acpid reload







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Nov 30 '17 at 13:07

























      answered Nov 28 '17 at 17:49









      RedsandroRedsandro

      1,73452033




      1,73452033








      • 1





        You're doing the lord's work, thank you.

        – Naftuli Kay
        Dec 21 '17 at 3:52











      • I updated the script above to be a multi user capable and handle GDM xauthority location gist.github.com/jackinloadup/c98682416f0363b9a6c6d4daf13c6c32

        – user9221
        Apr 1 '18 at 5:28
















      • 1





        You're doing the lord's work, thank you.

        – Naftuli Kay
        Dec 21 '17 at 3:52











      • I updated the script above to be a multi user capable and handle GDM xauthority location gist.github.com/jackinloadup/c98682416f0363b9a6c6d4daf13c6c32

        – user9221
        Apr 1 '18 at 5:28










      1




      1





      You're doing the lord's work, thank you.

      – Naftuli Kay
      Dec 21 '17 at 3:52





      You're doing the lord's work, thank you.

      – Naftuli Kay
      Dec 21 '17 at 3:52













      I updated the script above to be a multi user capable and handle GDM xauthority location gist.github.com/jackinloadup/c98682416f0363b9a6c6d4daf13c6c32

      – user9221
      Apr 1 '18 at 5:28







      I updated the script above to be a multi user capable and handle GDM xauthority location gist.github.com/jackinloadup/c98682416f0363b9a6c6d4daf13c6c32

      – user9221
      Apr 1 '18 at 5:28













      1














      I did a similar thing to the above in Ubuntu MATE 17.04:





      1. cat $MYDIR/scrbr.property = 0.5 (scrbr = screen-brightness)

      2. Created a script scrbr.sh:


      ```



      #!/bin/bash

      ACTION=$1

      PROP_FILE=$MYDIR/scrbr.property
      BRIGHT=$(cat $PROP_FILE)

      if [[ "$ACTION" == "--up" ]]; then
      SYM="+"
      elif [[ "$ACTION" == "--down" ]]; then
      SYM="-"
      fi

      BRIGHT=$(echo "$BRIGHT $SYM 0.1" | bc)

      # Not less than 0
      [[ $BRIGHT == -* ]] && BRIGHT=0

      echo $BRIGHT > $PROP_FILE

      xrandr --output eDP-1 --brightness $BRIGHT



      1. Remap keys WinKey + Up to scrbr.sh --up, and same for --down.


      2. Profit.







      share|improve this answer




























        1














        I did a similar thing to the above in Ubuntu MATE 17.04:





        1. cat $MYDIR/scrbr.property = 0.5 (scrbr = screen-brightness)

        2. Created a script scrbr.sh:


        ```



        #!/bin/bash

        ACTION=$1

        PROP_FILE=$MYDIR/scrbr.property
        BRIGHT=$(cat $PROP_FILE)

        if [[ "$ACTION" == "--up" ]]; then
        SYM="+"
        elif [[ "$ACTION" == "--down" ]]; then
        SYM="-"
        fi

        BRIGHT=$(echo "$BRIGHT $SYM 0.1" | bc)

        # Not less than 0
        [[ $BRIGHT == -* ]] && BRIGHT=0

        echo $BRIGHT > $PROP_FILE

        xrandr --output eDP-1 --brightness $BRIGHT



        1. Remap keys WinKey + Up to scrbr.sh --up, and same for --down.


        2. Profit.







        share|improve this answer


























          1












          1








          1







          I did a similar thing to the above in Ubuntu MATE 17.04:





          1. cat $MYDIR/scrbr.property = 0.5 (scrbr = screen-brightness)

          2. Created a script scrbr.sh:


          ```



          #!/bin/bash

          ACTION=$1

          PROP_FILE=$MYDIR/scrbr.property
          BRIGHT=$(cat $PROP_FILE)

          if [[ "$ACTION" == "--up" ]]; then
          SYM="+"
          elif [[ "$ACTION" == "--down" ]]; then
          SYM="-"
          fi

          BRIGHT=$(echo "$BRIGHT $SYM 0.1" | bc)

          # Not less than 0
          [[ $BRIGHT == -* ]] && BRIGHT=0

          echo $BRIGHT > $PROP_FILE

          xrandr --output eDP-1 --brightness $BRIGHT



          1. Remap keys WinKey + Up to scrbr.sh --up, and same for --down.


          2. Profit.







          share|improve this answer













          I did a similar thing to the above in Ubuntu MATE 17.04:





          1. cat $MYDIR/scrbr.property = 0.5 (scrbr = screen-brightness)

          2. Created a script scrbr.sh:


          ```



          #!/bin/bash

          ACTION=$1

          PROP_FILE=$MYDIR/scrbr.property
          BRIGHT=$(cat $PROP_FILE)

          if [[ "$ACTION" == "--up" ]]; then
          SYM="+"
          elif [[ "$ACTION" == "--down" ]]; then
          SYM="-"
          fi

          BRIGHT=$(echo "$BRIGHT $SYM 0.1" | bc)

          # Not less than 0
          [[ $BRIGHT == -* ]] && BRIGHT=0

          echo $BRIGHT > $PROP_FILE

          xrandr --output eDP-1 --brightness $BRIGHT



          1. Remap keys WinKey + Up to scrbr.sh --up, and same for --down.


          2. Profit.








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 12 '17 at 2:22









          vivrivivri

          1112




          1112























              1














              I needed a few tweaks to make @Redsandro solution work on my ubuntu 18.10 install.



              Specifically, the Xauth root workaround doesn't work (thanks for mentioning that @Ivo B!) as the .Xauthority file no longer exists.



              Using



              $ xauth info



              We see that the file is now at
              /run/user/1000/gdm/Xauthority



              Therefore we change the relevant line to



              export XAUTHORITY=/run/user/1000/gdm/Xauthority



              Additionally, I also had to change eDP1 to eDP-1.



              In total this led to changes on three lines.





              Additional notes



              In order to debug, I used



              rui@chaiX1YG2:/var/log$ $ tail -f /var/log/syslog | grep oled-br



              e.g. for the two respective errors I found



              Jan 16 13:03:01 chaiX1YG2 oled-brightness: Can't open display :0.0
              Jan 16 13:03:01 chaiX1YG2 oled-brightness: No protocol specified


              Jan 16 13:23:46 chaiX1YG2 oled-brightness: warning: output eDP1 not found; ignoring
              Jan 16 13:23:46 chaiX1YG2 oled-brightness: xrandr: Need crtc to set gamma on.


              NOTE also, this solution does not work in wayland! As xrandr does not work on wayland. So make sure when you log in, you choose xorg, not wayland),



              (A bit unfortunate as for me, firefox touch events only works in Wayland, so I have to choose between the brightness vs firefox touchscroll. Not sure why that is yet).



              (This answer would have been a comment but I lack credits.)






              share|improve this answer




























                1














                I needed a few tweaks to make @Redsandro solution work on my ubuntu 18.10 install.



                Specifically, the Xauth root workaround doesn't work (thanks for mentioning that @Ivo B!) as the .Xauthority file no longer exists.



                Using



                $ xauth info



                We see that the file is now at
                /run/user/1000/gdm/Xauthority



                Therefore we change the relevant line to



                export XAUTHORITY=/run/user/1000/gdm/Xauthority



                Additionally, I also had to change eDP1 to eDP-1.



                In total this led to changes on three lines.





                Additional notes



                In order to debug, I used



                rui@chaiX1YG2:/var/log$ $ tail -f /var/log/syslog | grep oled-br



                e.g. for the two respective errors I found



                Jan 16 13:03:01 chaiX1YG2 oled-brightness: Can't open display :0.0
                Jan 16 13:03:01 chaiX1YG2 oled-brightness: No protocol specified


                Jan 16 13:23:46 chaiX1YG2 oled-brightness: warning: output eDP1 not found; ignoring
                Jan 16 13:23:46 chaiX1YG2 oled-brightness: xrandr: Need crtc to set gamma on.


                NOTE also, this solution does not work in wayland! As xrandr does not work on wayland. So make sure when you log in, you choose xorg, not wayland),



                (A bit unfortunate as for me, firefox touch events only works in Wayland, so I have to choose between the brightness vs firefox touchscroll. Not sure why that is yet).



                (This answer would have been a comment but I lack credits.)






                share|improve this answer


























                  1












                  1








                  1







                  I needed a few tweaks to make @Redsandro solution work on my ubuntu 18.10 install.



                  Specifically, the Xauth root workaround doesn't work (thanks for mentioning that @Ivo B!) as the .Xauthority file no longer exists.



                  Using



                  $ xauth info



                  We see that the file is now at
                  /run/user/1000/gdm/Xauthority



                  Therefore we change the relevant line to



                  export XAUTHORITY=/run/user/1000/gdm/Xauthority



                  Additionally, I also had to change eDP1 to eDP-1.



                  In total this led to changes on three lines.





                  Additional notes



                  In order to debug, I used



                  rui@chaiX1YG2:/var/log$ $ tail -f /var/log/syslog | grep oled-br



                  e.g. for the two respective errors I found



                  Jan 16 13:03:01 chaiX1YG2 oled-brightness: Can't open display :0.0
                  Jan 16 13:03:01 chaiX1YG2 oled-brightness: No protocol specified


                  Jan 16 13:23:46 chaiX1YG2 oled-brightness: warning: output eDP1 not found; ignoring
                  Jan 16 13:23:46 chaiX1YG2 oled-brightness: xrandr: Need crtc to set gamma on.


                  NOTE also, this solution does not work in wayland! As xrandr does not work on wayland. So make sure when you log in, you choose xorg, not wayland),



                  (A bit unfortunate as for me, firefox touch events only works in Wayland, so I have to choose between the brightness vs firefox touchscroll. Not sure why that is yet).



                  (This answer would have been a comment but I lack credits.)






                  share|improve this answer













                  I needed a few tweaks to make @Redsandro solution work on my ubuntu 18.10 install.



                  Specifically, the Xauth root workaround doesn't work (thanks for mentioning that @Ivo B!) as the .Xauthority file no longer exists.



                  Using



                  $ xauth info



                  We see that the file is now at
                  /run/user/1000/gdm/Xauthority



                  Therefore we change the relevant line to



                  export XAUTHORITY=/run/user/1000/gdm/Xauthority



                  Additionally, I also had to change eDP1 to eDP-1.



                  In total this led to changes on three lines.





                  Additional notes



                  In order to debug, I used



                  rui@chaiX1YG2:/var/log$ $ tail -f /var/log/syslog | grep oled-br



                  e.g. for the two respective errors I found



                  Jan 16 13:03:01 chaiX1YG2 oled-brightness: Can't open display :0.0
                  Jan 16 13:03:01 chaiX1YG2 oled-brightness: No protocol specified


                  Jan 16 13:23:46 chaiX1YG2 oled-brightness: warning: output eDP1 not found; ignoring
                  Jan 16 13:23:46 chaiX1YG2 oled-brightness: xrandr: Need crtc to set gamma on.


                  NOTE also, this solution does not work in wayland! As xrandr does not work on wayland. So make sure when you log in, you choose xorg, not wayland),



                  (A bit unfortunate as for me, firefox touch events only works in Wayland, so I have to choose between the brightness vs firefox touchscroll. Not sure why that is yet).



                  (This answer would have been a comment but I lack credits.)







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 16 at 18:31









                  orangenarwhalsorangenarwhals

                  588




                  588















                      Popular posts from this blog

                      How to make a Squid Proxy server?

                      Is this a new Fibonacci Identity?

                      19世紀