Display Shutdown Dialog When Power Button Gets Clicked on ODROID-U3

In order to make your power button on ODROID-U3 work, you may have to install acpid at first. Otherwise, the power button won't even work.

I use latest Debian Wheezy on this board while MATE as the desktop environment. However, after installed acpid, the system is to shutdown immediately when I press the power button.

Let's see what acpid does when power button clicked, the contents of /etc/acpi/events/powerbtn-acpi-support are:

event=button[ /]power

It invokes /etc/acpi/powerbtn-acpi-support.sh which is basically to call /etc/acpi/powerbtn.sh if it exists, or /etc/acpi/powerbtn.sh.dpkg-bak if the former one doesn't exist, or shutdown directly if it doesn't exist neither. Unfortunately, there is no /etc/acpi/powerbtn.sh nor /etc/acpi/powerbtn.sh.dpkg-bak here.

Since we figured it out, we can modify the behaviour so that it'll prompt a shutdown dialog instead of poweroff without question. Add /etc/acpi/powerbtn.sh file whose contents are

mate-session-save --shutdown-dialog

If you're using other desktop environment, you need to replace the second line to other command. And, remember to add executable permission by command sudo chmod +x /etc/acpi/powerbtn.sh.

After this simple change, the power button should work expectedly now.