ubuntu 12.04亮度无法调节和无法保存屏幕亮度解决办法(echo_brightness)
经过多次更改失败重装后终于在官网的answers找到了解决办法:原文链接 http://askubuntu.com/questions/3841/desktop-doesnt-remember-brightness-settings-after-a-reboot
1、解决reboot后无法保存屏幕亮度:
[cpp] view plaincopy
sudo gedit /etc/rc.local
打开后你会看到如下内容:
#!/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.
#exit 0
插入这句话到代码中:
echo 0 > /sys/class/backlight/acpi_video0/brightness
保证修改后代码如下,注意exit前的“#”
[cpp] view plaincopy
#!/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 0 > /sys/class/backlight/acpi_video0/brightness
exit 0
其中echo 后面的值为0-10,对应为0到100%,如echo 5表示一半亮度
保存后退出,重启就可以了。
注意:大多数人都是acpi_video0,根据自己/sys/class/backlight/下面文件决定
2、亮度调节
亮度调节依赖与你的bios和内核版本,你可以尝试以下代码:
kernel boot选项:
当你启动系统时,出现在grup的屏幕时,按e键进行编辑,在kernel这一行添加:
[cpp] view plaincopy
nomodeset acpi_backlight=vendor
注意:有些硬件可能会是不同的选项.
[cpp] view plaincopy
Intel - nomodeset acpi_backlight=intel Acer - acpi_backlight=acer_acpi or even acpi_osi=Linux acpi_backlight=legacy.
我的电脑是acer 4830tg,我直接写的=vendor也是同样可以正常工作,你也可以通过google去查找你要设置的选项。
[cpp] view plaincopy
quiet splash nomodeset acpi_backlight=vendor
退出启动,如果能正常启动,就把这项选项添加到默认的选项中,编辑文件/etc/default/grub
[cpp] view plaincopy
# command line
sudo -e /etc/default/grub
# graphical
gksu gedit /etc/default/grub
把这一行改成如下:
[cpp] view plaincopy
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset acpi_backlight=vendor"
保存,更新grup
[cpp] view plaincopy
sudo update-grub
如果还是没有解决问题的话请参照如下链接方法:
http://askubuntu.com/questions/3841/desktop-doesnt-remember-brightness-settings-after-a-reboot
******************************************
解决 Ubuntu 12.04 LTS 保存屏幕亮度的问题
首先,查看我们当前系统的屏幕亮度以及最大亮度值:
treasure@ASUS-N43S:~$ ls /sys/class/backlight/
acpi_video0 acpi_video1 intel_backlight
我这有两个acpi,不知道哪个是控制当前屏幕的acpi,那么我们可以通过以下命令进行测试
treasure@ASUS-N43S:~$ cat /sys/class/backlight/acpi_video0/actual_brightness
10
treasure@ASUS-N43S:~$ cat /sys/class/backlight/acpi_video0/brightness
10
treasure@ASUS-N43S:~$ cat /sys/class/backlight/acpi_video0/max_brightness
10
这三个10分别表示的是当前屏幕的实际亮度、亮度、最大亮度,取值范围在[0-10],值越大屏幕越亮。
treasure@ASUS-N43S:~$ cat /sys/class/backlight/acpi_video1/actual_brightness
2
treasure@ASUS-N43S:~$ cat /sys/class/backlight/acpi_video1/brightness
2
treasure@ASUS-N43S:~$ cat /sys/class/backlight/acpi_video1/max_brightness
10
很显然,控制我当前屏幕的亮度是acpi_video1,因为我在测试当前屏幕属于哪个acpi时,我对当前的屏幕亮度进行了设置,如果不是控制当前屏幕亮度的acpi,那么它默认的实际亮度和亮度是10的。
下面的问题怎样在开机时显示我们自己设置好的屏幕亮度,很简单,如下:
修改/etc/rc.local文件,命令:treasure@ASUS-N43S:~$ sudo gedit /etc/rc.local
在打开rc.local文件的 exit 0 语句的上面添加一行 sudo sh -c "echo -n 2 > /sys/class/backlight/acpi_video1/brightness" 就算完成啦!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 字符编码:从基础到乱码解决