Changes

Jump to: navigation, search
test* This application note provides an example of how to capture a power button click event.* The below has been tested on: fitlet2  1. Set BIOS -> Main -> OS selection to [Linux] 2. Ignore power button handling provided by systemd, don't forget to reboot: $ sudo sed -i s/".*HandlePowerKey.*"/"HandlePowerKey=ignore"/ /etc/systemd/logind.conf $ sudo reboot 3. Install ACPI related software if not installed yet: $ sudo apt install acpi-support-base acpid  $ service acpid status ● acpid.service - ACPI event daemon Loaded: loaded (/lib/systemd/system/acpid.service; disabled; vendor preset: enabled) Active: active (running) since Tue 2018-10-16 05:56:43 EDT; 1s ago Main PID: 1754 (acpid) Tasks: 1 (limit: 4915) CGroup: /system.slice/acpid.service └─1754 /usr/sbin/acpid  Oct 16 05:56:43 x86-atp-master systemd[1]: Started ACPI event daemon. Oct 16 05:56:43 x86-atp-master acpid[1754]: starting up with netlink and the input layer Oct 16 05:56:43 x86-atp-master acpid[1754]: 1 rule loaded Oct 16 05:56:43 x86-atp-master acpid[1754]: waiting for events: event logging is off 4. Verify acpi events are visible in the system, run acpi_listen tool and press power button 2-3 times: $ acpi_listen button/power PBTN 00000080 00000000 button/power LNXPWRBN:00 00000080 00000007 button/power PBTN 00000080 00000000 button/power LNXPWRBN:00 00000080 00000008 5. Edit /etc/acpi/events/powerbtn-acpi-support: event=power (PBTN) 00000080 action=/etc/acpi/powerbtn-acpi-support-new.sh 6. Create your custom script named /etc/acpi/powerbtn-acpi-support-new.sh: #!/bin/sh echo "Hello from PBTN!" > /dev/tty1 7. Make it executable $ chmod +x /etc/acpi/powerbtn-acpi-support-new.sh 8. Restart acpid service to activate the new functionality $ service acpid restart 9. Press power button shortly, you should see: "Hello from PBTN!" on tty1
1,586
edits