grub bootloader trick doesn't work

7 Antworten [Letzter Beitrag]
andrew.comly
Offline
Beigetreten: 01/03/2017

I encounter a brightness issue on a newly installed trisquel7.0, my stats:
uname -a
Linux a-X200MA 3.13.0-110-lowlatency #157+7.0trisquel2 SMP PREEMPT Wed Feb 22 18:10:01 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Attempt 01:
/etc/default/grub
change the line:
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomdmonddf nomdmonisw"
to:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"
sudo update-grub2
sudo reboot
{fail}

Attempt 02:
xbacklight -dec 10
{fail}

Attempt 03:
xrandr
not installed and
sudo apt-get install -y xrandr
only yields
Package xrandr is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
x11-xserver-utils:i386 x11-xserver-utils
{fail}
With my amd64 architecture it is kind of strange that "x11-xserver-utils:i386 x11-xserver-utils" would be suggested by the system.

Attempt 04:
sudo apt-get install -y x11-xserver-utils
Unpacking x11-xserver-utils (7.7+2ubuntu1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up x11-xserver-utils (7.7+2ubuntu1) ...
a@a-X200MA:/usr/local/bin$ x11-xserver-utilsbash: x11-xserver-utils: command not found

Attempt05:
sudo sed "s/\(GRUB_CMDLINE_LINUX=\)\"\"/\1\"acpi_­osi=Linux acpi_backlight=vendor\"/" /etc/default/grub -i && sudo update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
sudo update-grub2
sudo reboot

andrew.comly
Offline
Beigetreten: 01/03/2017

This is really weird, why can't I edit my post to finish about what happened after the last boot???

Anyway, after Attempt 05, again, just like the previous attempts, no positive results. I can't see the screen at all in the day and it's WAY too bright in the night.

SuperTramp83

I am a translator!

Offline
Beigetreten: 10/31/2014

You can not edit the post, only the comments to the post (until someone comments on the comment).

I have screen brightness issues on my older lappy. Basically this old, very old lappy would reset the brightness to the lowest setting each time it rebooted. What I did to fix it is this ->

sudo mousepad /etc/rc.local

(I'm on Xfce, hence mousepad. You will have 'gedit')

Add the liner:

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

which in my specific case is actually:

echo 15 > /sys/class/backlight/acer-wmi/brightness

Notice that 15 is the max value of this particular monitor.
Hope this gives you some hint..

andrew.comly
Offline
Beigetreten: 01/03/2017

Interesting that you should mention it, there is a folder /sys/class/backlight/asus-nb-wmi/ that I didn't notice before. I tried:
echo 100 >/sys/class/backlight/asus-nb-wmi/brightness
{nothing}

But what worked for me was:
cat /sys/class/backlight/intel_backlight/brightness
7182
# echo 95 >/sys/class/backlight/intel_backlight/brightness

marioxcc
Offline
Beigetreten: 08/13/2014

I use "xbacklight" to change the amplification of my screen.

I have the following code in my ".bashrc" file:

function light () {
    if [ $# == 1 ]; then
        xbacklight -steps 1 -set $1
    elif [ $# == 0 ]; then
        xbacklight
    fi
}

I can then enter "light" to see the current level or "light 50" (for example) to set it.

andrew.comly
Offline
Beigetreten: 01/03/2017

Interesting idea: make a user function and place it in .bashrc!

I tried:
xbacklight -steps 1 -set 75
a@a-X200MA:~$ xbacklight -set 75
a@a-X200MA:~$ xbacklight -dec -30
a@a-X200MA:~$ type xbacklight
xbacklight is hashed (/usr/bin/xbacklight)
{no effect}

With no effect, I am thinking that maybe the ASUS X200MA uses a monitor(screen) that is one of those hard-core proprietary only screens that is totally non-compliant with Free-software. I have xbacklight installed, but it doesn't do anything.

I simply don't remember having this problem in Lubuntu 14.04 LTS.

andrew.comly
Offline
Beigetreten: 01/03/2017

I would like to use the above in a root daemon, but I noticed that my old root daemon that worked in Lubuntu 14.04 LTS didn't work when I pasted it into the special file that you just mentioned: /etc/rc.local (before the exit 0). Is there any reason why it doesn't work in Trisquel 7.0?

My root daemon:
#!/bin/sh -e

while true
do
echo "$(cat /home/a/dim_value)" > /sys/class/backlight/intel_backlight/brightness
sleep 5
done

exit 0

{This way is convenient since all I have to do is execute a script (non-sudo) to change the value in /home/a/dim_value, and the root daemon will echo whatever the contents of this file is into /sys/class/backlight/intel_backlight/brightness. In Lubuntu 14.04 it worked prefectly. }

ADFENO
Offline
Beigetreten: 12/31/2012

For the brightness shortcut keys to work, I generally do the following:

1. Run acpi_listen

2. Use the problematic key.

3. Watch output of acpi_listen, we want the first new line that pops up,
and first part before the space unless it says "hotkey" (in which case
we would like the full line).

4. Take note of the interesting part of the message.

5. Press Ctrl + C (terminating acpi_listen).

6. As root, make a shell script in "/etc/acpi", I choose
"acpi-to-nouveau-backlight-brightness.sh", any name is enough, but you
have to remember your custom name later on:

$ sudo nano "/etc/acpi/acpi-to-nouveau-backlight-brightness.sh"

7. Here is the content of my shell script, the things that you will
probably want to change are the ones related to Nouveau (and "nv_"
variables):

# Begin of file
#!/bin/bash

# acpi-to-nouveau-backlight-brightness.sh: Translate ACPI brightness
# to work with Nouveau brightness.
# Copyright © 2017 Adonay "adfeno" Felipe Nogueira <name at domain>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .

# # Dependencies
#
# - GNU bash is under GNU GPL 3+.
#
# - acpi is under GNU GPL 2+.

declare -A acpi_video
declare -A nv_backlight

acpi_video[path]="/sys/class/backlight/acpi_video0"
nv_backlight[path]="/sys/class/backlight/nv_backlight"

if [[ ! -d "${acpi_video[path]}" && ! -d "${nv_backlight[path]}" ]]
then
exit 1
fi

min_brightness=0
acpi_video[max_brightness]="$(cat "${acpi_video[path]}/max_brightness")"
nv_backlight[max_brightness]="$(cat "${nv_backlight[path]}/max_brightness")"
acpi_video[brightness]="$(cat "${acpi_video[path]}/brightness")"
nv_backlight[brightness]="$(cat "${nv_backlight[path]}/brightness")"

# Needed so that we don't have to watch the ACPI backlight brightness
# every time, and so that the Nouveau backlight brightness matches the
# ACPI one.
nv_backlight[brightness]="$(( ( ${acpi_video[brightness]} * ${nv_backlight[max_brightness]} ) / ${acpi_video[max_brightness]} ))"

# Needed to convert an ACPI backlight brightness step to a Nouveau
# backlight brightness step.
acpi_video_to_nv_backlight_step="$(( ( 1 * ${nv_backlight[max_brightness]} ) / ${acpi_video[max_brightness]} ))"

if [[ "${1}" == "down" ]]
then
nv_backlight[brightness]="$(( ( ( ${acpi_video[brightness]} * ${nv_backlight[max_brightness]} ) / ${acpi_video[max_brightness]} ) - acpi_video_to_nv_backlight_step ))"
elif [[ "${1}" == "up" ]]
then
nv_backlight[brightness]="$(( ( ( ${acpi_video[brightness]} * ${nv_backlight[max_brightness]} ) / ${acpi_video[max_brightness]} ) + acpi_video_to_nv_backlight_step ))"
fi

if [[ "${nv_backlight[brightness]}" -lt "${min_brightness}" ]]
then
nv_backlight[brightness]="${min_brightness}"
elif [[ "${nv_backlight[brightness]}" -gt "${nv_backlight[max_brightness]}" ]]
then
nv_backlight[brightness]="${nv_backlight[max_brightness]}"
fi

echo "${nv_backlight[brightness]}" > "${nv_backlight[path]}/brightness"
# End of file

8. Now, change the script mode so that everyone can read and execute:

$ sudo chmod +rx "/etc/acpi/acpi-to-nouveau-backlight-brightness.sh"

9. Now let's make ACPI events for the brightness keys, you can choose any
name, it doesn't have to be related to the script name. I choose
"acpi-to-nouveau-backlight-brightness-down" and
"acpi-to-nouveau-backlight-brightness-up" for down and up keys,
respectively.

However, if you changed the name of the first script, you have to change
it accordingly in the "event=" line of these "-down" and "-up" files.

$ sudo nano "acpi-to-nouveau-backlight-brightness-down"

# Begin of file
event=video/brightnessdown
action=/etc/acpi/acpi-to-nouveau-backlight-brightness.sh down
# End of file

$ sudo nano "acpi-to-nouveau-backlight-brightness-up"

# Begin of file
event=video/brightnessup
action=/etc/acpi/acpi-to-nouveau-backlight-brightness.sh up
# End of file

10. Make sure that each of these are readable by everyone:

$ sudo chmod +r "acpi-to-nouveau-backlight-brightness-down" "acpi-to-nouveau-backlight-brightness-up"

Happy hacking! :)
--
- [[https://libreplanet.org/wiki/User:Adfeno]]
- Palestrante e consultor sobre /software/ livre (não confundir com
gratis).
- "WhatsApp"? Ele não é livre, por isso não uso. Iguais a ele prefiro
Ring, ou Tox. Quer outras formas de contato? Adicione o vCard que
está no endereço acima aos teus contatos.
- Pretende me enviar arquivos .doc, .ppt, .cdr, ou .mp3? OK, eu
aceito, mas não repasso. Entrego apenas em formatos favoráveis ao
/software/ livre. Favor entrar em contato em caso de dúvida.
- "People said I should accept the world. Bullshit! I don't accept the
world."
--- Richard Stallman