beautiful-scenery

这个问题虽然不大,但是很致命。因为电脑一直保持着高亮,对眼睛的伤害非常大,所以必须解决。

我是在ubuntu下遇到的问题,但是不是每个版本都有,也不是每个笔记本型号都会遇到,,, 我的笔记本是惠普的,在 12.04 和 13.10 上都有这个问题。

——————————————————————————————————————————————————————————————————————————

参考论坛的帖子,找不到原帖了。

Debian7 下,笔记本上按Fn+《--- 调节亮度时,可以看到出现的图标亮度减少,可是实际不变。同样,在设置中调亮度也是一样。解决办法:
这种方法的基本使用条件是:intel 显卡对背光亮度起作用,在“/sys/class/backlight”下面有两个目录“acpi_video0”和“intel_backlight”,按亮度调节键时只对“acpi_video0”下面的“brightness”起作用,但真正对背光亮度起作用却是“intel_backlight”下面的“brightness”值

wrote a rules of "/etc/udev/rules.d/99-writeintelbacklight.rules" as below:

ACTION=="change", SUBSYSTEM=="backlight", RUN+="/usr/sbin/writeintelbacklight.sh"

A shell: "/usr/sbin/writeintelbacklight.sh"

#!/bin/bash

intelmaxbrightness=`cat /sys/class/backlight/intel_backlight/max_brightness`
acpimaxbrightness=`cat /sys/class/backlight/acpi_video0/max_brightness`
scale=`expr $intelmaxbrightness / $acpimaxbrightness`
acpibrightness=`cat /sys/class/backlight/acpi_video0/brightness`
newintelbrightness=`expr $acpibrightness \* $scale`
curintelbrightness=`cat /sys/class/backlight/intel_backlight/actual_brightness`
if [ "$newintelbrightness" -ne "$curintelbrightness" ]
then
echo $newintelbrightness > /sys/class/backlight/intel_backlight/brightness
fi
exit 0

Of course, you need do a "sudo chmod +x /usr/sbin/writeintelbacklight.sh"

————————————————————————————————————————————————————————————

上面的方法解决了我在12.04中的问题,但是在13.04中还是失灵了。

其实改变笔记本亮度,决定作用的就是修改 /sys/class/backlight/intel_backlight/brightness, 至少在我的笔记本是这样的。于是,我干脆写了脚本,内如如下:

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

1000 是一个我常用的亮度值。觉得需要的时候,执行一下这个命令,,, 凑合吧先。

 

————————————————————————————————————————————————————————————

    1. trying to echo /sys/class/backlight/acpi_video0/brightness : Permission denied

      Hi Community, 

      i\'m new to UBUNTU. I\'ve recently installed ubuntu 12.10 and have several issues. One of them is that my brightness always sets itself to 100% at a new boot. I\'ve a line in /etc/rc.local: 

      Code:
      echo 7 > /sys/class/backlight/acpi_video0/brightness
      but it won\'t execute. Every boot the screen gets set to max.
      If i run the command logged in as root
      Code:
      sudo su
      it works.
      but 
      Code:
      mo@x1-carbon:~$ sudo echo 6> /sys/class/backlight/acpi_video0/brightness
      bash: /sys/class/backlight/acpi_video0/brightness: Permission denied
      gives me no permission. 

      What am I missing?

      Thanks for your help,
      m
    2.  

      Re: trying to echo /sys/class/backlight/acpi_video0/brightness : Permission denied

      Your command gives elevated permissions to the echo command (which doesn\'t need them), but not to the part that redirects the output stream to the root-owned file (which does)

      In a terminal, you can either do

      Code:
      echo 7 | sudo tee /sys/class/backlight/acpi_video0/brightness
      which gives the elevated permission to the bit that really needs it, or

      Code:
      sudo sh -c "echo 7 > /sys/class/backlight/acpi_video0/brightness"
      which runs the whole command in a sudo shell

      HOWEVER you shouldn\'t use sudo at all in /etc/rc.local since it should be executed as root - something else must be going wrong there

分类:

技术点:

相关文章: