你好,游客 登录 注册 搜索
背景:
阅读新闻

Ubuntu 无法调节并保存屏幕亮度解决办法

[日期:2012-09-13] 来源:Linux社区  作者:congbo [字体:大 中 小]

测试环境:

Acer Aspire 5750G
NVIDIA GeForce GT630M
Ubuntu 12.04 x86_64

其他情况解决方法类似。

调节屏幕亮度
Fn不能调节屏幕的亮度。因为fn调节的是/sys/class/backlight/acpi_video0/brightness文件,而I卡的文件是/sys/class/backlight/intel_backlight/brightness。

一、测试代码

启动系统,出现grub菜单时,按“e”编辑,在有linux内核路径那一行,添加“acpi_backlight=vendor”,如:

linux    /boot/vmlinuz-3.2.0-30-generic root=UUID=75c414be-2e17-407a-b699-94f6a398dff7 ro acpi_backlight=vendor  quiet splash
如果能正常启动,且用fn能调节屏幕亮度,说明成功,接着下一步。

二、修改grub

sudo vi /etc/default/grub
找到:

GRUB_CMDLINE_LINUX=""
改为:

GRUB_CMDLINE_LINUX="acpi_backlight=vendor“

我的grub文件如下:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX="acpi_backlight=vendor"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

更新grub.cfg
➜  ~  sudo update-grub
 

查看grub.cfg 发现其中每个启动项都加入了“acpi_backlight=vendor”

➜  ~  vi /boot/grub/grub.cfg

设定屏幕初始亮度
重启后发现,屏幕亮度又恢复为最大亮度。

查看影响屏幕亮度的文件

➜  ~  vi /sys/class/backlight/intel_backlight/brightness
调节几次屏幕亮度发现其中数值会改变,我的笔记本数值范围为0~976。

手动修改该数值,会发现屏幕亮度随之改变(需要root用户执行):

➜  ~  su 
Password:
root@ www.linuxidc.com :/home/congbo# echo 500 > /sys/class/backlight/intel_backlight/brightness
因此,将该语句添加到 /etc/rc.local 就能开机自动设定屏幕初始亮度了。

修改/etc/rc.local如下(需要root用户执行):

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will “exit 0″ on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

echo 500 > /sys/class/backlight/intel_backlight/brightness
exit 0

调节gamma值
➜  ~  xgamma -gamma .7
-> Red  1.000, Green  1.000, Blue  1.000
<- Red  0.700, Green  0.700, Blue  0.700

linux
相关资讯       Ubuntu使用教程 
本文评论   查看全部评论 (1)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
第 1 楼
* 匿名 发表于 2013/10/14 9:46:53
按照你的方法我的成功了,不过不知道是不是我们的显卡都是GT630M的才成功,还是其他的都行,,不过不管怎么样,太感谢你,本来Fn是没法用的,现在终于可以了