LINUX.ORG.RU

Сообщения steel_beams

 

ACPID и изменение яркости экрана

Форум — Desktop

Всем привет. Стоит Fedora 21 на ноутбуке асере. Дело в том, что при отключении/подключении питания меняется яркость. Хочу сделать, чтобы яркость всегда оставалась одной и той же. Нашел на арч вики скрипт с acpid.

Установил acpid.

В /etc/acpi/switch-to-battery.sh написал:

ac_adapter)
    case "$2" in
        AC*|AD*)
            case "$4" in
                00000000)
                    echo -n 3 > /sys/class/backlight/acpi_video0/brightness
                    ;;
                00000001)
                    echo -n 3 > /sys/class/backlight/acpi_video0/brightness
                    ;;
            esac

/etc/acpi/events/switch-to-battery:

event=ac_adapter ACPI0003:00 00000080 00000000
action=/etc/acpi/switch-to-battery.sh

Отключение/Включение питание $ acpi_listen

ac_adapter ACPI0003:00 00000080 00000000
processor LNXCPU:00 00000081 00000000
processor LNXCPU:01 00000081 00000000
processor LNXCPU:02 00000081 00000000
processor LNXCPU:03 00000081 00000000
battery PNP0C0A:00 00000080 00000001
ac_adapter ACPI0003:00 00000080 00000000
battery PNP0C0A:00 00000080 00000001
ac_adapter ACPI0003:00 00000080 00000001
processor LNXCPU:00 00000081 00000000
processor LNXCPU:01 00000081 00000000
processor LNXCPU:02 00000081 00000000
processor LNXCPU:03 00000081 00000000
battery PNP0C0A:00 00000080 00000001
ac_adapter ACPI0003:00 00000080 00000001
battery PNP0C0A:00 00000080 00000001

$ journalctl -u acpid -f

Apr 27 22:53:31 pipboy acpid[8993]: waiting for events: event logging is on
Apr 27 22:53:35 pipboy acpid[8993]: received netlink event "ac_adapter ACPI0003:00 00000080 00000000"
Apr 27 22:53:35 pipboy acpid[8993]: rule from /etc/acpi/events/switch-to-battery matched
Apr 27 22:53:35 pipboy acpid[8997]: executing action "/etc/acpi/switch-to-battery.sh"
Apr 27 22:53:35 pipboy acpid[8993]: action exited with status 0
Apr 27 22:53:35 pipboy acpid[8993]: 1 total rule matched
Apr 27 22:53:35 pipboy acpid[8993]: completed netlink event "ac_adapter ACPI0003:00 00000080 00000000"
Apr 27 22:53:35 pipboy acpid[8993]: received netlink event "processor LNXCPU:00 00000081 00000000"
Apr 27 22:53:35 pipboy acpid[8993]: 0 total rules matched
Apr 27 22:53:35 pipboy acpid[8993]: completed netlink event "processor LNXCPU:00 00000081 00000000"
Apr 27 22:53:35 pipboy acpid[8993]: received netlink event "processor LNXCPU:01 00000081 00000000"
Apr 27 22:53:35 pipboy acpid[8993]: 0 total rules matched
Apr 27 22:53:35 pipboy acpid[8993]: completed netlink event "processor LNXCPU:01 00000081 00000000"
Apr 27 22:53:35 pipboy acpid[8993]: received netlink event "processor LNXCPU:02 00000081 00000000"
Apr 27 22:53:35 pipboy acpid[8993]: 0 total rules matched
Apr 27 22:53:35 pipboy acpid[8993]: completed netlink event "processor LNXCPU:02 00000081 00000000"
Apr 27 22:53:35 pipboy acpid[8993]: received netlink event "processor LNXCPU:03 00000081 00000000"
Apr 27 22:53:35 pipboy acpid[8993]: 0 total rules matched
Apr 27 22:53:35 pipboy acpid[8993]: completed netlink event "processor LNXCPU:03 00000081 00000000"
Apr 27 22:53:35 pipboy acpid[8993]: received netlink event "battery PNP0C0A:00 00000080 00000001"
Apr 27 22:53:35 pipboy acpid[8993]: 0 total rules matched
Apr 27 22:53:35 pipboy acpid[8993]: completed netlink event "battery PNP0C0A:00 00000080 00000001"
Apr 27 22:53:35 pipboy acpid[8993]: received netlink event "ac_adapter ACPI0003:00 00000080 00000000"
Apr 27 22:53:35 pipboy acpid[8993]: rule from /etc/acpi/events/switch-to-battery matched
Apr 27 22:53:35 pipboy acpid[9064]: executing action "/etc/acpi/switch-to-battery.sh"
Apr 27 22:53:35 pipboy acpid[8993]: action exited with status 0

$ sudo systemctl status acpid

 password for pie: 
● acpid.service - ACPI Event Daemon
   Loaded: loaded (/usr/lib/systemd/system/acpid.service; static)
   Active: active (running) since Mon 2015-04-27 23:11:50 VLAT; 15min ago
     Docs: man:acpid(8)
 Main PID: 10648 (acpid)
   CGroup: /system.slice/acpid.service
           └─10648 /usr/sbin/acpid -f -l

Apr 27 23:24:25 pipboy acpid[10648]: rule from 10909[1000:1000] matched
Apr 27 23:24:25 pipboy acpid[10648]: notifying client 10909[1000:1000]
Apr 27 23:24:25 pipboy acpid[10648]: 1 total rule matched
Apr 27 23:24:25 pipboy acpid[10648]: completed netlink event "ac_adapter ACPI0003:00 00000080 00000001"
Apr 27 23:24:26 pipboy acpid[10648]: received netlink event "battery PNP0C0A:00 00000080 00000001"
Apr 27 23:24:26 pipboy acpid[10648]: rule from 10909[1000:1000] matched
Apr 27 23:24:26 pipboy acpid[10648]: notifying client 10909[1000:1000]
Apr 27 23:24:26 pipboy acpid[10648]: 1 total rule matched
Apr 27 23:24:26 pipboy acpid[10648]: completed netlink event "battery PNP0C0A:00 00000080 00000001"
Apr 27 23:27:23 pipboy acpid[10648]: client 10909[1000:1000] has disconnected

Яркость меняется по прежнему. Если просто запустить «sudo /etc/acpi/switch-to-battery.sh ac_adapter ACPI0003:00 00000080 00000000», то ругался на синтаксис скрипта. Поэтому я изменил его на:

#ac_adapter)
    case "$2" in
        AC*|AD*)
            case "$4" in
                00000000)
                    echo -n 3 > /sys/class/backlight/acpi_video0/brightness
                    ;;
                00000001)
                    echo -n 3 > /sys/class/backlight/acpi_video0/brightness
                    ;;
            esac
        esac

Так яркость изменяется вышеуказанным способом. Однако acpid опять же никак не реагирует. В общем, подскажите, пожалуйста, как это сделать.

 , ,

steel_beams
()

RSS подписка на новые темы